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:
@@ -93,6 +93,14 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EVENT_ALARM_LONG_PRESS:
|
||||
switch (current_page) {
|
||||
case 0:
|
||||
if (settings->bit.clock_mode_24h)
|
||||
settings->bit.clock_24h_leading_zero = !(settings->bit.clock_24h_leading_zero);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EVENT_TIMEOUT:
|
||||
movement_move_to_face(0);
|
||||
break;
|
||||
@@ -109,8 +117,10 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||
char buf[8];
|
||||
switch (current_page) {
|
||||
case 0:
|
||||
if (settings->bit.clock_mode_24h) watch_display_string("24h", 4);
|
||||
else watch_display_string("12h", 4);
|
||||
if (settings->bit.clock_mode_24h) {
|
||||
if (settings->bit.clock_24h_leading_zero) watch_display_string("024h", 4);
|
||||
else watch_display_string("24h", 4);
|
||||
} else watch_display_string("12h", 4);
|
||||
break;
|
||||
case 1:
|
||||
if (settings->bit.button_should_sound) watch_display_string("y", 9);
|
||||
|
||||
@@ -126,10 +126,14 @@ bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, v
|
||||
}
|
||||
|
||||
char buf[11];
|
||||
bool set_leading_zero = false;
|
||||
if (current_page < 3) {
|
||||
watch_set_colon();
|
||||
if (settings->bit.clock_mode_24h) {
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
if (!settings->bit.clock_24h_leading_zero)
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
else if (date_time.unit.hour < 10)
|
||||
set_leading_zero = true;
|
||||
sprintf(buf, "%s %2d%02d%02d", set_time_face_titles[current_page], date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
||||
} else {
|
||||
sprintf(buf, "%s %2d%02d%02d", set_time_face_titles[current_page], (date_time.unit.hour % 12) ? (date_time.unit.hour % 12) : 12, date_time.unit.minute, date_time.unit.second);
|
||||
@@ -170,6 +174,8 @@ bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, v
|
||||
}
|
||||
|
||||
watch_display_string(buf, 0);
|
||||
if (set_leading_zero)
|
||||
watch_display_string("0", 4);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,10 +189,14 @@ bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *s
|
||||
}
|
||||
|
||||
char buf[11];
|
||||
bool set_leading_zero = false;
|
||||
if (current_page < 3) {
|
||||
watch_set_colon();
|
||||
if (settings->bit.clock_mode_24h) {
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
if (!settings->bit.clock_24h_leading_zero)
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
else if (date_time_settings.unit.hour < 10)
|
||||
set_leading_zero = true;
|
||||
sprintf(buf,
|
||||
"%s %2d%02d%02d",
|
||||
set_time_hackwatch_face_titles[current_page],
|
||||
@@ -258,6 +262,8 @@ bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *s
|
||||
}
|
||||
|
||||
watch_display_string(buf, 0);
|
||||
if (set_leading_zero)
|
||||
watch_display_string("0", 4);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user