From 29f8c8e30c9c803a012290cab6a72e95ee6cdab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ndor=20R=C3=A1tkai?= Date: Wed, 11 Sep 2024 08:35:28 +0200 Subject: [PATCH] Do not set unsigned step count to -1 --- src/components/motion/MotionController.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/motion/MotionController.cpp b/src/components/motion/MotionController.cpp index 0a00abac..abe70ca0 100644 --- a/src/components/motion/MotionController.cpp +++ b/src/components/motion/MotionController.cpp @@ -37,8 +37,11 @@ namespace { } void MotionController::AdvanceDay() { - --nbSteps; // Higher index = further in the past - nbSteps[today] = -1; // Ensure that the `this->nbSteps[today] != nbSteps` condition in `Update()` will be FALSE + --nbSteps; // Higher index = further in the past + nbSteps[today] = 0; + if (service != nullptr) { + service->OnNewStepCountValue(nbSteps[today]); + } } void MotionController::Update(int16_t x, int16_t y, int16_t z, MotionController::step_t nbSteps) {