summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2013-01-10 17:46:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-15 17:39:03 +0100
commit91030f1ac36c5b4f6a5cd7333fd8965446f7a203 (patch)
treed026891313a5790baf9ae8e9edac3e3eea39aa9b /src
parent73705cc57ad9befc95de9508912a09139a112edd (diff)
Generic Tilt sensor: Use degree rather than radians
This is stated in the docs and it is also more consistent with all other sensors. Change-Id: I5d1d074630f9efa7371a42d10196984549769e24 Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/sensors/generic/generictiltsensor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/sensors/generic/generictiltsensor.cpp b/src/plugins/sensors/generic/generictiltsensor.cpp
index df07355d..01281bd0 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) {