From a4ae3d4483ba9d4eb57253ad6505b154cea7d0f7 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 9 May 2024 17:01:20 -0400 Subject: [PATCH] Add documentation of adapting old watchfaces to work --- doc/watchfaces.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/doc/watchfaces.md b/doc/watchfaces.md index e69de29b..7ec8051d 100644 --- a/doc/watchfaces.md +++ b/doc/watchfaces.md @@ -0,0 +1,54 @@ +# Adapting old watchfaces: + - When resolving conflicts, delete clock.h/.cpp, keep both in CMakeLists.cpp, accept current in SettingWatchFace.cpp, and keep both if there are any changes in fonts. + - Add entry to WatchFace enum in displayapp/apps/Apps.h.in + - Remove `DisplayApp* app` param from constructor in .h and .cpp and remove Screen(app) from initializer list on constructor in .cpp + - Add const to batteryController and bleController is present in constructor params and in private members in .h + - In .cpp, remove `#include ` and convert calls to get time to format like in working watch faces. For example: +```cpp + auto newDateTime = currentDateTime.Get(); + + auto dp = date::floor(newDateTime); + auto time = date::make_time(newDateTime - dp); + + uint8_t hour = time.hours().count(); + uint8_t minute = time.minutes().count(); +``` +with +```cpp +    uint8_t hour = dateTimeController.Hours(); +    uint8_t minute = dateTimeController.Minutes(); +``` +, add +```cpp +Utility::DirtyValue> currentDate; +``` +to .h + - Remove `motionSensorOk = motionController.IsSensorOk();` and reference to `motionSensorOk` in following if + - In .h add `#include "utility/DirtyValue.h"` and replace all `DirtyValue<>` vars with `Utility::DirtyValue<>` + - Add WatchFaceTraits: + ``` cpp + template <> + struct WatchFaceTraits { + static constexpr WatchFace watchFace = WatchFace::Digital; + static constexpr const char* name = "Digital face"; + + static Screens::Screen* Create(AppControllers& controllers) { + return new Screens::WatchFaceDigital(controllers.dateTimeController, + controllers.batteryController, + controllers.bleController, + controllers.notificationManager, + controllers.settingsController, + controllers.heartRateController, + controllers.motionController,                                             controllers.filesystem + *controllers.weatherController); + }; + + +      static bool IsAvailable(Pinetime::Controllers::FS& filesystem) { +        return Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem); +      } + }; +``` +modify as necesary. +- Add include to UserApps.h: `#include "displayapp/screens/WatchFace---.h"` +- Add to displayapp/apps/CMakeLists.txt \ No newline at end of file