From 39bc166e549e8ccae75468aa2dd3613d51f54e27 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 10 Dec 2023 18:35:19 +0100 Subject: Watch face selection at build time Watch faces can now be selected at buid time. It's implemented in a similar way than the selection of user apps, using a list of watch face description that is generated at build time (consteval, constexpr) --- src/displayapp/screens/WatchFaceTerminal.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/displayapp/screens/WatchFaceTerminal.h') diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index d08a146b..ce22005f 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "displayapp/screens/Screen.h" #include "components/datetime/DateTimeController.h" #include "utility/DirtyValue.h" @@ -68,5 +69,25 @@ namespace Pinetime { lv_task_t* taskRefresh; }; } + + template <> + struct WatchFaceTraits { + static constexpr WatchFace watchFace = WatchFace::Terminal; + static constexpr const char* name = "Terminal"; + + static Screens::Screen* Create(AppControllers& controllers) { + return new Screens::WatchFaceTerminal(controllers.dateTimeController, + controllers.batteryController, + controllers.bleController, + controllers.notificationManager, + controllers.settingsController, + controllers.heartRateController, + controllers.motionController); + }; + + static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { + return true; + } + }; } } -- cgit v1.2.3-70-g09d2