From ac1608d683021bc196293c283f293fb10b989aa7 Mon Sep 17 00:00:00 2001 From: Arseniy-Movshev Date: Wed, 31 May 2023 12:53:37 +0100 Subject: 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 --- daemon/sensorPlugins/stepCounter.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'daemon/sensorPlugins') 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. } } -- cgit v1.2.3-70-g09d2