This commit is contained in:
Дмитрий Марков 2022-01-18 15:48:15 +05:00
parent 477a3a7f27
commit 0ed45a9916
No known key found for this signature in database
GPG Key ID: 49CFEE49DBF77352
3 changed files with 96 additions and 98 deletions

View File

@ -80,13 +80,8 @@ std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
} }
std::unique_ptr<Screen> Clock::PineTimeStyleScreen() { std::unique_ptr<Screen> Clock::PineTimeStyleScreen() {
return std::make_unique<Screens::PineTimeStyle>(app, return std::make_unique<Screens::PineTimeStyle>(
dateTimeController, app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController);
batteryController,
bleController,
notificatioManager,
settingsController,
motionController);
} }
std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() { std::unique_ptr<Screen> Clock::WatchFaceTerminalScreen() {

View File

@ -115,7 +115,7 @@ void WatchFaceTerminal::Refresh() {
bleState = bleController.IsConnected(); bleState = bleController.IsConnected();
if (bleState.IsUpdated()) { if (bleState.IsUpdated()) {
if(bleState.Get() == true) { if (bleState.Get() == true) {
lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); lv_label_set_text(bleIcon, BleIcon::GetIcon(true));
} else { } else {
lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
@ -126,8 +126,8 @@ void WatchFaceTerminal::Refresh() {
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
notificationState = notificatioManager.AreNewNotificationsAvailable(); notificationState = notificatioManager.AreNewNotificationsAvailable();
if(notificationState.IsUpdated()) { if (notificationState.IsUpdated()) {
if(notificationState.Get() == true) if (notificationState.Get() == true)
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true));
else else
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
@ -135,16 +135,16 @@ void WatchFaceTerminal::Refresh() {
currentDateTime = dateTimeController.CurrentDateTime(); currentDateTime = dateTimeController.CurrentDateTime();
if(currentDateTime.IsUpdated()) { if (currentDateTime.IsUpdated()) {
auto newDateTime = currentDateTime.Get(); auto newDateTime = currentDateTime.Get();
auto dp = date::floor<date::days>(newDateTime); auto dp = date::floor<date::days>(newDateTime);
auto time = date::make_time(newDateTime-dp); auto time = date::make_time(newDateTime - dp);
auto yearMonthDay = date::year_month_day(dp); auto yearMonthDay = date::year_month_day(dp);
auto year = (int)yearMonthDay.year(); auto year = (int) yearMonthDay.year();
auto month = static_cast<Pinetime::Controllers::DateTime::Months>((unsigned)yearMonthDay.month()); auto month = static_cast<Pinetime::Controllers::DateTime::Months>((unsigned) yearMonthDay.month());
auto day = (unsigned)yearMonthDay.day(); auto day = (unsigned) yearMonthDay.day();
auto dayOfWeek = static_cast<Pinetime::Controllers::DateTime::Days>(date::weekday(yearMonthDay).iso_encoding()); auto dayOfWeek = static_cast<Pinetime::Controllers::DateTime::Days>(date::weekday(yearMonthDay).iso_encoding());
int hour = time.hours().count(); int hour = time.hours().count();
@ -184,12 +184,8 @@ void WatchFaceTerminal::Refresh() {
sprintf(battStr, "[BATT]#387b54 %d%\%#", batteryValue); sprintf(battStr, "[BATT]#387b54 %d%\%#", batteryValue);
lv_label_set_text(batteryPercent, battStr); lv_label_set_text(batteryPercent, battStr);
if(hoursChar[0] != displayedChar[0] || if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
hoursChar[1] != displayedChar[1] || minutesChar[1] != displayedChar[3] || secondsChar[0] != displayedChar[4] || secondsChar[1] != displayedChar[5]) {
minutesChar[0] != displayedChar[2] ||
minutesChar[1] != displayedChar[3] ||
secondsChar[0] != displayedChar[4] ||
secondsChar[1] != displayedChar[5]) {
displayedChar[0] = hoursChar[0]; displayedChar[0] = hoursChar[0];
displayedChar[1] = hoursChar[1]; displayedChar[1] = hoursChar[1];
displayedChar[2] = minutesChar[0]; displayedChar[2] = minutesChar[0];
@ -204,7 +200,15 @@ void WatchFaceTerminal::Refresh() {
} }
char timeStr[42]; char timeStr[42];
sprintf(timeStr, "[TIME]#11cc55 %c%c:%c%c:%c%c %s#", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1], secondsChar[0], secondsChar[1], ampmChar); sprintf(timeStr,
"[TIME]#11cc55 %c%c:%c%c:%c%c %s#",
hoursChar[0],
hoursChar[1],
minutesChar[0],
minutesChar[1],
secondsChar[0],
secondsChar[1],
ampmChar);
lv_label_set_text(label_time, timeStr); lv_label_set_text(label_time, timeStr);
} }
@ -215,7 +219,6 @@ void WatchFaceTerminal::Refresh() {
sprintf(dateStr, "[DATE]#007fff %04d.%02d.%02d#", short(year), char(month), char(day)); sprintf(dateStr, "[DATE]#007fff %04d.%02d.%02d#", short(year), char(month), char(day));
lv_label_set_text(label_date, dateStr); lv_label_set_text(label_date, dateStr);
currentYear = year; currentYear = year;
currentMonth = month; currentMonth = month;
currentDayOfWeek = dayOfWeek; currentDayOfWeek = dayOfWeek;
@ -225,9 +228,9 @@ void WatchFaceTerminal::Refresh() {
heartbeat = heartRateController.HeartRate(); heartbeat = heartRateController.HeartRate();
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
if(heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
char heartbeatBuffer[28]; char heartbeatBuffer[28];
if(heartbeatRunning.Get()) if (heartbeatRunning.Get())
sprintf(heartbeatBuffer, "[L_HR]#ee3311 %d bpm#", heartbeat.Get()); sprintf(heartbeatBuffer, "[L_HR]#ee3311 %d bpm#", heartbeat.Get());
else else
sprintf(heartbeatBuffer, "[L_HR]#ee3311 ---#"); sprintf(heartbeatBuffer, "[L_HR]#ee3311 ---#");

View File

@ -34,7 +34,7 @@ namespace Pinetime {
void Refresh() override; void Refresh() override;
void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); void OnObjectEvent(lv_obj_t* pObj, lv_event_t i);
private: private:
char displayedChar[8]; char displayedChar[8];
@ -46,7 +46,7 @@ namespace Pinetime {
DirtyValue<int> batteryPercentRemaining {}; DirtyValue<int> batteryPercentRemaining {};
DirtyValue<bool> bleState {}; DirtyValue<bool> bleState {};
DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime{}; DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime {};
DirtyValue<bool> motionSensorOk {}; DirtyValue<bool> motionSensorOk {};
DirtyValue<uint32_t> stepCount {}; DirtyValue<uint32_t> stepCount {};
DirtyValue<uint8_t> heartbeat {}; DirtyValue<uint8_t> heartbeat {};