Work on horizon watchface

This commit is contained in:
Josh 2024-05-09 10:24:18 -04:00
parent a01abc89be
commit 89fc951cd6
5 changed files with 32 additions and 11 deletions

View File

@ -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 {

View File

@ -57,6 +57,7 @@ namespace Pinetime {
Terminal,
Infineat,
CasioStyleG7710,
Horizon
};
template <Apps>

View File

@ -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()

View File

@ -1,21 +1,19 @@
#include "displayapp/screens/WatchFaceHorizon.h"
#include <date/date.h>
#include <lvgl/lvgl.h>
#include <cstdio>
#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},

View File

@ -6,6 +6,9 @@
#include <memory>
#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,
@ -40,10 +42,10 @@ namespace Pinetime {
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
uint8_t currentDay = 0;
DirtyValue<uint8_t> batteryPercentRemaining {};
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
DirtyValue<bool> motionSensorOk {};
DirtyValue<uint32_t> stepCount {};
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
Utility::DirtyValue<bool> motionSensorOk {};
Utility::DirtyValue<uint32_t> stepCount {};
lv_obj_t* background;
@ -84,5 +86,23 @@ namespace Pinetime {
0xbd815b, 0xa86f60, 0x935d64, 0x7e4b68, 0x6d4467, 0x4b3766, 0x3a3066, 0x292965};
};
}
template <>
struct WatchFaceTraits<WatchFace::Horizon> {
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);
}
};
}
}