Merge PR #299 - leading zero representation
Adds a movement-wide leading zero 024h representation mode that's toggleable in the preferences watch face. Also adds support for the new display mode to existing faces. I modified the logic a bit to ensure the 24h indicator remains lit in the simple clock face even when in 024h mode. I also added support to the more advanced clock face. In the future I will add a compile time toggle to it as well. Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/299
This commit is contained in:
@@ -72,6 +72,7 @@ static void _alarm_face_draw(movement_settings_t *settings, alarm_state_t *state
|
||||
i = state->alarm[state->alarm_idx].day + 1;
|
||||
}
|
||||
//handle am/pm for hour display
|
||||
bool set_leading_zero = false;
|
||||
uint8_t h = state->alarm[state->alarm_idx].hour;
|
||||
if (!settings->bit.clock_mode_24h) {
|
||||
if (h >= 12) {
|
||||
@@ -81,6 +82,10 @@ static void _alarm_face_draw(movement_settings_t *settings, alarm_state_t *state
|
||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
}
|
||||
if (h == 0) h = 12;
|
||||
} else if (!settings->bit.clock_24h_leading_zero) {
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
} else if (h < 10) {
|
||||
set_leading_zero = true;
|
||||
}
|
||||
sprintf(buf, "%c%c%2d%2d%02d ",
|
||||
_dow_strings[i][0], _dow_strings[i][1],
|
||||
@@ -92,6 +97,8 @@ static void _alarm_face_draw(movement_settings_t *settings, alarm_state_t *state
|
||||
buf[_blink_idx[state->setting_state]] = buf[_blink_idx2[state->setting_state]] = ' ';
|
||||
}
|
||||
watch_display_string(buf, 0);
|
||||
if (set_leading_zero)
|
||||
watch_display_string("0", 4);
|
||||
|
||||
if (state->is_setting) {
|
||||
// draw pitch level indicator
|
||||
|
||||
Reference in New Issue
Block a user