Added Seconds to Horizon Watch face

This commit is contained in:
locker98 2024-05-09 15:27:13 -04:00
parent dfcfe0e4cb
commit 0466356a5e

View File

@ -57,14 +57,14 @@ WatchFaceHorizon::WatchFaceHorizon(Controllers::DateTime& dateTimeController,
lv_line_set_points(lineBatteryFg, lineBatteryFgPoints, 2);
// Hour indicator lines at bottom
for (int i = 0; i < 24; i++) {
for (int i = 0; i < 60; i++) {
hourLines[i] = lv_line_create(lv_scr_act(), nullptr);
lv_style_init(&hourLineStyles[i]);
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_obj_add_style(hourLines[i], LV_LINE_PART_MAIN, &hourLineStyles[i]);
hourLinePoints[i][0] = {static_cast<lv_coord_t>(i * 10), 237};
hourLinePoints[i][1] = {static_cast<lv_coord_t>((i + 1) * 10), 237};
hourLinePoints[i][0] = {static_cast<lv_coord_t>(i * 4), 237};
hourLinePoints[i][1] = {static_cast<lv_coord_t>((i + 1) * 4), 237};
lv_line_set_points(hourLines[i], hourLinePoints[i], 2);
}
@ -127,7 +127,7 @@ WatchFaceHorizon::~WatchFaceHorizon() {
lv_style_reset(&lineBatteryFgStyle);
lv_style_reset(&lineBatteryBgStyle);
for (int i = 0; i < 24; i++) {
for (int i = 0; i < 60; i++) {
lv_style_reset(&hourLineStyles[i]);
}
@ -150,6 +150,7 @@ void WatchFaceHorizon::Refresh() {
uint8_t hour = dateTimeController.Hours();
uint8_t minute = dateTimeController.Minutes();
uint8_t day = dateTimeController.Day();
uint8_t second = dateTimeController.Seconds();
char minutesChar[3];
sprintf(minutesChar, "%02d", static_cast<int>(minute));
@ -187,8 +188,8 @@ void WatchFaceHorizon::Refresh() {
lv_label_set_text_fmt(labelHourSecondDigit, "%c", hoursChar[1]);
// Update hour bar on bottom
for (int i = 0; i < 24; i++) {
if (i <= hour) {
for (int i = 0; i < 60; i++) {
if (i <= seconds) {
lv_obj_set_hidden(hourLines[i], false);
} else {
lv_obj_set_hidden(hourLines[i], true);