Horizon watch face compiles
This commit is contained in:
parent
ef696cadd5
commit
dc45d845c2
@ -10,11 +10,11 @@
|
|||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
WatchFaceHorizon::WatchFaceHorizon(Controllers::DateTime& dateTimeController,
|
WatchFaceHorizon::WatchFaceHorizon(Controllers::DateTime& dateTimeController,
|
||||||
Controllers::Battery& batteryController,
|
const Controllers::Battery& batteryController,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::MotionController& motionController,
|
Controllers::MotionController& motionController,
|
||||||
Controllers::FS& filesystem)
|
Controllers::FS& filesystem)
|
||||||
currentDateTime {{}},
|
: currentDateTime {{}},
|
||||||
dateTimeController {dateTimeController},
|
dateTimeController {dateTimeController},
|
||||||
batteryController {batteryController},
|
batteryController {batteryController},
|
||||||
settingsController {settingsController},
|
settingsController {settingsController},
|
||||||
@ -144,21 +144,12 @@ WatchFaceHorizon::~WatchFaceHorizon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WatchFaceHorizon::Refresh() {
|
void WatchFaceHorizon::Refresh() {
|
||||||
currentDateTime = dateTimeController.CurrentDateTime();
|
currentDateTime = std::chrono::time_point_cast<std::chrono::seconds>(dateTimeController.CurrentDateTime());
|
||||||
|
|
||||||
if (currentDateTime.IsUpdated()) {
|
if (currentDateTime.IsUpdated()) {
|
||||||
auto newDateTime = currentDateTime.Get();
|
uint8_t hour = dateTimeController.Hours();
|
||||||
|
uint8_t minute = dateTimeController.Minutes();
|
||||||
auto dp = date::floor<date::days>(newDateTime);
|
uint8_t day = dateTimeController.Day();
|
||||||
auto time = date::make_time(newDateTime - dp);
|
|
||||||
auto yearMonthDay = date::year_month_day(dp);
|
|
||||||
|
|
||||||
auto month = static_cast<Pinetime::Controllers::DateTime::Months>(static_cast<unsigned>(yearMonthDay.month()));
|
|
||||||
auto day = static_cast<unsigned>(yearMonthDay.day());
|
|
||||||
auto dayOfWeek = static_cast<Pinetime::Controllers::DateTime::Days>(date::weekday(yearMonthDay).iso_encoding());
|
|
||||||
|
|
||||||
int64_t hour = time.hours().count();
|
|
||||||
int64_t minute = time.minutes().count();
|
|
||||||
|
|
||||||
char minutesChar[3];
|
char minutesChar[3];
|
||||||
sprintf(minutesChar, "%02d", static_cast<int>(minute));
|
sprintf(minutesChar, "%02d", static_cast<int>(minute));
|
||||||
@ -167,6 +158,7 @@ void WatchFaceHorizon::Refresh() {
|
|||||||
int displayHour = hour;
|
int displayHour = hour;
|
||||||
|
|
||||||
// Account for 12-hour time
|
// Account for 12-hour time
|
||||||
|
|
||||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) {
|
||||||
if (hour < 12) {
|
if (hour < 12) {
|
||||||
if (hour == 0) {
|
if (hour == 0) {
|
||||||
@ -214,7 +206,8 @@ void WatchFaceHorizon::Refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Date has updated
|
// Date has updated
|
||||||
if ((month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
|
currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get());
|
||||||
|
if (currentDate.IsUpdated()) {
|
||||||
lv_label_set_text_fmt(labelDayOfWeek, "%s", dateTimeController.DayOfWeekShortToString());
|
lv_label_set_text_fmt(labelDayOfWeek, "%s", dateTimeController.DayOfWeekShortToString());
|
||||||
lv_label_set_text_fmt(labelMonth, "%s", dateTimeController.MonthShortToString());
|
lv_label_set_text_fmt(labelMonth, "%s", dateTimeController.MonthShortToString());
|
||||||
lv_label_set_text_fmt(labelDate, "%d", day);
|
lv_label_set_text_fmt(labelDate, "%d", day);
|
||||||
@ -222,10 +215,6 @@ void WatchFaceHorizon::Refresh() {
|
|||||||
lv_obj_realign(labelDayOfWeek);
|
lv_obj_realign(labelDayOfWeek);
|
||||||
lv_obj_realign(labelMonth);
|
lv_obj_realign(labelMonth);
|
||||||
lv_obj_realign(labelDate);
|
lv_obj_realign(labelDate);
|
||||||
|
|
||||||
currentMonth = month;
|
|
||||||
currentDayOfWeek = dayOfWeek;
|
|
||||||
currentDay = day;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,8 +227,7 @@ void WatchFaceHorizon::Refresh() {
|
|||||||
|
|
||||||
// Set step count
|
// Set step count
|
||||||
stepCount = motionController.NbSteps();
|
stepCount = motionController.NbSteps();
|
||||||
motionSensorOk = motionController.IsSensorOk();
|
if (stepCount.IsUpdated()) {
|
||||||
if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) {
|
|
||||||
lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
|
lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get());
|
||||||
lv_obj_realign(stepValue);
|
lv_obj_realign(stepValue);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace Pinetime {
|
|||||||
class WatchFaceHorizon : public Screen {
|
class WatchFaceHorizon : public Screen {
|
||||||
public:
|
public:
|
||||||
WatchFaceHorizon(Controllers::DateTime& dateTimeController,
|
WatchFaceHorizon(Controllers::DateTime& dateTimeController,
|
||||||
Controllers::Battery& batteryController,
|
const Controllers::Battery& batteryController,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::MotionController& motionController,
|
Controllers::MotionController& motionController,
|
||||||
Controllers::FS& fs);
|
Controllers::FS& fs);
|
||||||
@ -41,6 +41,7 @@ namespace Pinetime {
|
|||||||
Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
|
Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
|
||||||
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
|
Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
|
||||||
uint8_t currentDay = 0;
|
uint8_t currentDay = 0;
|
||||||
|
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
|
||||||
|
|
||||||
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
|
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
|
||||||
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
|
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
|
||||||
@ -73,7 +74,7 @@ namespace Pinetime {
|
|||||||
lv_obj_t* stepValue;
|
lv_obj_t* stepValue;
|
||||||
|
|
||||||
Controllers::DateTime& dateTimeController;
|
Controllers::DateTime& dateTimeController;
|
||||||
Controllers::Battery& batteryController;
|
const Controllers::Battery& batteryController;
|
||||||
Controllers::Settings& settingsController;
|
Controllers::Settings& settingsController;
|
||||||
Controllers::MotionController& motionController;
|
Controllers::MotionController& motionController;
|
||||||
|
|
||||||
@ -92,16 +93,16 @@ namespace Pinetime {
|
|||||||
static constexpr WatchFace watchFace = WatchFace::Horizon;
|
static constexpr WatchFace watchFace = WatchFace::Horizon;
|
||||||
static constexpr const char* name = "Horizon";
|
static constexpr const char* name = "Horizon";
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create;/*(AppControllers& controllers) {
|
||||||
return new Screens::WatchFaceHorizon(controllers.dateTimeController,
|
return new Screens::WatchFaceHorizon(controllers.dateTimeController,
|
||||||
controllers.batteryController,
|
controllers.batteryController,
|
||||||
controllers.settingsController,
|
controllers.settingsController,
|
||||||
controllers.motionController,
|
controllers.motionController,
|
||||||
controllers.filesystem);
|
controllers.filesystem);
|
||||||
};
|
};*/
|
||||||
|
|
||||||
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
||||||
return Screens::WatchFaceInfineat::IsAvailable(filesystem);
|
return Screens::WatchFaceHorizon::IsAvailable(filesystem);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "displayapp/screens/CheckboxList.h"
|
#include "displayapp/screens/CheckboxList.h"
|
||||||
#include "displayapp/screens/WatchFaceInfineat.h"
|
#include "displayapp/screens/WatchFaceInfineat.h"
|
||||||
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
|
#include "displayapp/screens/WatchFaceCasioStyleG7710.h"
|
||||||
|
#include "displayapp/screens/WatchFaceHorizon.h"
|
||||||
|
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user