diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 51dbc3e3..0a3f9951 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -336,16 +336,17 @@ void SystemTask::Work() { displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent); break; case Messages::HandleButtonEvent: { - // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping Controllers::ButtonActions action; if (nrf_gpio_pin_read(Pinetime::PinMap::Button) == 0) { action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Release); } else { + action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Press); + // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping if (IsSleeping()) { + fastWakeUpDone = true; GoToRunning(); break; } - action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Press); } HandleButtonAction(action); } break; @@ -448,7 +449,8 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) { switch (action) { case Actions::Click: - if (!isGoingToSleep) { + // If the first action after fast wakeup is a click, it should be ignored. + if (!fastWakeUpDone && !isGoingToSleep) { displayApp.PushMessage(Applications::Display::Messages::ButtonPushed); } break; @@ -462,8 +464,10 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) { displayApp.PushMessage(Applications::Display::Messages::ButtonLongerPressed); break; default: - break; + return; } + + fastWakeUpDone = false; } void SystemTask::GoToRunning() { diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index d6045e9c..412878b1 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -140,6 +140,8 @@ namespace Pinetime { bool doNotGoToSleep = false; void HandleButtonAction(Controllers::ButtonActions action); + bool fastWakeUpDone = false; + void GoToRunning(); void UpdateMotion(); bool stepCounterMustBeReset = false;