Fix second bar not updating every second
This commit is contained in:
parent
b87c381c98
commit
2ec3bd5441
@ -61,7 +61,7 @@ WatchFaceHorizon::WatchFaceHorizon(Controllers::DateTime& dateTimeController,
|
|||||||
hourLines[i] = lv_line_create(lv_scr_act(), nullptr);
|
hourLines[i] = lv_line_create(lv_scr_act(), nullptr);
|
||||||
lv_style_init(&hourLineStyles[i]);
|
lv_style_init(&hourLineStyles[i]);
|
||||||
lv_style_set_line_width(&hourLineStyles[i], LV_STATE_DEFAULT, 5);
|
lv_style_set_line_width(&hourLineStyles[i], LV_STATE_DEFAULT, 5);
|
||||||
lv_style_set_line_color(&hourLineStyles[i], LV_STATE_DEFAULT, lv_color_hex(hourlyColors[i]));
|
lv_style_set_line_color(&hourLineStyles[i], LV_STATE_DEFAULT, lv_color_hex(hourlyColors[static_cast<int>(floor(i/2.5))]));
|
||||||
lv_obj_add_style(hourLines[i], LV_LINE_PART_MAIN, &hourLineStyles[i]);
|
lv_obj_add_style(hourLines[i], LV_LINE_PART_MAIN, &hourLineStyles[i]);
|
||||||
hourLinePoints[i][0] = {static_cast<lv_coord_t>(i * 4), 237};
|
hourLinePoints[i][0] = {static_cast<lv_coord_t>(i * 4), 237};
|
||||||
hourLinePoints[i][1] = {static_cast<lv_coord_t>((i + 1) * 4), 237};
|
hourLinePoints[i][1] = {static_cast<lv_coord_t>((i + 1) * 4), 237};
|
||||||
@ -173,6 +173,15 @@ void WatchFaceHorizon::Refresh() {
|
|||||||
}
|
}
|
||||||
sprintf(hoursChar, "%02d", displayHour);
|
sprintf(hoursChar, "%02d", displayHour);
|
||||||
|
|
||||||
|
// Update hour bar on bottom
|
||||||
|
for (int i = 0; i < 60; i++) {
|
||||||
|
if (i <= second) {
|
||||||
|
lv_obj_set_hidden(hourLines[i], false);
|
||||||
|
} else {
|
||||||
|
lv_obj_set_hidden(hourLines[i], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hour has updated
|
// Hour has updated
|
||||||
if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1]) {
|
if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1]) {
|
||||||
displayedChar[0] = hoursChar[0];
|
displayedChar[0] = hoursChar[0];
|
||||||
@ -187,14 +196,7 @@ void WatchFaceHorizon::Refresh() {
|
|||||||
lv_label_set_text_fmt(labelHourFirstDigit, "%c", hoursChar[0]);
|
lv_label_set_text_fmt(labelHourFirstDigit, "%c", hoursChar[0]);
|
||||||
lv_label_set_text_fmt(labelHourSecondDigit, "%c", hoursChar[1]);
|
lv_label_set_text_fmt(labelHourSecondDigit, "%c", hoursChar[1]);
|
||||||
|
|
||||||
// Update hour bar on bottom
|
|
||||||
for (int i = 0; i < 60; i++) {
|
|
||||||
if (i <= second) {
|
|
||||||
lv_obj_set_hidden(hourLines[i], false);
|
|
||||||
} else {
|
|
||||||
lv_obj_set_hidden(hourLines[i], true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minutes have updated
|
// Minutes have updated
|
||||||
|
Loading…
Reference in New Issue
Block a user