1
0
Fork 0

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>
pull/169/head
Daniel Thompson 2021-02-25 07:45:53 +00:00
parent 474851219a
commit affa101169
1 changed files with 5 additions and 0 deletions

View File

@ -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