@@ -17,8 +17,8 @@ static void btnEventHandler(lv_obj_t* obj, lv_event_t event) {
17
17
}
18
18
}
19
19
20
- Timer::Timer (Controllers::Timer& timerController, Controllers::MotorController& motorController)
21
- : timer {timerController}, motorController {motorController} {
20
+ Timer::Timer (Controllers::Timer& timerController, Controllers::MotorController& motorController, System::SystemTask& systemTask )
21
+ : timer {timerController}, motorController {motorController}, wakeLock(systemTask) {
22
22
23
23
lv_obj_t * colonLabel = lv_label_create (lv_scr_act (), nullptr );
24
24
lv_obj_set_style_local_text_font (colonLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
@@ -108,9 +108,15 @@ void Timer::UpdateMask() {
108
108
void Timer::Refresh () {
109
109
if (isRinging) {
110
110
DisplayTime ();
111
- // Stop buzzing after 10 seconds, but continue the counter
112
- if (motorController.IsRinging () && displaySeconds.Get ().count () > 10 ) {
113
- motorController.StopRinging ();
111
+ if (motorController.IsRinging ()) {
112
+ // Stop buzzing after 10 seconds, but continue the counter
113
+ if (displaySeconds.Get ().count () > 10 ) {
114
+ motorController.StopRinging ();
115
+ wakeLock.Release ();
116
+ // Keep the screen awake during the first 10 seconds
117
+ } else {
118
+ wakeLock.Lock ();
119
+ }
114
120
}
115
121
// Reset timer after 1 minute
116
122
if (displaySeconds.Get ().count () > 60 ) {
0 commit comments