Commit 0103934 1 parent a196c61 commit 0103934 Copy full SHA for 0103934
File tree 1 file changed +7
-1
lines changed
app/src/main/java/app/grapheneos/camera/notifier
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ class SensorOrientationChangeNotifier private constructor(
95
95
filteredValues[2 ] = ALPHA * filteredValues[2 ] + (1 - ALPHA ) * event.values[2 ]
96
96
97
97
var x : Float = filteredValues[0 ]
98
- val y : Float = filteredValues[1 ]
98
+ var y : Float = filteredValues[1 ]
99
99
var z : Float = filteredValues[2 ]
100
100
101
101
var newOrientation = mOrientation
@@ -114,6 +114,12 @@ class SensorOrientationChangeNotifier private constructor(
114
114
return
115
115
}
116
116
117
+ if (newOrientation == 90 || newOrientation == 270 ) {
118
+ val t = x
119
+ x = y
120
+ y = t
121
+ }
122
+
117
123
x = ((180 / Math .PI ) * atan(x / sqrt(y * y + z * z))).toFloat()
118
124
z = ((180 / Math .PI ) * atan(z / sqrt(y * y + x * x))).toFloat()
119
125
You can’t perform that action at this time.
0 commit comments