summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2021-10-25 17:45:48 +0300
committerRiku Isokoski <riksu9000@gmail.com>2021-10-25 17:45:48 +0300
commit60a717b1a2272e61dfc4d297998da1c7672a8316 (patch)
treea58ef998458030c4af2ba822022de6d2d2782a96
parent887c409b135bb2f21f2fb5ae70a4d8831049d14d (diff)
Make it so special actions can be input while sleeping, like in #480
-rw-r--r--src/systemtask/SystemTask.cpp12
-rw-r--r--src/systemtask/SystemTask.h2
2 files changed, 10 insertions, 4 deletions
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;