summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2021-02-25 07:45:53 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2021-02-25 07:45:53 (GMT)
commitaffa101169ea242d7597078bc131403eb3624f5a (patch)
treebe6d39aba3b796b1b9ac871b349b2c703bde95e6
parent474851219a8ee3d373b61e33d6a3fcce48fca6cb (diff)
steplogger: Ensure today's data is updated when we provide it
Currently steps from the last six minutes do not appear in the data. We can fix this by updating the data before creating the iterator. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
-rw-r--r--wasp/steplogger.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/wasp/steplogger.py b/wasp/steplogger.py
index 77eb5fd..ca5a968 100644
--- a/wasp/steplogger.py
+++ b/wasp/steplogger.py
@@ -153,6 +153,11 @@ class StepLogger:
now = time.localtime(self._t)
if now[:3] == t[:3]:
latest = self._data
+
+ # Work out where we are in the dump period and update
+ # with the latest counts
+ i = self._t % DUMP_PERIOD // TICK_PERIOD
+ latest[i] = wasp.watch.accel.steps - self._steps
else:
latest = None