typo fix
This commit is contained in:
parent
477a3a7f27
commit
0ed45a9916
@ -80,22 +80,17 @@ 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() {
|
||||||
return std::make_unique<Screens::WatchFaceTerminal>(app,
|
return std::make_unique<Screens::WatchFaceTerminal>(app,
|
||||||
dateTimeController,
|
dateTimeController,
|
||||||
batteryController,
|
batteryController,
|
||||||
bleController,
|
bleController,
|
||||||
notificatioManager,
|
notificatioManager,
|
||||||
settingsController,
|
settingsController,
|
||||||
heartRateController,
|
heartRateController,
|
||||||
motionController);
|
motionController);
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& dateTimeController,
|
||||||
Controllers::Battery& batteryController,
|
Controllers::Battery& batteryController,
|
||||||
Controllers::Ble& bleController,
|
Controllers::Ble& bleController,
|
||||||
Controllers::NotificationManager& notificatioManager,
|
Controllers::NotificationManager& notificatioManager,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::HeartRateController& heartRateController,
|
Controllers::HeartRateController& heartRateController,
|
||||||
Controllers::MotionController& motionController)
|
Controllers::MotionController& motionController)
|
||||||
: Screen(app),
|
: Screen(app),
|
||||||
currentDateTime {{}},
|
currentDateTime {{}},
|
||||||
dateTimeController {dateTimeController},
|
dateTimeController {dateTimeController},
|
||||||
@ -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();
|
||||||
@ -158,21 +158,21 @@ void WatchFaceTerminal::Refresh() {
|
|||||||
|
|
||||||
char ampmChar[3];
|
char ampmChar[3];
|
||||||
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
||||||
sprintf(hoursChar, "%02d", hour);
|
sprintf(hoursChar, "%02d", hour);
|
||||||
} else {
|
} else {
|
||||||
if (hour == 0 && hour != 12) {
|
if (hour == 0 && hour != 12) {
|
||||||
hour = 12;
|
hour = 12;
|
||||||
sprintf(ampmChar, "AM");
|
sprintf(ampmChar, "AM");
|
||||||
} else if (hour == 12 && hour != 0) {
|
} else if (hour == 12 && hour != 0) {
|
||||||
hour = 12;
|
hour = 12;
|
||||||
sprintf(ampmChar, "PM");
|
sprintf(ampmChar, "PM");
|
||||||
} else if (hour < 12 && hour != 0) {
|
} else if (hour < 12 && hour != 0) {
|
||||||
sprintf(ampmChar, "AM");
|
sprintf(ampmChar, "AM");
|
||||||
} else if (hour > 12 && hour != 0) {
|
} else if (hour > 12 && hour != 0) {
|
||||||
hour = hour - 12;
|
hour = hour - 12;
|
||||||
sprintf(ampmChar, "PM");
|
sprintf(ampmChar, "PM");
|
||||||
}
|
}
|
||||||
sprintf(hoursChar, "%02d", hour);
|
sprintf(hoursChar, "%02d", hour);
|
||||||
}
|
}
|
||||||
|
|
||||||
char secondsChar[5];
|
char secondsChar[5];
|
||||||
@ -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 ---#");
|
||||||
|
@ -23,60 +23,60 @@ namespace Pinetime {
|
|||||||
class WatchFaceTerminal : public Screen {
|
class WatchFaceTerminal : public Screen {
|
||||||
public:
|
public:
|
||||||
WatchFaceTerminal(DisplayApp* app,
|
WatchFaceTerminal(DisplayApp* app,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& dateTimeController,
|
||||||
Controllers::Battery& batteryController,
|
Controllers::Battery& batteryController,
|
||||||
Controllers::Ble& bleController,
|
Controllers::Ble& bleController,
|
||||||
Controllers::NotificationManager& notificatioManager,
|
Controllers::NotificationManager& notificatioManager,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
Controllers::HeartRateController& heartRateController,
|
Controllers::HeartRateController& heartRateController,
|
||||||
Controllers::MotionController& motionController);
|
Controllers::MotionController& motionController);
|
||||||
~WatchFaceTerminal() override;
|
~WatchFaceTerminal() override;
|
||||||
|
|
||||||
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];
|
||||||
|
|
||||||
uint16_t currentYear = 1970;
|
uint16_t currentYear = 1970;
|
||||||
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;
|
||||||
|
|
||||||
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 {};
|
||||||
DirtyValue<bool> heartbeatRunning {};
|
DirtyValue<bool> heartbeatRunning {};
|
||||||
DirtyValue<bool> notificationState {};
|
DirtyValue<bool> notificationState {};
|
||||||
|
|
||||||
lv_obj_t* label_time;
|
lv_obj_t* label_time;
|
||||||
lv_obj_t* label_date;
|
lv_obj_t* label_date;
|
||||||
lv_obj_t* label_prompt_1;
|
lv_obj_t* label_prompt_1;
|
||||||
lv_obj_t* label_prompt_2;
|
lv_obj_t* label_prompt_2;
|
||||||
lv_obj_t* backgroundLabel;
|
lv_obj_t* backgroundLabel;
|
||||||
lv_obj_t* batteryIcon;
|
lv_obj_t* batteryIcon;
|
||||||
lv_obj_t* bleIcon;
|
lv_obj_t* bleIcon;
|
||||||
lv_obj_t* batteryPlug;
|
lv_obj_t* batteryPlug;
|
||||||
lv_obj_t* batteryPercent;
|
lv_obj_t* batteryPercent;
|
||||||
lv_obj_t* heartbeatIcon;
|
lv_obj_t* heartbeatIcon;
|
||||||
lv_obj_t* heartbeatValue;
|
lv_obj_t* heartbeatValue;
|
||||||
lv_obj_t* heartbeatBpm;
|
lv_obj_t* heartbeatBpm;
|
||||||
lv_obj_t* stepValue;
|
lv_obj_t* stepValue;
|
||||||
lv_obj_t* notificationIcon;
|
lv_obj_t* notificationIcon;
|
||||||
|
|
||||||
Controllers::DateTime& dateTimeController;
|
Controllers::DateTime& dateTimeController;
|
||||||
Controllers::Battery& batteryController;
|
Controllers::Battery& batteryController;
|
||||||
Controllers::Ble& bleController;
|
Controllers::Ble& bleController;
|
||||||
Controllers::NotificationManager& notificatioManager;
|
Controllers::NotificationManager& notificatioManager;
|
||||||
Controllers::Settings& settingsController;
|
Controllers::Settings& settingsController;
|
||||||
Controllers::HeartRateController& heartRateController;
|
Controllers::HeartRateController& heartRateController;
|
||||||
Controllers::MotionController& motionController;
|
Controllers::MotionController& motionController;
|
||||||
|
|
||||||
lv_task_t* taskRefresh;
|
lv_task_t* taskRefresh;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user