add ble state text output
This commit is contained in:
parent
fda1c088be
commit
eb8bd4dc4e
@ -55,7 +55,7 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
|||||||
lv_obj_align(batteryPercent, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
|
lv_obj_align(batteryPercent, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
|
||||||
|
|
||||||
connectState = lv_label_create(lv_scr_act(), nullptr);
|
connectState = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_label_set_recolor(connectState, true);
|
lv_label_set_text(bleValue, "Connected");
|
||||||
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
|
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
|
||||||
|
|
||||||
bleIcon = lv_label_create(lv_scr_act(), nullptr);
|
bleIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||||
@ -115,17 +115,18 @@ void WatchFaceTerminal::Refresh() {
|
|||||||
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
|
lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
|
||||||
auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent();
|
auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent();
|
||||||
lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging));
|
lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* bleValue;
|
/*char* bleValue;*/
|
||||||
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));
|
||||||
bleValue = "Connected";
|
lv_label_set_text(bleValue, "Connected#");
|
||||||
} else {
|
} else {
|
||||||
lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
|
lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
|
||||||
bleValue = "Disconnected";
|
lv_label_set_text(bleValue, "Disonnected#");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5);
|
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5);
|
||||||
@ -134,10 +135,11 @@ void WatchFaceTerminal::Refresh() {
|
|||||||
|
|
||||||
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentDateTime = dateTimeController.CurrentDateTime();
|
currentDateTime = dateTimeController.CurrentDateTime();
|
||||||
@ -163,14 +165,33 @@ void WatchFaceTerminal::Refresh() {
|
|||||||
|
|
||||||
char hoursChar[8];
|
char hoursChar[8];
|
||||||
|
|
||||||
char secondsChar[5];
|
char ampmChar[3];
|
||||||
sprintf(secondsChar, "%02d", static_cast<int>(second));
|
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
|
||||||
|
sprintf(hoursChar, "%02d", hour);
|
||||||
|
} else {
|
||||||
|
if (hour == 0 && hour != 12) {
|
||||||
|
hour = 12;
|
||||||
|
sprintf(ampmChar, "AM");
|
||||||
|
} else if (hour == 12 && hour != 0) {
|
||||||
|
hour = 12;
|
||||||
|
sprintf(ampmChar, "PM");
|
||||||
|
} else if (hour < 12 && hour != 0) {
|
||||||
|
sprintf(ampmChar, "AM");
|
||||||
|
} else if (hour > 12 && hour != 0) {
|
||||||
|
hour = hour - 12;
|
||||||
|
sprintf(ampmChar, "PM");
|
||||||
|
}
|
||||||
|
sprintf(hoursChar, "%02d", hour);
|
||||||
|
}
|
||||||
|
|
||||||
auto batteryValue = static_cast<uint8_t>(batteryController.PercentRemaining());
|
auto batteryValue = static_cast<uint8_t>(batteryController.PercentRemaining());
|
||||||
|
|
||||||
char battStr[24];
|
char battStr[24];
|
||||||
sprintf(battStr, "[BATT]#387b54 %d%\%#", batteryValue);
|
sprintf(battStr, "[BATT]#387b54 %d%\%#", batteryValue);
|
||||||
lv_label_set_text(batteryPercent, battStr);
|
lv_label_set_text(batteryPercent, battStr);
|
||||||
|
|
||||||
|
char secondsChar[5];
|
||||||
|
sprintf(secondsChar, "%02d", static_cast<int>(second));
|
||||||
|
|
||||||
char bleStr[24];
|
char bleStr[24];
|
||||||
sprintf(bleStr, "[STAT]#387b54 %s#", bleValue);
|
sprintf(bleStr, "[STAT]#387b54 %s#", bleValue);
|
||||||
@ -193,13 +214,14 @@ void WatchFaceTerminal::Refresh() {
|
|||||||
|
|
||||||
char timeStr[42];
|
char timeStr[42];
|
||||||
sprintf(timeStr,
|
sprintf(timeStr,
|
||||||
"[TIME]#11cc55 %c%c:%c%c:%c%c#",
|
"[TIME]#11cc55 %c%c:%c%c:%c%c %s#",
|
||||||
hoursChar[0],
|
hoursChar[0],
|
||||||
hoursChar[1],
|
hoursChar[1],
|
||||||
minutesChar[0],
|
minutesChar[0],
|
||||||
minutesChar[1],
|
minutesChar[1],
|
||||||
secondsChar[0],
|
secondsChar[0],
|
||||||
secondsChar[1]);
|
secondsChar[1],
|
||||||
|
ampmChar);
|
||||||
|
|
||||||
lv_label_set_text(label_time, timeStr);
|
lv_label_set_text(label_time, timeStr);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ namespace Pinetime {
|
|||||||
lv_obj_t* stepValue;
|
lv_obj_t* stepValue;
|
||||||
lv_obj_t* notificationIcon;
|
lv_obj_t* notificationIcon;
|
||||||
lv_obj_t* connectState;
|
lv_obj_t* connectState;
|
||||||
|
lv_obj_t* bleValue;
|
||||||
|
|
||||||
Controllers::DateTime& dateTimeController;
|
Controllers::DateTime& dateTimeController;
|
||||||
Controllers::Battery& batteryController;
|
Controllers::Battery& batteryController;
|
||||||
|
Loading…
Reference in New Issue
Block a user