summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseniy-Movshev <dodoradio@outlook.com>2023-05-31 12:53:37 +0100
committerArseniy-Movshev <dodoradio@outlook.com>2023-06-01 13:32:10 +0100
commitac1608d683021bc196293c283f293fb10b989aa7 (patch)
treead896b9f1fec6710ba1cc7c82a600de7dd54fafb
parent4af2e8a736f02a9309a80ef7ab8229e4d5b163c7 (diff)
step counter: Make sure that there's a time for the last record when sensor logger is constructed
otherwise the next recording would assume that a midnight has passed and write bad values to the sensor
Diffstat (limited to '')
-rw-r--r--daemon/sensorPlugins/stepCounter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/daemon/sensorPlugins/stepCounter.cpp b/daemon/sensorPlugins/stepCounter.cpp
index 3df23c7..7dd8627 100644
--- a/daemon/sensorPlugins/stepCounter.cpp
+++ b/daemon/sensorPlugins/stepCounter.cpp
@@ -41,6 +41,7 @@ StepCounterPlugin::StepCounterPlugin(QObject *parent, int initInterval) :
if (dayFileExists(sensorPathPrefix)) {
QStringList lastLineData = fileGetPrevRecord(sensorPathPrefix);
+ lastRecordTime = QDateTime::currentDateTime();
stepcounterSensor->reading()->setSteps(lastLineData[1].toInt() + stepcounterSensor->reading()->steps()); // we add the last recorded value from today to the current value. This 'recovers' the steps from between reboots. I'm not sure how this will work on catfish or medaka.
}
}