@@ -106,11 +106,18 @@ void Timer::UpdateMask() {
106106}
107107
108108void Timer::Refresh () {
109- if (motorController.IsRinging ()) {
110- SetTimerRinging ();
109+ if (isRinging) {
111110 auto secondsElapsed = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining ());
112111 minuteCounter.SetValue (secondsElapsed.count () / 60 );
113112 secondCounter.SetValue (secondsElapsed.count () % 60 );
113+ // Stop buzzing after 10 seconds, but continue the counter
114+ if (motorController.IsRinging () && secondsElapsed.count () > 10 ) {
115+ motorController.StopRinging ();
116+ }
117+ // Reset timer after 1 minute
118+ if (secondsElapsed.count () > 60 ) {
119+ Reset ();
120+ }
114121 } else if (timer.IsRunning ()) {
115122 auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining ());
116123 minuteCounter.SetValue (secondsRemaining.count () / 60 );
@@ -135,13 +142,15 @@ void Timer::SetTimerRunning() {
135142}
136143
137144void Timer::SetTimerStopped () {
145+ isRinging = false ;
138146 minuteCounter.ShowControls ();
139147 secondCounter.ShowControls ();
140148 lv_label_set_text_static (txtPlayPause, " Start" );
141149 lv_obj_set_style_local_bg_color (btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
142150}
143151
144152void Timer::SetTimerRinging () {
153+ isRinging = true ;
145154 minuteCounter.HideControls ();
146155 secondCounter.HideControls ();
147156 lv_label_set_text_static (txtPlayPause, " Reset" );
@@ -152,7 +161,7 @@ void Timer::SetTimerRinging() {
152161}
153162
154163void Timer::ToggleRunning () {
155- if (motorController. IsRinging () ) {
164+ if (isRinging ) {
156165 motorController.StopRinging ();
157166 Reset ();
158167 } else if (timer.IsRunning ()) {
0 commit comments