Skip to content

Commit 90e458b

Browse files
committed
Unconditionally update motion
1 parent 8a60a21 commit 90e458b

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

src/systemtask/SystemTask.cpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ void SystemTask::Work() {
183183
#pragma clang diagnostic push
184184
#pragma ide diagnostic ignored "EndlessLoop"
185185
while (true) {
186-
UpdateMotion();
187-
188186
Messages msg;
189187
if (xQueueReceive(systemTasksMsgQueue, &msg, 100) == pdTRUE) {
190188
switch (msg) {
@@ -316,9 +314,7 @@ void SystemTask::Work() {
316314
}
317315
break;
318316
case Messages::OnNewDay:
319-
// We might be sleeping (with TWI device disabled.
320-
// Remember we'll have to reset the counter next time we're awake
321-
stepCounterMustBeReset = true;
317+
motionSensor.ResetStepCounter();
322318
break;
323319
case Messages::OnNewHour:
324320
using Pinetime::Controllers::AlarmController;
@@ -362,6 +358,7 @@ void SystemTask::Work() {
362358
}
363359
}
364360

361+
UpdateMotion();
365362
if (isBleDiscoveryTimerRunning) {
366363
if (bleDiscoveryTimer == 0) {
367364
isBleDiscoveryTimerRunning = false;
@@ -429,18 +426,8 @@ void SystemTask::GoToSleep() {
429426
};
430427

431428
void SystemTask::UpdateMotion() {
432-
// Only consider disabling motion updates specifically in the Sleeping state
433-
// AOD needs motion on to show up to date step counts
434-
if (state == SystemTaskState::Sleeping && !(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) ||
435-
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake) ||
436-
motionController.GetService()->IsMotionNotificationSubscribed())) {
437-
return;
438-
}
439-
440-
if (stepCounterMustBeReset) {
441-
motionSensor.ResetStepCounter();
442-
stepCounterMustBeReset = false;
443-
}
429+
// Unconditionally update motion
430+
// Reading steps/motion characteristics must return up to date information even when not subscribed to notifications
444431

445432
auto motionValues = motionSensor.Process();
446433

src/systemtask/SystemTask.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ namespace Pinetime {
139139
void GoToRunning();
140140
void GoToSleep();
141141
void UpdateMotion();
142-
bool stepCounterMustBeReset = false;
143142
static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000);
144143

145144
SystemMonitor monitor;

0 commit comments

Comments
 (0)