From 8c18106bf185477de0a50509b8ad32de6d2ce445 Mon Sep 17 00:00:00 2001 From: JustScott Date: Sun, 14 Jan 2024 15:34:48 -0600 Subject: [PATCH 1/4] Add Timer's Time Remaining to Digitial Watchface Adds a live output of the timer's time remaining, along with an hourGlass symbol to the left. Both of these are placed above the current time and are the same color as the date as to not draw attention away from the current time. The icon and the time remaining are both set to hidden if the timer isn't running. --- src/displayapp/screens/WatchFaceDigital.cpp | 28 ++++++++++++++++++++- src/displayapp/screens/WatchFaceDigital.h | 10 ++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 2e00ee98..5d182b46 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -22,7 +22,8 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, Controllers::MotionController& motionController, - Controllers::SimpleWeatherService& weatherService) + Controllers::SimpleWeatherService& weatherService, + Controllers::Timer& timer) : currentDateTime {{}}, dateTimeController {dateTimeController}, notificationManager {notificationManager}, @@ -30,6 +31,7 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, heartRateController {heartRateController}, motionController {motionController}, weatherService {weatherService}, + timer {timer}, statusIcons(batteryController, bleController) { statusIcons.Create(); @@ -51,6 +53,16 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, lv_label_set_text(temperature, ""); lv_obj_align(temperature, nullptr, LV_ALIGN_IN_TOP_MID, 20, 50); + timerIcon = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(timerIcon, Symbols::hourGlass); + lv_obj_set_style_local_text_color(timerIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_align(timerIcon, lv_scr_act(), LV_ALIGN_IN_TOP_MID, -32, 60); + + timeRemaining = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(timeRemaining, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_label_set_text(timeRemaining, "00:00"); + lv_obj_align(timeRemaining, nullptr, LV_ALIGN_IN_TOP_MID, 10, 60); + label_date = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60); lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); @@ -101,6 +113,20 @@ void WatchFaceDigital::Refresh() { lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); } + if (timer.IsRunning()) { + auto secondsRemaining = std::chrono::duration_cast(timer.GetTimeRemaining()); + + int minutes = secondsRemaining.count() / 60; + int seconds = secondsRemaining.count() % 60; + lv_label_set_text_fmt(timeRemaining, "%02d:%02d", minutes, seconds); + + lv_obj_set_hidden(timeRemaining, false); + lv_obj_set_hidden(timerIcon, false); + } else { + lv_obj_set_hidden(timeRemaining, true); + lv_obj_set_hidden(timerIcon, true); + } + currentDateTime = std::chrono::time_point_cast(dateTimeController.CurrentDateTime()); if (currentDateTime.IsUpdated()) { diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 78232c1e..11bf8350 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -20,6 +20,7 @@ namespace Pinetime { class NotificationManager; class HeartRateController; class MotionController; + class Timer; } namespace Applications { @@ -34,7 +35,8 @@ namespace Pinetime { Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, Controllers::MotionController& motionController, - Controllers::SimpleWeatherService& weather); + Controllers::SimpleWeatherService& weather, + Controllers::Timer& timer); ~WatchFaceDigital() override; void Refresh() override; @@ -56,6 +58,8 @@ namespace Pinetime { Utility::DirtyValue> currentDate; + lv_obj_t* timerIcon; + lv_obj_t* timeRemaining; lv_obj_t* label_time; lv_obj_t* label_time_ampm; lv_obj_t* label_date; @@ -73,6 +77,7 @@ namespace Pinetime { Controllers::HeartRateController& heartRateController; Controllers::MotionController& motionController; Controllers::SimpleWeatherService& weatherService; + Controllers::Timer& timer; lv_task_t* taskRefresh; Widgets::StatusIcons statusIcons; @@ -92,7 +97,8 @@ namespace Pinetime { controllers.settingsController, controllers.heartRateController, controllers.motionController, - *controllers.weatherController); + *controllers.weatherController, + controllers.timer); }; static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { From c936a8086333f98ebaae4a476fd767ffcf946ca9 Mon Sep 17 00:00:00 2001 From: JustScott Date: Sun, 14 Jan 2024 17:44:56 -0600 Subject: [PATCH 2/4] Use type uint8_t intead of type int for the timer's minute and second values --- src/displayapp/screens/WatchFaceDigital.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 5d182b46..cbe3e0f0 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -116,8 +116,8 @@ void WatchFaceDigital::Refresh() { if (timer.IsRunning()) { auto secondsRemaining = std::chrono::duration_cast(timer.GetTimeRemaining()); - int minutes = secondsRemaining.count() / 60; - int seconds = secondsRemaining.count() % 60; + uint8_t minutes = secondsRemaining.count() / 60; + uint8_t seconds = secondsRemaining.count() % 60; lv_label_set_text_fmt(timeRemaining, "%02d:%02d", minutes, seconds); lv_obj_set_hidden(timeRemaining, false); From 66930a55f54ea757971adad8ba9c794436ae9c5c Mon Sep 17 00:00:00 2001 From: JustScott Date: Thu, 1 Feb 2024 12:16:59 -0600 Subject: [PATCH 3/4] Move the time remaining widget to StatusIcons --- src/displayapp/DisplayApp.cpp | 4 ++- src/displayapp/screens/ApplicationList.cpp | 5 +++- src/displayapp/screens/ApplicationList.h | 2 ++ src/displayapp/screens/Tile.cpp | 7 +++-- src/displayapp/screens/Tile.h | 3 +- src/displayapp/screens/WatchFaceDigital.cpp | 26 +---------------- src/displayapp/screens/WatchFaceDigital.h | 2 -- .../screens/settings/QuickSettings.cpp | 7 +++-- .../screens/settings/QuickSettings.h | 3 +- src/displayapp/widgets/StatusIcons.cpp | 29 +++++++++++++++++-- src/displayapp/widgets/StatusIcons.h | 5 +++- 11 files changed, 53 insertions(+), 40 deletions(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 9c7d87b2..f1642899 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -433,6 +433,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio batteryController, bleController, dateTimeController, + timer, filesystem, std::move(apps)); } break; @@ -486,7 +487,8 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio brightnessController, motorController, settingsController, - bleController); + bleController, + timer); break; case Apps::Settings: currentScreen = std::make_unique(this, settingsController); diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index 41735349..74f18498 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -22,6 +22,7 @@ ApplicationList::ApplicationList(DisplayApp* app, const Pinetime::Controllers::Battery& batteryController, const Pinetime::Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, + Controllers::Timer& timer, Pinetime::Controllers::FS& filesystem, std::array&& apps) : app {app}, @@ -29,6 +30,7 @@ ApplicationList::ApplicationList(DisplayApp* app, batteryController {batteryController}, bleController {bleController}, dateTimeController {dateTimeController}, + timer {timer}, filesystem {filesystem}, apps {std::move(apps)}, screens {app, settingsController.GetAppMenu(), CreateScreenList(), Screens::ScreenListModes::UpDown} { @@ -60,5 +62,6 @@ std::unique_ptr ApplicationList::CreateScreen(unsigned int screenNum) co batteryController, bleController, dateTimeController, - pageApps); + pageApps, + timer); } diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index 41a413af..c9635485 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -19,6 +19,7 @@ namespace Pinetime { const Pinetime::Controllers::Battery& batteryController, const Pinetime::Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, + Pinetime::Controllers::Timer& timer, Pinetime::Controllers::FS& filesystem, std::array&& apps); ~ApplicationList() override; @@ -33,6 +34,7 @@ namespace Pinetime { const Pinetime::Controllers::Battery& batteryController; const Pinetime::Controllers::Ble& bleController; Controllers::DateTime& dateTimeController; + Pinetime::Controllers::Timer& timer; Pinetime::Controllers::FS& filesystem; std::array apps; diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 7c392c59..d98f2de4 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -30,8 +30,9 @@ Tile::Tile(uint8_t screenID, const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, - std::array& applications) - : app {app}, dateTimeController {dateTimeController}, pageIndicator(screenID, numScreens), statusIcons(batteryController, bleController) { + std::array& applications, + Controllers::Timer& timer) + : app {app}, dateTimeController {dateTimeController}, pageIndicator(screenID, numScreens), statusIcons(batteryController, bleController, timer) { settingsController.SetAppMenu(screenID); @@ -83,7 +84,7 @@ Tile::Tile(uint8_t screenID, btnm1->user_data = this; lv_obj_set_event_cb(btnm1, event_handler); - taskUpdate = lv_task_create(lv_update_task, 5000, LV_TASK_PRIO_MID, this); + taskUpdate = lv_task_create(lv_update_task, 500, LV_TASK_PRIO_MID, this); UpdateScreen(); } diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h index f1b86246..0bea237c 100644 --- a/src/displayapp/screens/Tile.h +++ b/src/displayapp/screens/Tile.h @@ -29,7 +29,8 @@ namespace Pinetime { const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, - std::array& applications); + std::array& applications, + Controllers::Timer& timer); ~Tile() override; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index cbe3e0f0..5431b715 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -32,7 +32,7 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, motionController {motionController}, weatherService {weatherService}, timer {timer}, - statusIcons(batteryController, bleController) { + statusIcons(batteryController, bleController, timer) { statusIcons.Create(); @@ -53,16 +53,6 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, lv_label_set_text(temperature, ""); lv_obj_align(temperature, nullptr, LV_ALIGN_IN_TOP_MID, 20, 50); - timerIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(timerIcon, Symbols::hourGlass); - lv_obj_set_style_local_text_color(timerIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); - lv_obj_align(timerIcon, lv_scr_act(), LV_ALIGN_IN_TOP_MID, -32, 60); - - timeRemaining = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(timeRemaining, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); - lv_label_set_text(timeRemaining, "00:00"); - lv_obj_align(timeRemaining, nullptr, LV_ALIGN_IN_TOP_MID, 10, 60); - label_date = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60); lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); @@ -113,20 +103,6 @@ void WatchFaceDigital::Refresh() { lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); } - if (timer.IsRunning()) { - auto secondsRemaining = std::chrono::duration_cast(timer.GetTimeRemaining()); - - uint8_t minutes = secondsRemaining.count() / 60; - uint8_t seconds = secondsRemaining.count() % 60; - lv_label_set_text_fmt(timeRemaining, "%02d:%02d", minutes, seconds); - - lv_obj_set_hidden(timeRemaining, false); - lv_obj_set_hidden(timerIcon, false); - } else { - lv_obj_set_hidden(timeRemaining, true); - lv_obj_set_hidden(timerIcon, true); - } - currentDateTime = std::chrono::time_point_cast(dateTimeController.CurrentDateTime()); if (currentDateTime.IsUpdated()) { diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 11bf8350..bdfb31dd 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -58,8 +58,6 @@ namespace Pinetime { Utility::DirtyValue> currentDate; - lv_obj_t* timerIcon; - lv_obj_t* timeRemaining; lv_obj_t* label_time; lv_obj_t* label_time_ampm; lv_obj_t* label_date; diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index 05484888..614c19c2 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -33,13 +33,14 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, Controllers::BrightnessController& brightness, Controllers::MotorController& motorController, Pinetime::Controllers::Settings& settingsController, - const Controllers::Ble& bleController) + const Controllers::Ble& bleController, + Controllers::Timer& timer) : app {app}, dateTimeController {dateTimeController}, brightness {brightness}, motorController {motorController}, settingsController {settingsController}, - statusIcons(batteryController, bleController) { + statusIcons(batteryController, bleController, timer) { statusIcons.Create(); @@ -118,7 +119,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); lv_label_set_text_static(lbl_btn, Symbols::settings); - taskUpdate = lv_task_create(lv_update_task, 5000, LV_TASK_PRIO_MID, this); + taskUpdate = lv_task_create(lv_update_task, 500, LV_TASK_PRIO_MID, this); UpdateScreen(); } diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h index 55da6176..c3e3e80f 100644 --- a/src/displayapp/screens/settings/QuickSettings.h +++ b/src/displayapp/screens/settings/QuickSettings.h @@ -23,7 +23,8 @@ namespace Pinetime { Controllers::BrightnessController& brightness, Controllers::MotorController& motorController, Pinetime::Controllers::Settings& settingsController, - const Controllers::Ble& bleController); + const Controllers::Ble& bleController, + Controllers::Timer& timer); ~QuickSettings() override; diff --git a/src/displayapp/widgets/StatusIcons.cpp b/src/displayapp/widgets/StatusIcons.cpp index 423b53d9..f53b596f 100644 --- a/src/displayapp/widgets/StatusIcons.cpp +++ b/src/displayapp/widgets/StatusIcons.cpp @@ -3,11 +3,22 @@ using namespace Pinetime::Applications::Widgets; -StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController) - : batteryIcon(true), batteryController {batteryController}, bleController {bleController} { +StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::Timer& timer) + : batteryIcon(true), batteryController {batteryController}, bleController {bleController}, timer {timer} { } void StatusIcons::Create() { + timerIcon = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(timerIcon, Screens::Symbols::hourGlass); + lv_obj_set_style_local_text_color(timerIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_align(timerIcon, lv_scr_act(), LV_ALIGN_IN_TOP_MID, -32, 0); + + timeRemaining = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(timeRemaining, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_label_set_text(timeRemaining, "00:00"); + lv_obj_align(timeRemaining, nullptr, LV_ALIGN_IN_TOP_MID, 10, 0); + + container = lv_cont_create(lv_scr_act(), nullptr); lv_cont_set_layout(container, LV_LAYOUT_ROW_TOP); lv_cont_set_fit(container, LV_FIT_TIGHT); @@ -26,6 +37,20 @@ void StatusIcons::Create() { } void StatusIcons::Update() { + if (timer.IsRunning()) { + auto secondsRemaining = std::chrono::duration_cast(timer.GetTimeRemaining()); + + uint8_t minutes = secondsRemaining.count() / 60; + uint8_t seconds = secondsRemaining.count() % 60; + lv_label_set_text_fmt(timeRemaining, "%02d:%02d", minutes, seconds); + + lv_obj_set_hidden(timeRemaining, false); + lv_obj_set_hidden(timerIcon, false); + } else { + lv_obj_set_hidden(timeRemaining, true); + lv_obj_set_hidden(timerIcon, true); + } + powerPresent = batteryController.IsPowerPresent(); if (powerPresent.IsUpdated()) { lv_obj_set_hidden(batteryPlug, !powerPresent.Get()); diff --git a/src/displayapp/widgets/StatusIcons.h b/src/displayapp/widgets/StatusIcons.h index 9e21d3ad..a5d5083d 100644 --- a/src/displayapp/widgets/StatusIcons.h +++ b/src/displayapp/widgets/StatusIcons.h @@ -13,7 +13,7 @@ namespace Pinetime { namespace Widgets { class StatusIcons { public: - StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController); + StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::Timer& timer); void Align(); void Create(); @@ -27,12 +27,15 @@ namespace Pinetime { Screens::BatteryIcon batteryIcon; const Pinetime::Controllers::Battery& batteryController; const Controllers::Ble& bleController; + Controllers::Timer& timer; Utility::DirtyValue batteryPercentRemaining {}; Utility::DirtyValue powerPresent {}; Utility::DirtyValue bleState {}; Utility::DirtyValue bleRadioEnabled {}; + lv_obj_t* timerIcon; + lv_obj_t* timeRemaining; lv_obj_t* bleIcon; lv_obj_t* batteryPlug; lv_obj_t* container; From 3fa9dbbac775d9b10f4472766b2d3197ca489b69 Mon Sep 17 00:00:00 2001 From: JustScott Date: Tue, 20 Feb 2024 16:05:31 -0600 Subject: [PATCH 4/4] Pass the timer as const Doing this matches the other Controllers, which are also passed as const to the StatusIcons. --- src/components/timer/Timer.cpp | 4 ++-- src/components/timer/Timer.h | 4 ++-- src/displayapp/screens/WatchFaceDigital.cpp | 5 ++--- src/displayapp/screens/WatchFaceDigital.h | 9 ++++----- src/displayapp/screens/settings/QuickSettings.cpp | 2 +- src/displayapp/screens/settings/QuickSettings.h | 2 +- src/displayapp/widgets/StatusIcons.cpp | 2 +- src/displayapp/widgets/StatusIcons.h | 4 ++-- 8 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/components/timer/Timer.cpp b/src/components/timer/Timer.cpp index 279178cd..935d41e2 100644 --- a/src/components/timer/Timer.cpp +++ b/src/components/timer/Timer.cpp @@ -11,7 +11,7 @@ void Timer::StartTimer(std::chrono::milliseconds duration) { xTimerStart(timer, 0); } -std::chrono::milliseconds Timer::GetTimeRemaining() { +std::chrono::milliseconds Timer::GetTimeRemaining() const { if (IsRunning()) { TickType_t remainingTime = xTimerGetExpiryTime(timer) - xTaskGetTickCount(); return std::chrono::milliseconds(remainingTime * 1000 / configTICK_RATE_HZ); @@ -23,6 +23,6 @@ void Timer::StopTimer() { xTimerStop(timer, 0); } -bool Timer::IsRunning() { +bool Timer::IsRunning() const { return (xTimerIsTimerActive(timer) == pdTRUE); } diff --git a/src/components/timer/Timer.h b/src/components/timer/Timer.h index 2469666f..406ae033 100644 --- a/src/components/timer/Timer.h +++ b/src/components/timer/Timer.h @@ -15,9 +15,9 @@ namespace Pinetime { void StopTimer(); - std::chrono::milliseconds GetTimeRemaining(); + std::chrono::milliseconds GetTimeRemaining() const; - bool IsRunning(); + bool IsRunning() const; private: TimerHandle_t timer; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 5431b715..54bde948 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -18,12 +18,12 @@ using namespace Pinetime::Applications::Screens; WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, const Controllers::Battery& batteryController, const Controllers::Ble& bleController, + const Controllers::Timer& timer, Controllers::NotificationManager& notificationManager, Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, Controllers::MotionController& motionController, - Controllers::SimpleWeatherService& weatherService, - Controllers::Timer& timer) + Controllers::SimpleWeatherService& weatherService) : currentDateTime {{}}, dateTimeController {dateTimeController}, notificationManager {notificationManager}, @@ -31,7 +31,6 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, heartRateController {heartRateController}, motionController {motionController}, weatherService {weatherService}, - timer {timer}, statusIcons(batteryController, bleController, timer) { statusIcons.Create(); diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index bdfb31dd..da50308b 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -31,12 +31,12 @@ namespace Pinetime { WatchFaceDigital(Controllers::DateTime& dateTimeController, const Controllers::Battery& batteryController, const Controllers::Ble& bleController, + const Controllers::Timer& timer, Controllers::NotificationManager& notificationManager, Controllers::Settings& settingsController, Controllers::HeartRateController& heartRateController, Controllers::MotionController& motionController, - Controllers::SimpleWeatherService& weather, - Controllers::Timer& timer); + Controllers::SimpleWeatherService& weather); ~WatchFaceDigital() override; void Refresh() override; @@ -75,7 +75,6 @@ namespace Pinetime { Controllers::HeartRateController& heartRateController; Controllers::MotionController& motionController; Controllers::SimpleWeatherService& weatherService; - Controllers::Timer& timer; lv_task_t* taskRefresh; Widgets::StatusIcons statusIcons; @@ -91,12 +90,12 @@ namespace Pinetime { return new Screens::WatchFaceDigital(controllers.dateTimeController, controllers.batteryController, controllers.bleController, + controllers.timer, controllers.notificationManager, controllers.settingsController, controllers.heartRateController, controllers.motionController, - *controllers.weatherController, - controllers.timer); + *controllers.weatherController); }; static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index 614c19c2..3f1615df 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -34,7 +34,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, Controllers::MotorController& motorController, Pinetime::Controllers::Settings& settingsController, const Controllers::Ble& bleController, - Controllers::Timer& timer) + const Controllers::Timer& timer) : app {app}, dateTimeController {dateTimeController}, brightness {brightness}, diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h index c3e3e80f..297c41e8 100644 --- a/src/displayapp/screens/settings/QuickSettings.h +++ b/src/displayapp/screens/settings/QuickSettings.h @@ -24,7 +24,7 @@ namespace Pinetime { Controllers::MotorController& motorController, Pinetime::Controllers::Settings& settingsController, const Controllers::Ble& bleController, - Controllers::Timer& timer); + const Controllers::Timer& timer); ~QuickSettings() override; diff --git a/src/displayapp/widgets/StatusIcons.cpp b/src/displayapp/widgets/StatusIcons.cpp index f53b596f..18b3fa59 100644 --- a/src/displayapp/widgets/StatusIcons.cpp +++ b/src/displayapp/widgets/StatusIcons.cpp @@ -3,7 +3,7 @@ using namespace Pinetime::Applications::Widgets; -StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::Timer& timer) +StatusIcons::StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, const Controllers::Timer& timer) : batteryIcon(true), batteryController {batteryController}, bleController {bleController}, timer {timer} { } diff --git a/src/displayapp/widgets/StatusIcons.h b/src/displayapp/widgets/StatusIcons.h index a5d5083d..39189a07 100644 --- a/src/displayapp/widgets/StatusIcons.h +++ b/src/displayapp/widgets/StatusIcons.h @@ -13,7 +13,7 @@ namespace Pinetime { namespace Widgets { class StatusIcons { public: - StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::Timer& timer); + StatusIcons(const Controllers::Battery& batteryController, const Controllers::Ble& bleController, const Controllers::Timer& timer); void Align(); void Create(); @@ -27,7 +27,7 @@ namespace Pinetime { Screens::BatteryIcon batteryIcon; const Pinetime::Controllers::Battery& batteryController; const Controllers::Ble& bleController; - Controllers::Timer& timer; + const Controllers::Timer& timer; Utility::DirtyValue batteryPercentRemaining {}; Utility::DirtyValue powerPresent {};