diff options
Diffstat (limited to 'src/displayapp')
| -rw-r--r-- | src/displayapp/DisplayApp.cpp | 4 | ||||
| -rw-r--r-- | src/displayapp/DisplayApp.h | 4 | ||||
| -rw-r--r-- | src/displayapp/screens/Timer.cpp | 16 | ||||
| -rw-r--r-- | src/displayapp/screens/Timer.h | 6 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 80b6e201..fe2ee213 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -95,7 +95,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, touchHandler {touchHandler}, filesystem {filesystem}, lvgl {lcd, filesystem}, - timerController(this, TimerCallback) { + timer(this, TimerCallback) { } void DisplayApp::Start(System::BootErrors error) { @@ -452,7 +452,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio Screens::Notifications::Modes::Preview); break; case Apps::Timer: - currentScreen = std::make_unique<Screens::Timer>(timerController); + currentScreen = std::make_unique<Screens::Timer>(timer); break; case Apps::Alarm: currentScreen = std::make_unique<Screens::Alarm>(alarmController, settingsController.GetClockType(), *systemTask, motorController); diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index bd004d6e..f537651d 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -12,7 +12,7 @@ #include "components/firmwarevalidator/FirmwareValidator.h" #include "components/settings/Settings.h" #include "displayapp/screens/Screen.h" -#include "components/timer/TimerController.h" +#include "components/timer/Timer.h" #include "components/alarm/AlarmController.h" #include "touchhandler/TouchHandler.h" @@ -94,7 +94,7 @@ namespace Pinetime { Pinetime::Controllers::FirmwareValidator validator; Pinetime::Components::LittleVgl lvgl; - Pinetime::Controllers::TimerController timerController; + Pinetime::Controllers::Timer timer; TaskHandle_t taskHandle; diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index df78a5a0..d9488740 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -17,7 +17,7 @@ static void btnEventHandler(lv_obj_t* obj, lv_event_t event) { } } -Timer::Timer(Controllers::TimerController& timerController) : timerController {timerController} { +Timer::Timer(Controllers::Timer& timerController) : timer {timerController} { lv_obj_t* colonLabel = lv_label_create(lv_scr_act(), nullptr); 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() { buttonPressing = false; // A click event is processed before a release event, // so the release event would override the "Pause" text without this check - if (!timerController.IsRunning()) { + if (!timer.IsRunning()) { lv_label_set_text_static(txtPlayPause, "Start"); } maskPosition = 0; @@ -103,8 +103,8 @@ void Timer::UpdateMask() { } void Timer::Refresh() { - if (timerController.IsRunning()) { - auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timerController.GetTimeRemaining()); + if (timer.IsRunning()) { + auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining()); minuteCounter.SetValue(secondsRemaining.count() / 60); secondCounter.SetValue(secondsRemaining.count() % 60); } else if (buttonPressing && xTaskGetTickCount() > pressTime + pdMS_TO_TICKS(150)) { @@ -132,15 +132,15 @@ void Timer::SetTimerStopped() { } void Timer::ToggleRunning() { - if (timerController.IsRunning()) { - auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timerController.GetTimeRemaining()); + if (timer.IsRunning()) { + auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining()); minuteCounter.SetValue(secondsRemaining.count() / 60); secondCounter.SetValue(secondsRemaining.count() % 60); - timerController.StopTimer(); + timer.StopTimer(); SetTimerStopped(); } else if (secondCounter.GetValue() + minuteCounter.GetValue() > 0) { auto timerDuration = std::chrono::minutes(minuteCounter.GetValue()) + std::chrono::seconds(secondCounter.GetValue()); - timerController.StartTimer(timerDuration); + timer.StartTimer(timerDuration); Refresh(); SetTimerRunning(); } diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index a6e26063..e452a9d9 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -7,12 +7,12 @@ #include "displayapp/widgets/Counter.h" #include <lvgl/lvgl.h> -#include "components/timer/TimerController.h" +#include "components/timer/Timer.h" namespace Pinetime::Applications::Screens { class Timer : public Screen { public: - Timer(Controllers::TimerController& timerController); + Timer(Controllers::Timer& timerController); ~Timer() override; void Refresh() override; void Reset(); @@ -24,7 +24,7 @@ namespace Pinetime::Applications::Screens { void SetTimerRunning(); void SetTimerStopped(); void UpdateMask(); - Controllers::TimerController& timerController; + Controllers::Timer& timer; lv_obj_t* btnPlayPause; lv_obj_t* txtPlayPause; |
