From 54f20ff4cb439f9997adb0e295caeb3130bfaecc Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Mon, 8 Jan 2024 10:02:45 -0500 Subject: timer: Add ringing and counter The timer app issues a short buzz once and then disappears. There is no trace left that the timer finished or how long ago. This change makes the motor start ringing and presents a timer counter. The timer stops buzzing after 10 seconds, and finally resets after 1 minute. --- src/displayapp/DisplayApp.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/displayapp/DisplayApp.cpp') diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 45a41032..85e0ad56 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -368,19 +368,21 @@ void DisplayApp::Refresh() { case Messages::NewNotification: LoadNewScreen(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down); break; - case Messages::TimerDone: + case Messages::TimerDone: { if (state != States::Running) { PushMessageToSystemTask(System::Messages::GoToRunning); } - if (currentApp == Apps::Timer) { - lv_disp_trig_activity(nullptr); - auto* timer = static_cast(currentScreen.get()); - timer->Reset(); - } else { + // Load timer app if not loaded + if (currentApp != Apps::Timer) { LoadNewScreen(Apps::Timer, DisplayApp::FullRefreshDirections::Up); } - motorController.RunForDuration(35); + // Set the timer to ringing mode + lv_disp_trig_activity(nullptr); + auto* timerScreen = static_cast(currentScreen.get()); + timerScreen->SetTimerRinging(); + motorController.StartRinging(); break; + } case Messages::AlarmTriggered: if (currentApp == Apps::Alarm) { auto* alarm = static_cast(currentScreen.get()); -- cgit v1.2.3-70-g09d2