54 lines
2.6 KiB
Markdown
54 lines
2.6 KiB
Markdown
# 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 <date/date.h>` and convert calls to get time to format like in working watch faces. For example:
|
||
```cpp
|
||
auto newDateTime = currentDateTime.Get();
|
||
|
||
auto dp = date::floor<date::days>(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<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> 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<WatchFace::Digital> {
|
||
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 |