diff options
Diffstat (limited to 'src/plugins/sensors/generic/generictiltsensor.cpp')
-rw-r--r-- | src/plugins/sensors/generic/generictiltsensor.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/sensors/generic/generictiltsensor.cpp b/src/plugins/sensors/generic/generictiltsensor.cpp index df07355..01281bd 100644 --- a/src/plugins/sensors/generic/generictiltsensor.cpp +++ b/src/plugins/sensors/generic/generictiltsensor.cpp @@ -106,6 +106,11 @@ void GenericTiltSensor::calibrate() calibratedRoll = roll; } +static qreal rad2deg(qreal rad) +{ + return rad / (2 * M_PI) * 360; +} + bool GenericTiltSensor::filter(QAccelerometerReading *reading) { /* @@ -168,6 +173,10 @@ bool GenericTiltSensor::filter(QAccelerometerReading *reading) yRotation = yrot; change = true; } + + xRotation = rad2deg(xRotation); + yRotation = rad2deg(yRotation); + if (xRotation != m_reading.xRotation() || yRotation != m_reading.yRotation() || m_reading.timestamp() == 0) { |