@@ -214,20 +214,26 @@ void SystemTask::Work() {
214
214
state = SystemTaskState::Running;
215
215
break ;
216
216
case Messages::TouchWakeUp: {
217
- if (touchHandler.ProcessTouchInfo (touchPanel.GetTouchInfo ())) {
217
+ Pinetime::Controllers::TouchHandler::TouchProcessReply reply;
218
+ reply = touchHandler.ProcessTouchInfo (touchPanel.GetTouchInfo (), settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::ButtonUnlocks));
219
+ if (reply == Pinetime::Controllers::TouchHandler::TouchProcessReply::TouchEvent) {
218
220
auto gesture = touchHandler.GestureGet ();
219
221
if (settingsController.GetNotificationStatus () != Controllers::Settings::Notification::Sleep &&
220
222
gesture != Pinetime::Applications::TouchEvents::None &&
221
223
((gesture == Pinetime::Applications::TouchEvents::DoubleTap &&
222
224
settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) ||
223
225
(gesture == Pinetime::Applications::TouchEvents::Tap &&
224
226
settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) {
227
+ touchHandler.SetIfButtonUnlocksIgnoreTouch (true );
228
+ touchHandler.SetWokenBy (Pinetime::Controllers::TouchHandler::WokenBy::WakeUpAction);
225
229
GoToRunning ();
226
230
}
227
231
}
228
232
break ;
229
233
}
230
234
case Messages::GoToSleep:
235
+ touchHandler.SetIgnoreTouchPopupHidden (true );
236
+ displayApp.PushMessage (Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
231
237
if (doNotGoToSleep) {
232
238
break ;
233
239
}
@@ -291,24 +297,42 @@ void SystemTask::Work() {
291
297
// TODO add intent of fs access icon or something
292
298
break ;
293
299
case Messages::OnTouchEvent:
294
- if (touchHandler.ProcessTouchInfo (touchPanel.GetTouchInfo ())) {
300
+ Pinetime::Controllers::TouchHandler::TouchProcessReply reply;
301
+ reply = touchHandler.ProcessTouchInfo (touchPanel.GetTouchInfo (), settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::ButtonUnlocks));
302
+ NRF_LOG_INFO (" [systemtask] OnTouchEvent, reply %d" , reply);
303
+
304
+ if (reply == Pinetime::Controllers::TouchHandler::TouchProcessReply::TouchEvent) {
295
305
displayApp.PushMessage (Pinetime::Applications::Display::Messages::TouchEvent);
306
+ } else if (reply == Pinetime::Controllers::TouchHandler::TouchProcessReply::IgnoreTouchPopup) {
307
+ displayApp.PushMessage (Pinetime::Applications::Display::Messages::ShowIgnoreTouchPopup);
308
+ touchHandler.SetIgnoreTouchPopupHidden (false );
296
309
}
297
310
break ;
298
311
case Messages::HandleButtonEvent: {
299
- Controllers::ButtonActions action = Controllers::ButtonActions::None;
300
- if (nrf_gpio_pin_read (Pinetime::PinMap::Button ) == 0 ) {
301
- action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Release);
302
- } else {
303
- action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Press);
304
- // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
305
- if (IsSleeping ()) {
306
- fastWakeUpDone = true ;
307
- GoToRunning ();
308
- break ;
312
+ // if the IgnoreTouchPopup is active the first button event unlocks the device
313
+ if (!touchHandler.IsIgnoreTouchPopupHidden ()) {
314
+ touchHandler.SetWokenBy (Pinetime::Controllers::TouchHandler::WokenBy::Button );
315
+ touchHandler.SetIfButtonUnlocksIgnoreTouch (false );
316
+ touchHandler.SetIgnoreTouchPopupHidden (true );
317
+ displayApp.PushMessage (Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
318
+ }
319
+ else {
320
+ Controllers::ButtonActions action = Controllers::ButtonActions::None;
321
+ if (nrf_gpio_pin_read (Pinetime::PinMap::Button ) == 0 ) {
322
+ action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Release);
323
+ } else {
324
+ action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Press);
325
+ touchHandler.SetWokenBy (Pinetime::Controllers::TouchHandler::WokenBy::Button );
326
+ touchHandler.SetIfButtonUnlocksIgnoreTouch (false );
327
+ // This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
328
+ if (IsSleeping ()) {
329
+ fastWakeUpDone = true ;
330
+ GoToRunning ();
331
+ break ;
332
+ }
309
333
}
334
+ HandleButtonAction (action);
310
335
}
311
- HandleButtonAction (action);
312
336
} break ;
313
337
case Messages::HandleButtonTimerEvent: {
314
338
auto action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Timer);
@@ -328,6 +352,8 @@ void SystemTask::Work() {
328
352
}
329
353
330
354
state = SystemTaskState::Sleeping;
355
+ touchHandler.SetWokenBy (Pinetime::Controllers::TouchHandler::WokenBy::Other);
356
+ touchHandler.SetIfButtonUnlocksIgnoreTouch (false );
331
357
break ;
332
358
case Messages::OnNewDay:
333
359
// We might be sleeping (with TWI device disabled.
@@ -433,6 +459,8 @@ void SystemTask::UpdateMotion() {
433
459
motionController.ShouldRaiseWake (state == SystemTaskState::Sleeping)) ||
434
460
(settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::Shake) &&
435
461
motionController.ShouldShakeWake (settingsController.GetShakeThreshold ()))) {
462
+ touchHandler.SetWokenBy (Pinetime::Controllers::TouchHandler::WokenBy::WakeUpAction);
463
+ touchHandler.SetIfButtonUnlocksIgnoreTouch (true );
436
464
GoToRunning ();
437
465
}
438
466
}
0 commit comments