diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h index 39fb4114..fee94bb7 100644 --- a/src/systemtask/Messages.h +++ b/src/systemtask/Messages.h @@ -6,7 +6,6 @@ namespace Pinetime { enum class Messages : uint8_t { GoToSleep, GoToRunning, - TouchWakeUp, OnNewTime, OnNewNotification, OnNewCall, diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 1bfae4c6..ed0fd744 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -198,20 +198,6 @@ void SystemTask::Work() { case Messages::GoToRunning: GoToRunning(); break; - case Messages::TouchWakeUp: { - if (touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) { - auto gesture = touchHandler.GestureGet(); - if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep && - gesture != Pinetime::Applications::TouchEvents::None && - ((gesture == Pinetime::Applications::TouchEvents::DoubleTap && - settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) || - (gesture == Pinetime::Applications::TouchEvents::Tap && - settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) { - GoToRunning(); - } - } - break; - } case Messages::GoToSleep: GoToSleep(); break; @@ -260,8 +246,23 @@ void SystemTask::Work() { // TODO add intent of fs access icon or something break; case Messages::OnTouchEvent: - if (touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) { + // Finish immediately if no new events + if (!touchHandler.ProcessTouchInfo(touchPanel.GetTouchInfo())) { + break; + } + if (state == SystemTaskState::Running) { displayApp.PushMessage(Pinetime::Applications::Display::Messages::TouchEvent); + } else { + // If asleep, check for touch panel wake triggers + auto gesture = touchHandler.GestureGet(); + if (settingsController.GetNotificationStatus() != Controllers::Settings::Notification::Sleep && + gesture != Pinetime::Applications::TouchEvents::None && + ((gesture == Pinetime::Applications::TouchEvents::DoubleTap && + settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) || + (gesture == Pinetime::Applications::TouchEvents::Tap && + settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) { + GoToRunning(); + } } break; case Messages::HandleButtonEvent: { @@ -493,14 +494,7 @@ void SystemTask::HandleButtonAction(Controllers::ButtonActions action) { } void SystemTask::OnTouchEvent() { - if (state == SystemTaskState::Running) { - PushMessage(Messages::OnTouchEvent); - } else { - if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap) or - settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) { - PushMessage(Messages::TouchWakeUp); - } - } + PushMessage(Messages::OnTouchEvent); } void SystemTask::PushMessage(System::Messages msg) {