@@ -106,11 +106,18 @@ void Timer::UpdateMask() {
106
106
}
107
107
108
108
void Timer::Refresh () {
109
- if (motorController.IsRinging ()) {
110
- SetTimerRinging ();
109
+ if (isRinging) {
111
110
auto secondsElapsed = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining ());
112
111
minuteCounter.SetValue (secondsElapsed.count () / 60 );
113
112
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
+ }
114
121
} else if (timer.IsRunning ()) {
115
122
auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining ());
116
123
minuteCounter.SetValue (secondsRemaining.count () / 60 );
@@ -135,13 +142,15 @@ void Timer::SetTimerRunning() {
135
142
}
136
143
137
144
void Timer::SetTimerStopped () {
145
+ isRinging = false ;
138
146
minuteCounter.ShowControls ();
139
147
secondCounter.ShowControls ();
140
148
lv_label_set_text_static (txtPlayPause, " Start" );
141
149
lv_obj_set_style_local_bg_color (btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
142
150
}
143
151
144
152
void Timer::SetTimerRinging () {
153
+ isRinging = true ;
145
154
minuteCounter.HideControls ();
146
155
secondCounter.HideControls ();
147
156
lv_label_set_text_static (txtPlayPause, " Reset" );
@@ -152,7 +161,7 @@ void Timer::SetTimerRinging() {
152
161
}
153
162
154
163
void Timer::ToggleRunning () {
155
- if (motorController. IsRinging () ) {
164
+ if (isRinging ) {
156
165
motorController.StopRinging ();
157
166
Reset ();
158
167
} else if (timer.IsRunning ()) {
0 commit comments