diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp index 1f01b1b5..39e9751b 100644 --- a/src/SystemTask/SystemTask.cpp +++ b/src/SystemTask/SystemTask.cpp @@ -120,15 +120,15 @@ void SystemTask::Work() { isSleeping = true; break; case Messages::OnNewTime: - xTimerReset(idleTimer, 0); + ReloadIdleTimer(); displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime); break; case Messages::OnNewNotification: - xTimerReset(idleTimer, 0); + if(isSleeping) GoToRunning(); displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification); break; case Messages::BleConnected: - xTimerReset(idleTimer, 0); + ReloadIdleTimer(); isBleDiscoveryTimerRunning = true; bleDiscoveryTimer = 5; break; @@ -145,10 +145,10 @@ void SystemTask::Work() { NVIC_SystemReset(); break; case Messages::OnTouchEvent: - xTimerReset(idleTimer, 0); + ReloadIdleTimer(); break; case Messages::OnButtonEvent: - xTimerReset(idleTimer, 0); + ReloadIdleTimer(); break; default: break; } @@ -217,3 +217,8 @@ void SystemTask::OnIdle() { NRF_LOG_INFO("Idle timeout -> Going to sleep") PushMessage(Messages::GoToSleep); } + +void SystemTask::ReloadIdleTimer() const { + if(isSleeping) return; + xTimerReset(idleTimer, 0); +} diff --git a/src/SystemTask/SystemTask.h b/src/SystemTask/SystemTask.h index e006058f..860647a1 100644 --- a/src/SystemTask/SystemTask.h +++ b/src/SystemTask/SystemTask.h @@ -66,6 +66,7 @@ namespace Pinetime { static void Process(void* instance); void Work(); + void ReloadIdleTimer() const; bool isBleDiscoveryTimerRunning = false; uint8_t bleDiscoveryTimer = 0; static constexpr uint32_t idleTime = 15000;