add ble state text output
This commit is contained in:
parent
0ed45a9916
commit
68d3d9b343
@ -54,6 +54,10 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
||||
lv_label_set_recolor(batteryPercent, true);
|
||||
lv_obj_align(batteryPercent, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -20);
|
||||
|
||||
connectState = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_recolor(connectState, true);
|
||||
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
|
||||
|
||||
bleIcon = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_label_set_text(bleIcon, Symbols::bluetooth);
|
||||
lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0);
|
||||
@ -71,7 +75,7 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
|
||||
lv_label_set_text(label_prompt_1, "user@watch:~ $ now");
|
||||
|
||||
label_prompt_2 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
|
||||
lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
|
||||
lv_label_set_text(label_prompt_2, "user@watch:~ $");
|
||||
|
||||
label_time = lv_label_create(lv_scr_act(), nullptr);
|
||||
@ -113,12 +117,15 @@ void WatchFaceTerminal::Refresh() {
|
||||
lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging));
|
||||
}
|
||||
|
||||
char* bleValue;
|
||||
bleState = bleController.IsConnected();
|
||||
if (bleState.IsUpdated()) {
|
||||
if (bleState.Get() == true) {
|
||||
lv_label_set_text(bleIcon, BleIcon::GetIcon(true));
|
||||
bleValue = "Connected";
|
||||
} else {
|
||||
lv_label_set_text(bleIcon, BleIcon::GetIcon(false));
|
||||
bleValue = "Disconnected";
|
||||
}
|
||||
}
|
||||
lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5);
|
||||
@ -156,25 +163,6 @@ void WatchFaceTerminal::Refresh() {
|
||||
|
||||
char hoursChar[8];
|
||||
|
||||
char ampmChar[3];
|
||||
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);
|
||||
}
|
||||
|
||||
char secondsChar[5];
|
||||
sprintf(secondsChar, "%02d", static_cast<int>(second));
|
||||
|
||||
@ -184,6 +172,10 @@ void WatchFaceTerminal::Refresh() {
|
||||
sprintf(battStr, "[BATT]#387b54 %d%\%#", batteryValue);
|
||||
lv_label_set_text(batteryPercent, battStr);
|
||||
|
||||
char bleStr[24];
|
||||
sprintf(bleStr, "[BLE]#387b54 %s#", bleValue);
|
||||
lv_label_set_text(connectState, bleStr);
|
||||
|
||||
if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] ||
|
||||
minutesChar[1] != displayedChar[3] || secondsChar[0] != displayedChar[4] || secondsChar[1] != displayedChar[5]) {
|
||||
displayedChar[0] = hoursChar[0];
|
||||
@ -201,14 +193,13 @@ void WatchFaceTerminal::Refresh() {
|
||||
|
||||
char timeStr[42];
|
||||
sprintf(timeStr,
|
||||
"[TIME]#11cc55 %c%c:%c%c:%c%c %s#",
|
||||
"[TIME]#11cc55 %c%c:%c%c:%c%c#",
|
||||
hoursChar[0],
|
||||
hoursChar[1],
|
||||
minutesChar[0],
|
||||
minutesChar[1],
|
||||
secondsChar[0],
|
||||
secondsChar[1],
|
||||
ampmChar);
|
||||
secondsChar[1]);
|
||||
|
||||
lv_label_set_text(label_time, timeStr);
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ namespace Pinetime {
|
||||
lv_obj_t* heartbeatBpm;
|
||||
lv_obj_t* stepValue;
|
||||
lv_obj_t* notificationIcon;
|
||||
lv_obj_t* connectState;
|
||||
|
||||
Controllers::DateTime& dateTimeController;
|
||||
Controllers::Battery& batteryController;
|
||||
|
Loading…
Reference in New Issue
Block a user