1
0
Fork 0

heart rate indicator: change '0' to '...' (Analog, Digital, Terminal)

This commit is contained in:
Julian Foad 2024-08-26 14:19:06 +01:00
parent 4262e61ee7
commit ab9eaef3fc
3 changed files with 16 additions and 4 deletions

View file

@ -300,7 +300,11 @@ void WatchFaceAnalog::Refresh() {
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
if (heartbeatRunning.Get()) {
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
auto val = heartbeat.Get();
if (val)
lv_label_set_text_fmt(heartbeatValue, "%d", val);
else
lv_label_set_text_static(heartbeatValue, "...");
} else {
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B));
lv_label_set_text_static(heartbeatValue, "");

View file

@ -162,7 +162,11 @@ void WatchFaceDigital::Refresh() {
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
if (heartbeatRunning.Get()) {
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B));
lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
auto val = heartbeat.Get();
if (val)
lv_label_set_text_fmt(heartbeatValue, "%d", val);
else
lv_label_set_text_static(heartbeatValue, "...");
} else {
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B));
lv_label_set_text_static(heartbeatValue, "");

View file

@ -146,9 +146,13 @@ void WatchFaceTerminal::Refresh() {
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
if (heartbeatRunning.Get()) {
lv_label_set_text_fmt(heartbeatValue, R_LTGREY("puls=")"#ee3311 %d bpm#", heartbeat.Get());
auto val = heartbeat.Get();
if (val)
lv_label_set_text_fmt(heartbeatValue, R_LTGREY("puls=")"#ee3311 %d bpm#", val);
else
lv_label_set_text_static(heartbeatValue, R_LTGREY("puls=")"#ee3311 ...#");
} else {
lv_label_set_text_static(heartbeatValue, R_LTGREY("puls=")"#ee3311 ---#");
lv_label_set_text_static(heartbeatValue, R_LTGREY("puls=---"));
}
}