From d2989ae23ab9d2ddfb41c1b590129c50c7606260 Mon Sep 17 00:00:00 2001 From: zyphlar Date: Fri, 5 Jan 2024 02:15:42 -0800 Subject: [PATCH] Move Fuzzy into Digital, restore Paint --- src/CMakeLists.txt | 5 +- src/components/settings/Settings.h | 2 +- src/displayapp/DisplayApp.cpp | 2 +- src/displayapp/UserApps.h | 1 - src/displayapp/apps/Apps.h.in | 6 +- src/displayapp/screens/InfiniPaint.cpp | 72 ++++ src/displayapp/screens/InfiniPaint.h | 52 +++ src/displayapp/screens/WatchFaceDigital.cpp | 57 +++- src/displayapp/screens/WatchFaceDigital.h | 3 + src/displayapp/screens/WatchFaceFuzzy.cpp | 312 ------------------ src/displayapp/screens/WatchFaceFuzzy.h | 99 ------ .../screens/settings/SettingTimeFormat.cpp | 3 +- 12 files changed, 191 insertions(+), 423 deletions(-) create mode 100644 src/displayapp/screens/InfiniPaint.cpp create mode 100644 src/displayapp/screens/InfiniPaint.h delete mode 100644 src/displayapp/screens/WatchFaceFuzzy.cpp delete mode 100644 src/displayapp/screens/WatchFaceFuzzy.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 134c95e4..94b835ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -366,7 +366,7 @@ list(APPEND SOURCE_FILES displayapp/DisplayApp.cpp displayapp/screens/Screen.cpp displayapp/screens/Tile.cpp - #displayapp/screens/InfiniPaint.cpp + displayapp/screens/InfiniPaint.cpp displayapp/screens/Paddle.cpp displayapp/screens/StopWatch.cpp displayapp/screens/BatteryIcon.cpp @@ -423,7 +423,6 @@ list(APPEND SOURCE_FILES #displayapp/screens/WatchFaceTerminal.cpp displayapp/screens/WatchFacePineTimeStyle.cpp #displayapp/screens/WatchFaceCasioStyleG7710.cpp - displayapp/screens/WatchFaceFuzzy.cpp ## @@ -590,7 +589,7 @@ set(INCLUDE_FILES displayapp/TouchEvents.h displayapp/screens/Screen.h displayapp/screens/Tile.h - #displayapp/screens/InfiniPaint.h + displayapp/screens/InfiniPaint.h displayapp/screens/StopWatch.h displayapp/screens/Paddle.h displayapp/screens/BatteryIcon.h diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 06312077..60ab0249 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -9,7 +9,7 @@ namespace Pinetime { namespace Controllers { class Settings { public: - enum class ClockType : uint8_t { H24, H12 }; + enum class ClockType : uint8_t { H24, H12, Fuzzy }; enum class WeatherFormat : uint8_t { Metric, Imperial }; enum class Notification : uint8_t { On, Off, Sleep }; enum class ChimesOption : uint8_t { None, Hours, HalfHours }; diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 03f05814..2792009f 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -13,7 +13,7 @@ #include "displayapp/screens/ApplicationList.h" #include "displayapp/screens/FirmwareUpdate.h" #include "displayapp/screens/FirmwareValidation.h" -//#include "displayapp/screens/InfiniPaint.h" +#include "displayapp/screens/InfiniPaint.h" #include "displayapp/screens/Paddle.h" #include "displayapp/screens/StopWatch.h" #include "displayapp/screens/Metronome.h" diff --git a/src/displayapp/UserApps.h b/src/displayapp/UserApps.h index f642178c..0d3e55fb 100644 --- a/src/displayapp/UserApps.h +++ b/src/displayapp/UserApps.h @@ -13,7 +13,6 @@ #include "displayapp/screens/WatchFaceInfineat.h" #include "displayapp/screens/WatchFacePineTimeStyle.h" //#include "displayapp/screens/WatchFaceTerminal.h" -#include "displayapp/screens/WatchFaceFuzzy.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/apps/Apps.h.in b/src/displayapp/apps/Apps.h.in index a90efdc3..4591b879 100644 --- a/src/displayapp/apps/Apps.h.in +++ b/src/displayapp/apps/Apps.h.in @@ -18,7 +18,7 @@ namespace Pinetime { FlashLight, BatteryInfo, Music, - //Paint, + Paint, Paddle, Twos, HeartRate, @@ -51,7 +51,6 @@ namespace Pinetime { Terminal, Infineat, CasioStyleG7710, - Fuzzy, }; template @@ -76,9 +75,8 @@ namespace Pinetime { WatchFace::Analog, WatchFace::PineTimeStyle, //WatchFace::Terminal, - WatchFace::Infineat, //WatchFace::CasioStyleG7710, - WatchFace::Fuzzy>; + WatchFace::Infineat>; static_assert(UserWatchFaceTypes::Count >= 1); } diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp new file mode 100644 index 00000000..1d6be979 --- /dev/null +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -0,0 +1,72 @@ +#include "displayapp/screens/InfiniPaint.h" +#include "displayapp/DisplayApp.h" +#include "displayapp/LittleVgl.h" +#include "displayapp/InfiniTimeTheme.h" + +#include // std::fill + +using namespace Pinetime::Applications::Screens; + +InfiniPaint::InfiniPaint(Pinetime::Components::LittleVgl& lvgl, Pinetime::Controllers::MotorController& motor) + : lvgl {lvgl}, motor {motor} { + std::fill(b, b + bufferSize, selectColor); +} + +InfiniPaint::~InfiniPaint() { + lv_obj_clean(lv_scr_act()); +} + +bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + switch (event) { + case Pinetime::Applications::TouchEvents::LongTap: + color = (color + 1) % 8; + switch (color) { + case 0: + selectColor = LV_COLOR_MAGENTA; + break; + case 1: + selectColor = Colors::green; + break; + case 2: + selectColor = LV_COLOR_WHITE; + break; + case 3: + selectColor = LV_COLOR_RED; + break; + case 4: + selectColor = LV_COLOR_CYAN; + break; + case 5: + selectColor = LV_COLOR_YELLOW; + break; + case 6: + selectColor = LV_COLOR_BLUE; + break; + case 7: + selectColor = LV_COLOR_BLACK; + break; + + default: + color = 0; + break; + } + + std::fill(b, b + bufferSize, selectColor); + motor.RunForDuration(35); + return true; + default: + return true; + } + return true; +} + +bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) { + lv_area_t area; + area.x1 = x - (width / 2); + area.y1 = y - (height / 2); + area.x2 = x + (width / 2) - 1; + area.y2 = y + (height / 2) - 1; + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None); + lvgl.FlushDisplay(&area, b); + return true; +} diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h new file mode 100644 index 00000000..b1f9741a --- /dev/null +++ b/src/displayapp/screens/InfiniPaint.h @@ -0,0 +1,52 @@ +#pragma once + +#include +#include +#include // std::fill +#include "displayapp/screens/Screen.h" +#include "components/motor/MotorController.h" +#include "Symbols.h" +#include "displayapp/apps/Apps.h" +#include + +namespace Pinetime { + namespace Components { + class LittleVgl; + } + + namespace Applications { + namespace Screens { + + class InfiniPaint : public Screen { + public: + InfiniPaint(Pinetime::Components::LittleVgl& lvgl, Controllers::MotorController& motor); + + ~InfiniPaint() override; + + bool OnTouchEvent(TouchEvents event) override; + + bool OnTouchEvent(uint16_t x, uint16_t y) override; + + private: + Pinetime::Components::LittleVgl& lvgl; + Controllers::MotorController& motor; + static constexpr uint16_t width = 10; + static constexpr uint16_t height = 10; + static constexpr uint16_t bufferSize = width * height; + lv_color_t b[bufferSize]; + lv_color_t selectColor = LV_COLOR_WHITE; + uint8_t color = 2; + }; + } + + template <> + struct AppTraits { + static constexpr Apps app = Apps::Paint; + static constexpr const char* icon = Screens::Symbols::paintbrush; + + static Screens::Screen* Create(AppControllers& controllers) { + return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController); + }; + }; + } +} diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index ca53691b..6a21e29c 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -91,7 +91,26 @@ void WatchFaceDigital::Refresh() { uint8_t hour = dateTimeController.Hours(); uint8_t minute = dateTimeController.Minutes(); - if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { + /* Begin difference from WatchFaceDigital*/ + if (settingsController.GetClockType() == Controllers::Settings::ClockType::Fuzzy) { + std::string hourStr, timeStr; + auto sector = minute / 5 + (minute % 5 > 2); + if (sector == 12) { + hour = (hour + 1) % 12; + sector = 0; + } + + timeStr = timeSectors[sector]; + if (timeStr.find("%1") != std::string::npos) { + hour = (hour + 1) % 12; + } + hourStr = std::string("#") + timeAccent + " " + hourNames[hour] + "#"; + timeStr.replace(timeStr.find("%"), 2, hourStr); + + lv_label_set_text(label_time, timeStr.c_str()); + lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); + /* End difference from WatchFaceDigital*/ + } else if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { char ampmChar[3] = "AM"; if (hour == 0) { hour = 12; @@ -154,3 +173,39 @@ void WatchFaceDigital::Refresh() { lv_obj_realign(stepIcon); } } + +/* Inspired by XFCE4-panel's fuzzy clock. + * + * https://salsa.debian.org/xfce-team/desktop/xfce4-panel/-/blob/debian/master/plugins/clock/clock-fuzzy.c + * + * Strings contain either a `%0` or a `%1`, indicating the position of + * the `hour` or `hour+1`, respectively. + */ +const char* WatchFaceDigital::timeSectors[] = { + "%0\no'clock", + "five past\n%0", + "ten past\n%0", + "quarter\npast\n%0", + "twenty\npast\n%0", + "twenty\nfive past\n%0", + "half past\n%0", + "twenty\nfive to\n%1", + "twenty\nto %1", + "quarter\nto %1", + "ten to\n%1", + "five to\n%1", +}; +const char* WatchFaceDigital::hourNames[] = { + "twelve", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "ten", + "eleven", +}; \ No newline at end of file diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index a4664792..dcf8ffd2 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -38,8 +38,11 @@ namespace Pinetime { void Refresh() override; private: + const char* timeAccent = "ffffff"; uint8_t displayedHour = -1; uint8_t displayedMinute = -1; + static const char* timeSectors[12]; + static const char* hourNames[12]; Utility::DirtyValue batteryPercentRemaining {}; Utility::DirtyValue powerPresent {}; diff --git a/src/displayapp/screens/WatchFaceFuzzy.cpp b/src/displayapp/screens/WatchFaceFuzzy.cpp deleted file mode 100644 index 8f379ccc..00000000 --- a/src/displayapp/screens/WatchFaceFuzzy.cpp +++ /dev/null @@ -1,312 +0,0 @@ -#include "displayapp/screens/WatchFaceFuzzy.h" - -#include -#include -#include "displayapp/screens/NotificationIcon.h" -#include "displayapp/screens/Symbols.h" -#include "components/battery/BatteryController.h" -#include "components/ble/BleController.h" -#include "components/ble/NotificationManager.h" -#include "components/heartrate/HeartRateController.h" -#include "components/motion/MotionController.h" -#include "components/settings/Settings.h" - -using namespace Pinetime::Applications::Screens; - -WatchFaceFuzzy::WatchFaceFuzzy(Controllers::DateTime& dateTimeController, - const Controllers::Battery& batteryController, - const Controllers::Ble& bleController, - Controllers::NotificationManager& notificationManager, - Controllers::Settings& settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController) - : currentDateTime {{}}, - dateTimeController {dateTimeController}, - notificationManager {notificationManager}, - settingsController {settingsController}, - heartRateController {heartRateController}, - motionController {motionController}, - statusIcons(batteryController, bleController) { - - statusIcons.Create(); - - notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME); - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); - lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); - - 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)); - - label_time = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed); - - lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0); - - label_time_ampm = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(label_time_ampm, ""); - lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55); - /* - heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(heartbeatIcon, Symbols::heartBeat); - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); - lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - - heartbeatValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); - lv_label_set_text_static(heartbeatValue, ""); - lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - - stepValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FFE7)); - lv_label_set_text_static(stepValue, "0"); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); - - stepIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FFE7)); - lv_label_set_text_static(stepIcon, Symbols::shoe); - lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); - */ - taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); - Refresh(); -} - -WatchFaceFuzzy::~WatchFaceFuzzy() { - lv_task_del(taskRefresh); - lv_obj_clean(lv_scr_act()); -} - -void WatchFaceFuzzy::Refresh() { - statusIcons.Update(); - - notificationState = notificationManager.AreNewNotificationsAvailable(); - if (notificationState.IsUpdated()) { - lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); - } - - currentDateTime = std::chrono::time_point_cast(dateTimeController.CurrentDateTime()); - - if (currentDateTime.IsUpdated()) { - uint8_t hour = dateTimeController.Hours(); - uint8_t minute = dateTimeController.Minutes(); - - /* Begin difference from WatchFaceDigital*/ - std::string hourStr, timeStr; - auto sector = minute / 5 + (minute % 5 > 2); - if (sector == 12) { - hour = (hour + 1) % 12; - sector = 0; - } - - timeStr = timeSectors[sector]; - if (timeStr.find("%1") != std::string::npos) { - hour = (hour + 1) % 12; - } - hourStr = std::string("#") + timeAccent + " " + hourNames[hour] + "#"; - timeStr.replace(timeStr.find("%"), 2, hourStr); - - lv_label_set_text(label_time, timeStr.c_str()); - lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - /* End difference from WatchFaceDigital*/ - - currentDate = std::chrono::time_point_cast(currentDateTime.Get()); - if (currentDate.IsUpdated()) { - uint16_t year = dateTimeController.Year(); - uint8_t day = dateTimeController.Day(); - if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) { - lv_label_set_text_fmt(label_date, - "%s %d %s %d", - dateTimeController.DayOfWeekShortToString(), - day, - dateTimeController.MonthShortToString(), - year); - } else { - lv_label_set_text_fmt(label_date, - "%s %s %d %d", - dateTimeController.DayOfWeekShortToString(), - dateTimeController.MonthShortToString(), - day, - year); - } - lv_obj_realign(label_date); - } - } - /* - heartbeat = heartRateController.HeartRate(); - heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; - if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { - if (heartbeatRunning.Get()) { - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); - lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); - } else { - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B)); - lv_label_set_text_static(heartbeatValue, ""); - } - - lv_obj_realign(heartbeatIcon); - lv_obj_realign(heartbeatValue); - } - - stepCount = motionController.NbSteps(); - if (stepCount.IsUpdated()) { - lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get()); - lv_obj_realign(stepValue); - lv_obj_realign(stepIcon); - }*/ -} - -/* Inspired by XFCE4-panel's fuzzy clock. - * - * https://salsa.debian.org/xfce-team/desktop/xfce4-panel/-/blob/debian/master/plugins/clock/clock-fuzzy.c - * - * Strings contain either a `%0` or a `%1`, indicating the position of - * the `hour` or `hour+1`, respectively. - */ -const char* WatchFaceFuzzy::timeSectors[] = { - "%0\no'clock", - "five past\n%0", - "ten past\n%0", - "quarter\npast\n%0", - "twenty\npast\n%0", - "twenty\nfive past\n%0", - "half past\n%0", - "twenty\nfive to\n%1", - "twenty\nto %1", - "quarter\nto %1", - "ten to\n%1", - "five to\n%1", -}; -const char* WatchFaceFuzzy::hourNames[] = { - "twelve", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "ten", - "eleven", -}; - -/* Once i18n is implemented, new languages can be introduced like this: - * - * const char* ca-ES_sectors[] = { - * "%0\nen punt", - * "%0\ni cinc", - * "%0\ni deu", - * "%0\ni quart", - * "%0\ni vint", - * "%0\ni vint-\ni-cinc", - * "%0\ni mitja", - * "%1\nmenys\nvint-\ni-cinc", - * "%1\nmenys\nvint", - * "%1\nmenys\nquart", - * "%1\nmenys deu", - * "%1\nmenys\ncinc", - * }; - * const char* ca-ES_hourNames[] = { - * "les dotze", - * "la una", - * "les dues", - * "les tres", - * "les\nquatre", - * "les cinc", - * "les sis", - * "les set", - * "les vuit", - * "les nou", - * "les deu", - * "les onze", - * }; - * - * const char* es-ES_sectors[] = { - * "%0\nen punto", - * "%0\ny cinco", - * "%0\ny diez", - * "%0\ny cuarto", - * "%0\ny veinte", - * "%0\ny veinti\ncinco", - * "%0\ny media", - * "%1\nmenos\nveinti\ncinco", - * "%1\nmenos\nveinte", - * "%1\nmenos\ncuarto", - * "%1\nmenos\ndiez", - * "%1\nmenos\ncinco", - * }; - * const char* es-ES_hourNames[] = { - * "las doce", - * "la una", - * "las dos", - * "las tres", - * "las\ncuatro", - * "las cinco", - * "las seis", - * "las siete", - * "las ocho", - * "las nueve", - * "las diez", - * "las once", - * }; - * - * char* it-IT_sectors[] = { - * "%0\nin punto", - * "%0 e cinque", - * "%0 e dieci", - * "%0 e un quarto", - * "%0 e venti", - * "%0 e venti cinque", - * "%0 e mezza", - * "%0 e trenta cinque", - * "%1 meno venti", - * "%1 meno un quarto", - * "%1 meno dieci", - * "%1 meno cinque", - * }; - * const char* it-IT_hourNames[] = { - * "dodici", - * "una", - * "due", - * "tre", - * "quattro", - * "cinque", - * "sei", - * "sette", - * "otto", - * "nove", - * "dieci", - * "undici", - * }; - * - * const char* de_DE_sectors[] = { - * "%0 Uhr", - * "Fünf nach %0", - * "Zehn nach %0", - * "Viertel nach %0", - * "Zwanzig nach %0", - * "Fünf vor halb %1", - * "Halb %1", - * "Fünf nach halb %1", - * "Zwanzig vor %1", - * "Viertel vor %1", - * "Zehn vor %1", - * "Fünf vor %1", - * }; - * const char* de_DE_hourNames[] = { - * "Zwölf", - * "Eins", // TODO: "Ein" in "Ein Uhr" - * "Zwei", - * "Drei", - * "Vier", - * "Fünf", - * "Sechs", - * "Sieben", - * "Acht", - * "Neun", - * "Zehn", - * "Elf", - * }; - */ \ No newline at end of file diff --git a/src/displayapp/screens/WatchFaceFuzzy.h b/src/displayapp/screens/WatchFaceFuzzy.h deleted file mode 100644 index e89a1911..00000000 --- a/src/displayapp/screens/WatchFaceFuzzy.h +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "displayapp/screens/Screen.h" -#include "components/datetime/DateTimeController.h" -#include "components/ble/BleController.h" -#include "displayapp/widgets/StatusIcons.h" -#include "utility/DirtyValue.h" -#include "displayapp/apps/Apps.h" - -namespace Pinetime { - namespace Controllers { - class Settings; - class Battery; - class Ble; - class NotificationManager; - class HeartRateController; - class MotionController; - } - - namespace Applications { - namespace Screens { - - class WatchFaceFuzzy : public Screen { - public: - WatchFaceFuzzy(Controllers::DateTime& dateTimeController, - const Controllers::Battery& batteryController, - const Controllers::Ble& bleController, - Controllers::NotificationManager& notificationManager, - Controllers::Settings& settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController); - ~WatchFaceFuzzy() override; - - void Refresh() override; - - private: - const char* timeAccent = "ffffff"; - uint8_t displayedHour = -1; - uint8_t displayedMinute = -1; - static const char* timeSectors[12]; - static const char* hourNames[12]; - - // Utility::DirtyValue batteryPercentRemaining {}; - // Utility::DirtyValue powerPresent {}; - // Utility::DirtyValue bleState {}; - // Utility::DirtyValue bleRadioEnabled {}; - Utility::DirtyValue> currentDateTime {}; - // Utility::DirtyValue stepCount {}; - // Utility::DirtyValue heartbeat {}; - // Utility::DirtyValue heartbeatRunning {}; - Utility::DirtyValue notificationState {}; - using days = std::chrono::duration>; // TODO: days is standard in c++20 - Utility::DirtyValue> currentDate; - - lv_obj_t* label_time; - lv_obj_t* label_time_ampm; - lv_obj_t* label_date; - // lv_obj_t* heartbeatIcon; - // lv_obj_t* heartbeatValue; - // lv_obj_t* stepIcon; - // lv_obj_t* stepValue; - lv_obj_t* notificationIcon; - - Controllers::DateTime& dateTimeController; - Controllers::NotificationManager& notificationManager; - Controllers::Settings& settingsController; - Controllers::HeartRateController& heartRateController; - Controllers::MotionController& motionController; - - lv_task_t* taskRefresh; - Widgets::StatusIcons statusIcons; - }; - } - - template <> - struct WatchFaceTraits { - static constexpr WatchFace watchFace = WatchFace::Fuzzy; - static constexpr const char* name = "Fuzzy face"; - - static Screens::Screen* Create(AppControllers& controllers) { - return new Screens::WatchFaceFuzzy(controllers.dateTimeController, - controllers.batteryController, - controllers.bleController, - controllers.notificationManager, - controllers.settingsController, - controllers.heartRateController, - controllers.motionController); - }; - - static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { - return true; - } - }; - } -} diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp index df46d8a8..312f4bd2 100644 --- a/src/displayapp/screens/settings/SettingTimeFormat.cpp +++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp @@ -13,9 +13,10 @@ namespace { const char* name; }; - constexpr std::array options = {{ + constexpr std::array options = {{ {Pinetime::Controllers::Settings::ClockType::H12, "12-hour"}, {Pinetime::Controllers::Settings::ClockType::H24, "24-hour"}, + {Pinetime::Controllers::Settings::ClockType::Fuzzy, "Fuzzy"}, }}; std::array CreateOptionArray() {