@@ -17,7 +17,7 @@ static void btnEventHandler(lv_obj_t* obj, lv_event_t event) {
1717 }
1818}
1919
20- Timer::Timer (Controllers::TimerController & timerController) : timerController {timerController} {
20+ Timer::Timer (Controllers::Timer & timerController) : timer {timerController} {
2121
2222 lv_obj_t * colonLabel = lv_label_create (lv_scr_act (), nullptr );
2323 lv_obj_set_style_local_text_font (colonLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
@@ -85,7 +85,7 @@ void Timer::MaskReset() {
8585 buttonPressing = false ;
8686 // A click event is processed before a release event,
8787 // so the release event would override the "Pause" text without this check
88- if (!timerController .IsRunning ()) {
88+ if (!timer .IsRunning ()) {
8989 lv_label_set_text_static (txtPlayPause, " Start" );
9090 }
9191 maskPosition = 0 ;
@@ -103,8 +103,8 @@ void Timer::UpdateMask() {
103103}
104104
105105void Timer::Refresh () {
106- if (timerController .IsRunning ()) {
107- auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timerController .GetTimeRemaining ());
106+ if (timer .IsRunning ()) {
107+ auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer .GetTimeRemaining ());
108108 minuteCounter.SetValue (secondsRemaining.count () / 60 );
109109 secondCounter.SetValue (secondsRemaining.count () % 60 );
110110 } else if (buttonPressing && xTaskGetTickCount () > pressTime + pdMS_TO_TICKS (150 )) {
@@ -132,15 +132,15 @@ void Timer::SetTimerStopped() {
132132}
133133
134134void Timer::ToggleRunning () {
135- if (timerController .IsRunning ()) {
136- auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timerController .GetTimeRemaining ());
135+ if (timer .IsRunning ()) {
136+ auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer .GetTimeRemaining ());
137137 minuteCounter.SetValue (secondsRemaining.count () / 60 );
138138 secondCounter.SetValue (secondsRemaining.count () % 60 );
139- timerController .StopTimer ();
139+ timer .StopTimer ();
140140 SetTimerStopped ();
141141 } else if (secondCounter.GetValue () + minuteCounter.GetValue () > 0 ) {
142142 auto timerDuration = std::chrono::minutes (minuteCounter.GetValue ()) + std::chrono::seconds (secondCounter.GetValue ());
143- timerController .StartTimer (timerDuration);
143+ timer .StartTimer (timerDuration);
144144 Refresh ();
145145 SetTimerRunning ();
146146 }
0 commit comments