WatchFaces: Remove heart rate icon and value when heart rate is not running

Requested in issue #1165
This commit is contained in:
Ellis Judge 2023-08-14 20:05:46 +01:00
parent 782ef7902f
commit b3eb81818a
2 changed files with 8 additions and 4 deletions

View file

@ -295,9 +295,11 @@ void WatchFaceCasioStyleG7710::Refresh() {
if (heartbeatRunning.Get()) {
lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text);
lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get());
lv_obj_set_hidden(heartbeatIcon, false);
lv_obj_set_hidden(heartbeatValue, false);
} 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, "");
lv_obj_set_hidden(heartbeatIcon, true);
lv_obj_set_hidden(heartbeatValue, true);
}
lv_obj_realign(heartbeatIcon);

View file

@ -138,9 +138,11 @@ void WatchFaceDigital::Refresh() {
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());
lv_obj_set_hidden(heartbeatIcon, false);
lv_obj_set_hidden(heartbeatValue, false);
} 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, "");
lv_obj_set_hidden(heartbeatIcon, true);
lv_obj_set_hidden(heartbeatValue, true);
}
lv_obj_realign(heartbeatIcon);