Skip to content

Commit 8c32e5f

Browse files
committed
Fix ignore steps logic
Don't count up trip steps during sleep. Check if deltaSteps is greater than zero before adding to ignoreSteps as well as trip steps.
1 parent cfa8c79 commit 8c32e5f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/components/motion/MotionController.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ void MotionController::Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps)
6060
stats = GetAccelStats();
6161

6262
int32_t deltaSteps = nbSteps - this->nbSteps;
63+
6364
if (deltaSteps > 0) {
64-
currentTripSteps += deltaSteps;
65+
if (settingsController.isSleepOptionOn(Settings::SleepOption::IgnoreSteps) &&
66+
settingsController.GetNotificationStatus() == Pinetime::Controllers::Settings::Notification::Sleep) {
67+
ignoreSteps += deltaSteps;
68+
} else {
69+
currentTripSteps += deltaSteps;
70+
}
6571
}
66-
this->nbSteps = nbSteps;
6772

68-
if (settingsController.isSleepOptionOn(Settings::SleepOption::IgnoreSteps) &&
69-
settingsController.GetNotificationStatus() == Pinetime::Controllers::Settings::Notification::Sleep) {
70-
ignoreSteps += deltaSteps;
71-
}
73+
this->nbSteps = nbSteps;
7274
}
7375

7476
MotionController::AccelStats MotionController::GetAccelStats() const {

0 commit comments

Comments
 (0)