diff options
| author | mark9064 <30447455+mark9064@users.noreply.github.com> | 2024-10-18 00:04:52 +0100 |
|---|---|---|
| committer | mark9064 <30447455+mark9064@users.noreply.github.com> | 2025-10-15 17:36:02 +0100 |
| commit | 90e458b00075955f5fe459f4f9f965d9ddf9d11c (patch) | |
| tree | cb6340bffe44e19ceded4298b212a415ff1a2f96 /src/systemtask | |
| parent | 8a60a2147cb6cc77a811ff40ab24a7880cfc5d6b (diff) | |
Unconditionally update motion
Diffstat (limited to 'src/systemtask')
| -rw-r--r-- | src/systemtask/SystemTask.cpp | 21 | ||||
| -rw-r--r-- | src/systemtask/SystemTask.h | 1 |
2 files changed, 4 insertions, 18 deletions
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 8e0435e3..0a38f03f 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -183,8 +183,6 @@ void SystemTask::Work() { #pragma clang diagnostic push #pragma ide diagnostic ignored "EndlessLoop" while (true) { - UpdateMotion(); - Messages msg; if (xQueueReceive(systemTasksMsgQueue, &msg, 100) == pdTRUE) { switch (msg) { @@ -316,9 +314,7 @@ void SystemTask::Work() { } break; case Messages::OnNewDay: - // We might be sleeping (with TWI device disabled. - // Remember we'll have to reset the counter next time we're awake - stepCounterMustBeReset = true; + motionSensor.ResetStepCounter(); break; case Messages::OnNewHour: using Pinetime::Controllers::AlarmController; @@ -362,6 +358,7 @@ void SystemTask::Work() { } } + UpdateMotion(); if (isBleDiscoveryTimerRunning) { if (bleDiscoveryTimer == 0) { isBleDiscoveryTimerRunning = false; @@ -429,18 +426,8 @@ void SystemTask::GoToSleep() { }; void SystemTask::UpdateMotion() { - // Only consider disabling motion updates specifically in the Sleeping state - // AOD needs motion on to show up to date step counts - if (state == SystemTaskState::Sleeping && !(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) || - settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake) || - motionController.GetService()->IsMotionNotificationSubscribed())) { - return; - } - - if (stepCounterMustBeReset) { - motionSensor.ResetStepCounter(); - stepCounterMustBeReset = false; - } + // Unconditionally update motion + // Reading steps/motion characteristics must return up to date information even when not subscribed to notifications auto motionValues = motionSensor.Process(); diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 0ee877b7..9d99124e 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -139,7 +139,6 @@ namespace Pinetime { void GoToRunning(); void GoToSleep(); void UpdateMotion(); - bool stepCounterMustBeReset = false; static constexpr TickType_t batteryMeasurementPeriod = pdMS_TO_TICKS(10 * 60 * 1000); SystemMonitor monitor; |
