From 80da360e5213c0481ba7c19a463129eb19e3d7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Ryyn=C3=A4nen?= Date: Wed, 1 Feb 2017 11:18:49 +0200 Subject: Accelometer changed to report values in G instead of mG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4193b6566f7408f3e3e09161987d107941e2a6b2 Reviewed-by: Kari Hautamäki Reviewed-by: Titta Heikkala --- tradeshow/iot-sensortag/mockdataprovider.cpp | 44 +++++++++++++--------------- 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'tradeshow/iot-sensortag/mockdataprovider.cpp') diff --git a/tradeshow/iot-sensortag/mockdataprovider.cpp b/tradeshow/iot-sensortag/mockdataprovider.cpp index ad56c28..f081c30 100644 --- a/tradeshow/iot-sensortag/mockdataprovider.cpp +++ b/tradeshow/iot-sensortag/mockdataprovider.cpp @@ -52,9 +52,8 @@ MockDataProvider::MockDataProvider(QString id, QObject* parent) : SensorTagDataProvider(id, parent), - xAxisG(-10), - yAxisG(10), - zAxisG(0), + xAxisG(-0.02), + zAxisG(0.02), luxIncrease(100), rotationDegPerSecXIncrease(5), rotationDegPerSecYIncrease(7), @@ -66,6 +65,8 @@ MockDataProvider::MockDataProvider(QString id, QObject* parent) irObjectTemperature = 25; barometerCelsiusTemperature = 25; barometerHPa = 1040; + accelometerX = 1; + accelometerZ = 0; magnetometerMicroT_xAxis = 333; magnetometerMicroT_yAxis = 666; magnetometerMicroT_zAxis = 999; @@ -171,28 +172,23 @@ void MockDataProvider::oneSecondTimerExpired() void MockDataProvider::twentyMsTimerExpired() { //Rotate counter-clockwise around Z axis - if ((zAxisG > -10) && - (xAxisG <= 0)) { - if (zAxisG <= 0) { - xAxisG += 2; - zAxisG -= 2; - } else { - xAxisG -= 2; - zAxisG -= 2; - } - } else { - if (zAxisG < 0) { - xAxisG += 2; - zAxisG += 2; - } else { - xAxisG -= 2; - zAxisG += 2; - } + accelometerX += xAxisG; + if (accelometerX < -1) { + xAxisG = xAxisG * -1; + accelometerX = -1; + } else if (accelometerX > 1) { + xAxisG = xAxisG * -1; + accelometerX = 1; } - accelometer_mG_xAxis = xAxisG * 100; - accelometer_mG_yAxis = yAxisG * 100; - accelometer_mG_zAxis = zAxisG * 100; - emit accelometerGChanged(); + accelometerZ += zAxisG; + if (accelometerZ < -1) { + zAxisG = zAxisG * -1; + accelometerZ = -1; + } else if (accelometerZ > 1) { + zAxisG = zAxisG * -1; + accelometerZ = 1; + } + emit accelometerChanged(); magnetometerMicroT_xAxis += 50; magnetometerMicroT_yAxis += 50; magnetometerMicroT_zAxis += 50; -- cgit v1.2.3