File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -336,16 +336,17 @@ void SystemTask::Work() {
336336 displayApp.PushMessage (Pinetime::Applications::Display::Messages::TouchEvent);
337337 break ;
338338 case Messages::HandleButtonEvent: {
339- // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
340339 Controllers::ButtonActions action;
341340 if (nrf_gpio_pin_read (Pinetime::PinMap::Button) == 0 ) {
342341 action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Release);
343342 } else {
343+ action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Press);
344+ // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
344345 if (IsSleeping ()) {
346+ fastWakeUpDone = true ;
345347 GoToRunning ();
346348 break ;
347349 }
348- action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Press);
349350 }
350351 HandleButtonAction (action);
351352 } break ;
@@ -448,7 +449,8 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) {
448449
449450 switch (action) {
450451 case Actions::Click:
451- if (!isGoingToSleep) {
452+ // If the first action after fast wakeup is a click, it should be ignored.
453+ if (!fastWakeUpDone && !isGoingToSleep) {
452454 displayApp.PushMessage (Applications::Display::Messages::ButtonPushed);
453455 }
454456 break ;
@@ -462,8 +464,10 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) {
462464 displayApp.PushMessage (Applications::Display::Messages::ButtonLongerPressed);
463465 break ;
464466 default :
465- break ;
467+ return ;
466468 }
469+
470+ fastWakeUpDone = false ;
467471}
468472
469473void SystemTask::GoToRunning () {
Original file line number Diff line number Diff line change @@ -140,6 +140,8 @@ namespace Pinetime {
140140 bool doNotGoToSleep = false ;
141141
142142 void HandleButtonAction (Controllers::ButtonActions action);
143+ bool fastWakeUpDone = false ;
144+
143145 void GoToRunning ();
144146 void UpdateMotion ();
145147 bool stepCounterMustBeReset = false ;
You can’t perform that action at this time.
0 commit comments