Make it so special actions can be input while sleeping, like in #480
This commit is contained in:
parent
887c409b13
commit
60a717b1a2
|
@ -336,16 +336,17 @@ void SystemTask::Work() {
|
||||||
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent);
|
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent);
|
||||||
break;
|
break;
|
||||||
case Messages::HandleButtonEvent: {
|
case Messages::HandleButtonEvent: {
|
||||||
// This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
|
|
||||||
Controllers::ButtonActions action;
|
Controllers::ButtonActions action;
|
||||||
if (nrf_gpio_pin_read(Pinetime::PinMap::Button) == 0) {
|
if (nrf_gpio_pin_read(Pinetime::PinMap::Button) == 0) {
|
||||||
action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Release);
|
action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Release);
|
||||||
} else {
|
} else {
|
||||||
|
action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Press);
|
||||||
|
// This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
|
||||||
if (IsSleeping()) {
|
if (IsSleeping()) {
|
||||||
|
fastWakeUpDone = true;
|
||||||
GoToRunning();
|
GoToRunning();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
action = buttonHandler.HandleEvent(Controllers::ButtonHandler::Events::Press);
|
|
||||||
}
|
}
|
||||||
HandleButtonAction(action);
|
HandleButtonAction(action);
|
||||||
} break;
|
} break;
|
||||||
|
@ -448,7 +449,8 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) {
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Actions::Click:
|
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);
|
displayApp.PushMessage(Applications::Display::Messages::ButtonPushed);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -462,8 +464,10 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) {
|
||||||
displayApp.PushMessage(Applications::Display::Messages::ButtonLongerPressed);
|
displayApp.PushMessage(Applications::Display::Messages::ButtonLongerPressed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fastWakeUpDone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTask::GoToRunning() {
|
void SystemTask::GoToRunning() {
|
||||||
|
|
|
@ -140,6 +140,8 @@ namespace Pinetime {
|
||||||
bool doNotGoToSleep = false;
|
bool doNotGoToSleep = false;
|
||||||
|
|
||||||
void HandleButtonAction(Controllers::ButtonActions action);
|
void HandleButtonAction(Controllers::ButtonActions action);
|
||||||
|
bool fastWakeUpDone = false;
|
||||||
|
|
||||||
void GoToRunning();
|
void GoToRunning();
|
||||||
void UpdateMotion();
|
void UpdateMotion();
|
||||||
bool stepCounterMustBeReset = false;
|
bool stepCounterMustBeReset = false;
|
||||||
|
|
Loading…
Reference in a new issue