From 89fc951cd6d8f012da70db1f6052e60d322c3ce4 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 9 May 2024 10:24:18 -0400 Subject: [PATCH] Work on horizon watchface --- src/displayapp/UserApps.h | 1 + src/displayapp/apps/Apps.h.in | 1 + src/displayapp/apps/CMakeLists.txt | 1 + src/displayapp/screens/WatchFaceHorizon.cpp | 6 ++-- src/displayapp/screens/WatchFaceHorizon.h | 34 ++++++++++++++++----- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/displayapp/UserApps.h b/src/displayapp/UserApps.h index c69cdba7..e51dc9da 100644 --- a/src/displayapp/UserApps.h +++ b/src/displayapp/UserApps.h @@ -15,6 +15,7 @@ #include "displayapp/screens/WatchFaceInfineat.h" #include "displayapp/screens/WatchFacePineTimeStyle.h" #include "displayapp/screens/WatchFaceTerminal.h" +#include "displayapp/screens/WatchFaceHorizon.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/apps/Apps.h.in b/src/displayapp/apps/Apps.h.in index 1d78799c..64ad2572 100644 --- a/src/displayapp/apps/Apps.h.in +++ b/src/displayapp/apps/Apps.h.in @@ -57,6 +57,7 @@ namespace Pinetime { Terminal, Infineat, CasioStyleG7710, + Horizon }; template diff --git a/src/displayapp/apps/CMakeLists.txt b/src/displayapp/apps/CMakeLists.txt index f23c845a..b25f4846 100644 --- a/src/displayapp/apps/CMakeLists.txt +++ b/src/displayapp/apps/CMakeLists.txt @@ -30,6 +30,7 @@ else() set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Terminal") set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Infineat") set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::CasioStyleG7710") + set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Horizon") set(WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}" CACHE STRING "List of watch faces to build into the firmware") endif() diff --git a/src/displayapp/screens/WatchFaceHorizon.cpp b/src/displayapp/screens/WatchFaceHorizon.cpp index e3f83c5f..639cbcd5 100644 --- a/src/displayapp/screens/WatchFaceHorizon.cpp +++ b/src/displayapp/screens/WatchFaceHorizon.cpp @@ -1,21 +1,19 @@ #include "displayapp/screens/WatchFaceHorizon.h" -#include #include #include #include "components/settings/Settings.h" #include "components/battery/BatteryController.h" #include "components/motion/MotionController.h" +#include "utility/DirtyValue.h" using namespace Pinetime::Applications::Screens; -WatchFaceHorizon::WatchFaceHorizon(DisplayApp* app, - Controllers::DateTime& dateTimeController, +WatchFaceHorizon::WatchFaceHorizon(Controllers::DateTime& dateTimeController, Controllers::Battery& batteryController, Controllers::Settings& settingsController, Controllers::MotionController& motionController, Controllers::FS& filesystem) - : Screen(app), currentDateTime {{}}, dateTimeController {dateTimeController}, batteryController {batteryController}, diff --git a/src/displayapp/screens/WatchFaceHorizon.h b/src/displayapp/screens/WatchFaceHorizon.h index 41937f43..a2ef6511 100644 --- a/src/displayapp/screens/WatchFaceHorizon.h +++ b/src/displayapp/screens/WatchFaceHorizon.h @@ -6,6 +6,9 @@ #include #include "displayapp/screens/Screen.h" #include "components/datetime/DateTimeController.h" +#include "components/ble/BleController.h" +#include "utility/DirtyValue.h" +#include "displayapp/apps/Apps.h" namespace Pinetime { namespace Controllers { @@ -19,8 +22,7 @@ namespace Pinetime { class WatchFaceHorizon : public Screen { public: - WatchFaceHorizon(DisplayApp* app, - Controllers::DateTime& dateTimeController, + WatchFaceHorizon(Controllers::DateTime& dateTimeController, Controllers::Battery& batteryController, Controllers::Settings& settingsController, Controllers::MotionController& motionController, @@ -39,11 +41,11 @@ namespace Pinetime { Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; uint8_t currentDay = 0; - - DirtyValue batteryPercentRemaining {}; - DirtyValue> currentDateTime {}; - DirtyValue motionSensorOk {}; - DirtyValue stepCount {}; + + Utility::DirtyValue batteryPercentRemaining {}; + Utility::DirtyValue> currentDateTime {}; + Utility::DirtyValue motionSensorOk {}; + Utility::DirtyValue stepCount {}; lv_obj_t* background; @@ -84,5 +86,23 @@ namespace Pinetime { 0xbd815b, 0xa86f60, 0x935d64, 0x7e4b68, 0x6d4467, 0x4b3766, 0x3a3066, 0x292965}; }; } + + template <> + struct WatchFaceTraits { + static constexpr WatchFace watchFace = WatchFace::Horizon; + static constexpr const char* name = "Horizon"; + + static Screens::Screen* Create(AppControllers& controllers) { + return new Screens::WatchFaceHorizon(controllers.dateTimeController, + controllers.batteryController, + controllers.settingsController, + controllers.motionController, + controllers.filesystem); + }; + + static bool IsAvailable(Pinetime::Controllers::FS& filesystem) { + return Screens::WatchFaceInfineat::IsAvailable(filesystem); + } + }; } }