mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 19:20:30 +08:00
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:
commit
4d6a9345f2
|
@ -60,9 +60,10 @@ typedef union {
|
||||||
// time-oriented complication like a sunrise/sunset timer, and a simple locale preference could tell an
|
// time-oriented complication like a sunrise/sunset timer, and a simple locale preference could tell an
|
||||||
// altimeter to display feet or meters as easily as it tells a thermometer to display degrees in F or C.
|
// altimeter to display feet or meters as easily as it tells a thermometer to display degrees in F or C.
|
||||||
bool clock_mode_24h : 1; // indicates whether clock should use 12 or 24 hour mode.
|
bool clock_mode_24h : 1; // indicates whether clock should use 12 or 24 hour mode.
|
||||||
|
bool clock_24h_leading_zero : 1; // indicates whether clock should leading zero to indicate 24 hour mode.
|
||||||
bool use_imperial_units : 1; // indicates whether to use metric units (the default) or imperial.
|
bool use_imperial_units : 1; // indicates whether to use metric units (the default) or imperial.
|
||||||
bool alarm_enabled : 1; // indicates whether there is at least one alarm enabled.
|
bool alarm_enabled : 1; // indicates whether there is at least one alarm enabled.
|
||||||
uint8_t reserved : 6; // room for more preferences if needed.
|
uint8_t reserved : 5; // room for more preferences if needed.
|
||||||
} bit;
|
} bit;
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
} movement_settings_t;
|
} movement_settings_t;
|
||||||
|
|
|
@ -124,13 +124,13 @@ static void clock_toggle_time_signal(clock_state_t *clock) {
|
||||||
clock_indicate_time_signal(clock);
|
clock_indicate_time_signal(clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clock_display_all(watch_date_time date_time) {
|
static void clock_display_all(watch_date_time date_time, bool leading_zero) {
|
||||||
char buf[10 + 1];
|
char buf[10 + 1];
|
||||||
|
|
||||||
snprintf(
|
snprintf(
|
||||||
buf,
|
buf,
|
||||||
sizeof(buf),
|
sizeof(buf),
|
||||||
"%s%2d%2d%02d%02d",
|
leading_zero? "%s%02d%02d%02d%02d" : "%s%2d%2d%02d%02d",
|
||||||
watch_utility_get_weekday(date_time),
|
watch_utility_get_weekday(date_time),
|
||||||
date_time.unit.day,
|
date_time.unit.day,
|
||||||
date_time.unit.hour,
|
date_time.unit.hour,
|
||||||
|
@ -180,7 +180,7 @@ static void clock_display_clock(movement_settings_t *settings, clock_state_t *cl
|
||||||
clock_indicate_pm(settings, current);
|
clock_indicate_pm(settings, current);
|
||||||
current = clock_24h_to_12h(current);
|
current = clock_24h_to_12h(current);
|
||||||
}
|
}
|
||||||
clock_display_all(current);
|
clock_display_all(current, settings->bit.clock_24h_leading_zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ void repetition_minute_face_activate(movement_settings_t *settings, void *contex
|
||||||
|
|
||||||
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||||
|
|
||||||
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
// handle chime indicator
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
||||||
|
@ -112,6 +112,7 @@ bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *se
|
||||||
// ...and set the LAP indicator if low.
|
// ...and set the LAP indicator if low.
|
||||||
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
||||||
|
|
||||||
|
bool set_leading_zero = false;
|
||||||
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
||||||
// everything before seconds is the same, don't waste cycles setting those segments.
|
// everything before seconds is the same, don't waste cycles setting those segments.
|
||||||
watch_display_character_lp_seconds('0' + date_time.unit.second / 10, 8);
|
watch_display_character_lp_seconds('0' + date_time.unit.second / 10, 8);
|
||||||
|
@ -132,6 +133,8 @@ bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *se
|
||||||
}
|
}
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||||
|
} else if (settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
||||||
|
@ -142,6 +145,8 @@ bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *se
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watch_display_string(buf, pos);
|
watch_display_string(buf, pos);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
// handle alarm indicator
|
// handle alarm indicator
|
||||||
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -60,7 +60,7 @@ void simple_clock_bin_led_face_activate(movement_settings_t *settings, void *con
|
||||||
|
|
||||||
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||||
|
|
||||||
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
// handle chime indicator
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
||||||
|
@ -138,6 +138,7 @@ bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t
|
||||||
// ...and set the LAP indicator if low.
|
// ...and set the LAP indicator if low.
|
||||||
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
||||||
|
|
||||||
|
bool set_leading_zero = false;
|
||||||
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
||||||
// everything before seconds is the same, don't waste cycles setting those segments.
|
// everything before seconds is the same, don't waste cycles setting those segments.
|
||||||
watch_display_character_lp_seconds('0' + date_time.unit.second / 10, 8);
|
watch_display_character_lp_seconds('0' + date_time.unit.second / 10, 8);
|
||||||
|
@ -158,6 +159,8 @@ bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t
|
||||||
}
|
}
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||||
|
} else if (settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
||||||
|
@ -168,6 +171,8 @@ bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watch_display_string(buf, pos);
|
watch_display_string(buf, pos);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
// handle alarm indicator
|
// handle alarm indicator
|
||||||
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
|
||||||
// ...and set the LAP indicator if low.
|
// ...and set the LAP indicator if low.
|
||||||
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
||||||
|
|
||||||
|
bool set_leading_zero = false;
|
||||||
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
||||||
// everything before seconds is the same, don't waste cycles setting those segments.
|
// everything before seconds is the same, don't waste cycles setting those segments.
|
||||||
watch_display_character_lp_seconds('0' + date_time.unit.second / 10, 8);
|
watch_display_character_lp_seconds('0' + date_time.unit.second / 10, 8);
|
||||||
|
@ -122,6 +123,11 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
|
||||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
||||||
if (!watch_tick_animation_is_running()) watch_start_tick_animation(500);
|
if (!watch_tick_animation_is_running()) watch_start_tick_animation(500);
|
||||||
|
@ -131,6 +137,8 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watch_display_string(buf, pos);
|
watch_display_string(buf, pos);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
// handle alarm indicator
|
// handle alarm indicator
|
||||||
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -50,7 +50,7 @@ void weeknumber_clock_face_activate(movement_settings_t *settings, void *context
|
||||||
|
|
||||||
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||||
|
|
||||||
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
// handle chime indicator
|
// handle chime indicator
|
||||||
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL);
|
||||||
|
@ -94,6 +94,7 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
|
||||||
// ...and set the LAP indicator if low.
|
// ...and set the LAP indicator if low.
|
||||||
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
if (state->battery_low) watch_set_indicator(WATCH_INDICATOR_LAP);
|
||||||
|
|
||||||
|
bool set_leading_zero = false;
|
||||||
if ((date_time.reg >> 12) == (previous_date_time >> 12) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
if ((date_time.reg >> 12) == (previous_date_time >> 12) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
||||||
// everything before minutes is the same.
|
// everything before minutes is the same.
|
||||||
pos = 6;
|
pos = 6;
|
||||||
|
@ -109,6 +110,8 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
|
||||||
}
|
}
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||||
|
} else if (settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
||||||
|
@ -119,6 +122,8 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watch_display_string(buf, pos);
|
watch_display_string(buf, pos);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
// handle alarm indicator
|
// handle alarm indicator
|
||||||
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -174,7 +174,7 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
|
||||||
if (refresh_face) {
|
if (refresh_face) {
|
||||||
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h)
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero)
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
state->previous_date_time = REFRESH_TIME;
|
state->previous_date_time = REFRESH_TIME;
|
||||||
|
@ -188,6 +188,7 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
|
||||||
previous_date_time = state->previous_date_time;
|
previous_date_time = state->previous_date_time;
|
||||||
state->previous_date_time = date_time.reg;
|
state->previous_date_time = date_time.reg;
|
||||||
|
|
||||||
|
bool set_leading_zero = false;
|
||||||
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
||||||
/* Everything before seconds is the same, don't waste cycles setting those segments. */
|
/* Everything before seconds is the same, don't waste cycles setting those segments. */
|
||||||
pos = 8;
|
pos = 8;
|
||||||
|
@ -208,7 +209,9 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0)
|
if (date_time.unit.hour == 0)
|
||||||
date_time.unit.hour = 12;
|
date_time.unit.hour = 12;
|
||||||
}
|
} else if (settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
||||||
|
@ -230,6 +233,8 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watch_display_string(buf, pos);
|
watch_display_string(buf, pos);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_BUTTON_UP:
|
case EVENT_ALARM_BUTTON_UP:
|
||||||
state->current_zone = find_selected_zone(state, FORWARD);
|
state->current_zone = find_selected_zone(state, FORWARD);
|
||||||
|
|
|
@ -60,7 +60,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
|
||||||
watch_date_time date_time;
|
watch_date_time date_time;
|
||||||
switch (event.event_type) {
|
switch (event.event_type) {
|
||||||
case EVENT_ACTIVATE:
|
case EVENT_ACTIVATE:
|
||||||
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
state->previous_date_time = 0xFFFFFFFF;
|
state->previous_date_time = 0xFFFFFFFF;
|
||||||
// fall through
|
// fall through
|
||||||
|
@ -72,6 +72,7 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
|
||||||
previous_date_time = state->previous_date_time;
|
previous_date_time = state->previous_date_time;
|
||||||
state->previous_date_time = date_time.reg;
|
state->previous_date_time = date_time.reg;
|
||||||
|
|
||||||
|
bool set_leading_zero = false;
|
||||||
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
if ((date_time.reg >> 6) == (previous_date_time >> 6) && event.event_type != EVENT_LOW_ENERGY_UPDATE) {
|
||||||
// everything before seconds is the same, don't waste cycles setting those segments.
|
// everything before seconds is the same, don't waste cycles setting those segments.
|
||||||
pos = 8;
|
pos = 8;
|
||||||
|
@ -91,6 +92,8 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
|
||||||
}
|
}
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||||
|
} else if (settings->bit.clock_24h_leading_zero && date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
if (event.event_type == EVENT_LOW_ENERGY_UPDATE) {
|
||||||
|
@ -112,6 +115,8 @@ static bool world_clock_face_do_display_mode(movement_event_t event, movement_se
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watch_display_string(buf, pos);
|
watch_display_string(buf, pos);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_LONG_PRESS:
|
case EVENT_ALARM_LONG_PRESS:
|
||||||
movement_request_tick_frequency(4);
|
movement_request_tick_frequency(4);
|
||||||
|
|
|
@ -293,6 +293,7 @@ static void _activity_update_logging_screen(movement_settings_t *settings, activ
|
||||||
}
|
}
|
||||||
// Briefly, show time without seconds
|
// Briefly, show time without seconds
|
||||||
else {
|
else {
|
||||||
|
bool set_leading_zero = false;
|
||||||
watch_clear_indicator(WATCH_INDICATOR_LAP);
|
watch_clear_indicator(WATCH_INDICATOR_LAP);
|
||||||
watch_date_time now = watch_rtc_get_date_time();
|
watch_date_time now = watch_rtc_get_date_time();
|
||||||
uint8_t hour = now.unit.hour;
|
uint8_t hour = now.unit.hour;
|
||||||
|
@ -304,14 +305,18 @@ static void _activity_update_logging_screen(movement_settings_t *settings, activ
|
||||||
watch_set_indicator(WATCH_INDICATOR_PM);
|
watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
hour %= 12;
|
hour %= 12;
|
||||||
if (hour == 0) hour = 12;
|
if (hour == 0) hour = 12;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
|
if (!settings->bit.clock_24h_leading_zero)
|
||||||
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
else if (hour < 10)
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
sprintf(activity_buf, "%2d%02d ", hour, now.unit.minute);
|
sprintf(activity_buf, "%2d%02d ", hour, now.unit.minute);
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
watch_display_string(activity_buf, 4);
|
watch_display_string(activity_buf, 4);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
i = state->alarm[state->alarm_idx].day + 1;
|
||||||
}
|
}
|
||||||
//handle am/pm for hour display
|
//handle am/pm for hour display
|
||||||
|
bool set_leading_zero = false;
|
||||||
uint8_t h = state->alarm[state->alarm_idx].hour;
|
uint8_t h = state->alarm[state->alarm_idx].hour;
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!settings->bit.clock_mode_24h) {
|
||||||
if (h >= 12) {
|
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);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
}
|
}
|
||||||
if (h == 0) h = 12;
|
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 ",
|
sprintf(buf, "%c%c%2d%2d%02d ",
|
||||||
_dow_strings[i][0], _dow_strings[i][1],
|
_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]] = ' ';
|
buf[_blink_idx[state->setting_state]] = buf[_blink_idx2[state->setting_state]] = ' ';
|
||||||
}
|
}
|
||||||
watch_display_string(buf, 0);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
|
|
||||||
if (state->is_setting) {
|
if (state->is_setting) {
|
||||||
// draw pitch level indicator
|
// draw pitch level indicator
|
||||||
|
|
|
@ -228,6 +228,7 @@ static void _planetary_hours(movement_settings_t *settings, planetary_hours_stat
|
||||||
uint8_t weekday, planet, planetary_hour;
|
uint8_t weekday, planet, planetary_hour;
|
||||||
uint32_t current_hour_epoch;
|
uint32_t current_hour_epoch;
|
||||||
watch_date_time scratch_time;
|
watch_date_time scratch_time;
|
||||||
|
bool set_leading_zero = false;
|
||||||
|
|
||||||
// check if we have a location. If not, display error
|
// check if we have a location. If not, display error
|
||||||
if ( state->no_location ) {
|
if ( state->no_location ) {
|
||||||
|
@ -253,7 +254,7 @@ static void _planetary_hours(movement_settings_t *settings, planetary_hours_stat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
// roll over hour iterator
|
// roll over hour iterator
|
||||||
if ( state->hour < 0 ) state->hour = 23;
|
if ( state->hour < 0 ) state->hour = 23;
|
||||||
|
@ -313,6 +314,8 @@ static void _planetary_hours(movement_settings_t *settings, planetary_hours_stat
|
||||||
}
|
}
|
||||||
scratch_time.unit.hour %= 12;
|
scratch_time.unit.hour %= 12;
|
||||||
if (scratch_time.unit.hour == 0) scratch_time.unit.hour = 12;
|
if (scratch_time.unit.hour == 0) scratch_time.unit.hour = 12;
|
||||||
|
} else if (settings->bit.clock_24h_leading_zero && scratch_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// planetary ruler of the hour
|
// planetary ruler of the hour
|
||||||
|
@ -328,6 +331,8 @@ static void _planetary_hours(movement_settings_t *settings, planetary_hours_stat
|
||||||
|
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
watch_display_string(buf, 0);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
|
|
||||||
if ( state->ruler == 2 ) _planetary_icon(planet);
|
if ( state->ruler == 2 ) _planetary_icon(planet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,6 +206,7 @@ static void _planetary_time(movement_event_t event, movement_settings_t *setting
|
||||||
double night_hour_count = 0.0;
|
double night_hour_count = 0.0;
|
||||||
uint8_t weekday, planet, planetary_hour;
|
uint8_t weekday, planet, planetary_hour;
|
||||||
double hour_duration, current_hour, current_minute, current_second;
|
double hour_duration, current_hour, current_minute, current_second;
|
||||||
|
bool set_leading_zero = false;
|
||||||
|
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
|
|
||||||
|
@ -218,7 +219,7 @@ static void _planetary_time(movement_event_t event, movement_settings_t *setting
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
// PM for night hours, otherwise the night hours are counted from 13
|
// PM for night hours, otherwise the night hours are counted from 13
|
||||||
if ( state->night ) {
|
if ( state->night ) {
|
||||||
|
@ -246,6 +247,9 @@ static void _planetary_time(movement_event_t event, movement_settings_t *setting
|
||||||
state->scratch.unit.minute = floor(current_minute);
|
state->scratch.unit.minute = floor(current_minute);
|
||||||
state->scratch.unit.second = (uint8_t)floor(current_second) % 60;
|
state->scratch.unit.second = (uint8_t)floor(current_second) % 60;
|
||||||
|
|
||||||
|
if (settings->bit.clock_mode_24h && settings->bit.clock_24h_leading_zero && state->scratch.unit.hour < 10)
|
||||||
|
set_leading_zero = true;
|
||||||
|
|
||||||
// what weekday is it (0 - 6)
|
// what weekday is it (0 - 6)
|
||||||
weekday = watch_utility_get_iso8601_weekday_number(state->scratch.unit.year, state->scratch.unit.month, state->scratch.unit.day) - 1;
|
weekday = watch_utility_get_iso8601_weekday_number(state->scratch.unit.year, state->scratch.unit.month, state->scratch.unit.day) - 1;
|
||||||
|
|
||||||
|
@ -263,6 +267,8 @@ static void _planetary_time(movement_event_t event, movement_settings_t *setting
|
||||||
else sprintf(buf, "%s h%2d%02d%02d", ruler, state->scratch.unit.hour, state->scratch.unit.minute, state->scratch.unit.second);
|
else sprintf(buf, "%s h%2d%02d%02d", ruler, state->scratch.unit.hour, state->scratch.unit.minute, state->scratch.unit.second);
|
||||||
|
|
||||||
watch_display_string(buf, 0);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
|
|
||||||
if ( state->ruler == 2 ) _planetary_icon(planet);
|
if ( state->ruler == 2 ) _planetary_icon(planet);
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
if (settings->bit.clock_mode_24h && !settings->bit.clock_24h_leading_zero) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
|
||||||
rise += hours_from_utc;
|
rise += hours_from_utc;
|
||||||
set += hours_from_utc;
|
set += hours_from_utc;
|
||||||
|
@ -113,12 +113,17 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
||||||
|
|
||||||
if (date_time.reg < scratch_time.reg || show_next_match) {
|
if (date_time.reg < scratch_time.reg || show_next_match) {
|
||||||
if (state->rise_index == 0 || show_next_match) {
|
if (state->rise_index == 0 || show_next_match) {
|
||||||
|
bool set_leading_zero = false;
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!settings->bit.clock_mode_24h) {
|
||||||
if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
|
if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
else watch_clear_indicator(WATCH_INDICATOR_PM);
|
else watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
|
} else if (settings->bit.clock_24h_leading_zero && scratch_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
sprintf(buf, "rI%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
|
sprintf(buf, "rI%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
|
||||||
watch_display_string(buf, 0);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
show_next_match = true;
|
show_next_match = true;
|
||||||
|
@ -140,12 +145,17 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
||||||
|
|
||||||
if (date_time.reg < scratch_time.reg || show_next_match) {
|
if (date_time.reg < scratch_time.reg || show_next_match) {
|
||||||
if (state->rise_index == 0 || show_next_match) {
|
if (state->rise_index == 0 || show_next_match) {
|
||||||
|
bool set_leading_zero = false;
|
||||||
if (!settings->bit.clock_mode_24h) {
|
if (!settings->bit.clock_mode_24h) {
|
||||||
if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
|
if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
else watch_clear_indicator(WATCH_INDICATOR_PM);
|
else watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
|
} else if (settings->bit.clock_24h_leading_zero && scratch_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
sprintf(buf, "SE%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute, longLatPresets[state->longLatToUse].name);
|
sprintf(buf, "SE%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute, longLatPresets[state->longLatToUse].name);
|
||||||
watch_display_string(buf, 0);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
show_next_match = true;
|
show_next_match = true;
|
||||||
|
|
|
@ -38,12 +38,15 @@ void _wake_face_update_display(movement_settings_t *settings, wake_face_state_t
|
||||||
uint8_t hour = state->hour;
|
uint8_t hour = state->hour;
|
||||||
|
|
||||||
watch_clear_display();
|
watch_clear_display();
|
||||||
if ( settings->bit.clock_mode_24h )
|
bool set_leading_zero = false;
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
if ( !settings->bit.clock_mode_24h ) {
|
||||||
else {
|
|
||||||
if ( hour >= 12 )
|
if ( hour >= 12 )
|
||||||
watch_set_indicator(WATCH_INDICATOR_PM);
|
watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
hour = hour % 12 ? hour % 12 : 12;
|
hour = hour % 12 ? hour % 12 : 12;
|
||||||
|
} else if ( !settings->bit.clock_24h_leading_zero ) {
|
||||||
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
} else if ( hour < 10 ) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( state->mode )
|
if ( state->mode )
|
||||||
|
@ -54,6 +57,8 @@ void _wake_face_update_display(movement_settings_t *settings, wake_face_state_t
|
||||||
|
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
watch_display_string(lcdbuf, 0);
|
watch_display_string(lcdbuf, 0);
|
||||||
|
if ( set_leading_zero )
|
||||||
|
watch_display_string("0", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -41,6 +41,7 @@ static void _lis2dw_logging_face_update_display(movement_settings_t *settings, l
|
||||||
char time_indication_character;
|
char time_indication_character;
|
||||||
int8_t pos;
|
int8_t pos;
|
||||||
watch_date_time date_time;
|
watch_date_time date_time;
|
||||||
|
bool set_leading_zero = false;
|
||||||
|
|
||||||
if (logger_state->log_ticks) {
|
if (logger_state->log_ticks) {
|
||||||
pos = (logger_state->data_points - 1 - logger_state->display_index) % LIS2DW_LOGGING_NUM_DATA_POINTS;
|
pos = (logger_state->data_points - 1 - logger_state->display_index) % LIS2DW_LOGGING_NUM_DATA_POINTS;
|
||||||
|
@ -50,12 +51,14 @@ static void _lis2dw_logging_face_update_display(movement_settings_t *settings, l
|
||||||
} else {
|
} else {
|
||||||
date_time = logger_state->data[pos].timestamp;
|
date_time = logger_state->data[pos].timestamp;
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) {
|
if (!settings->bit.clock_mode_24h) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
|
||||||
} else {
|
|
||||||
if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM);
|
if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||||
|
} else if (!settings->bit.clock_24h_leading_zero) {
|
||||||
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
} else if (date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
switch (logger_state->axis_index) {
|
switch (logger_state->axis_index) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -89,6 +92,8 @@ static void _lis2dw_logging_face_update_display(movement_settings_t *settings, l
|
||||||
logger_state->interrupts[2]);
|
logger_state->interrupts[2]);
|
||||||
}
|
}
|
||||||
watch_display_string(buf, 0);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _lis2dw_logging_face_log_data(lis2dw_logger_state_t *logger_state) {
|
static void _lis2dw_logging_face_log_data(lis2dw_logger_state_t *logger_state) {
|
||||||
|
|
|
@ -40,9 +40,10 @@ static void _thermistor_logging_face_log_data(thermistor_logger_state_t *logger_
|
||||||
thermistor_driver_disable();
|
thermistor_driver_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _thermistor_logging_face_update_display(thermistor_logger_state_t *logger_state, bool in_fahrenheit, bool clock_mode_24h) {
|
static void _thermistor_logging_face_update_display(thermistor_logger_state_t *logger_state, bool in_fahrenheit, bool clock_mode_24h, bool clock_24h_leading_zero) {
|
||||||
int8_t pos = (logger_state->data_points - 1 - logger_state->display_index) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
|
int8_t pos = (logger_state->data_points - 1 - logger_state->display_index) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
|
||||||
char buf[14];
|
char buf[14];
|
||||||
|
bool set_leading_zero = false;
|
||||||
|
|
||||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||||
|
@ -53,12 +54,14 @@ static void _thermistor_logging_face_update_display(thermistor_logger_state_t *l
|
||||||
} else if (logger_state->ts_ticks) {
|
} else if (logger_state->ts_ticks) {
|
||||||
watch_date_time date_time = logger_state->data[pos].timestamp;
|
watch_date_time date_time = logger_state->data[pos].timestamp;
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (clock_mode_24h) {
|
if (!clock_mode_24h) {
|
||||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
|
||||||
} else {
|
|
||||||
if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM);
|
if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
date_time.unit.hour %= 12;
|
date_time.unit.hour %= 12;
|
||||||
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
if (date_time.unit.hour == 0) date_time.unit.hour = 12;
|
||||||
|
} else if (!clock_24h_leading_zero) {
|
||||||
|
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
} else if (date_time.unit.hour < 10) {
|
||||||
|
set_leading_zero = true;
|
||||||
}
|
}
|
||||||
sprintf(buf, "AT%2d%2d%02d%02d", date_time.unit.day, date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
sprintf(buf, "AT%2d%2d%02d%02d", date_time.unit.day, date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,6 +73,8 @@ static void _thermistor_logging_face_update_display(thermistor_logger_state_t *l
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_display_string(buf, 0);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void thermistor_logging_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
void thermistor_logging_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||||
|
@ -100,18 +105,18 @@ bool thermistor_logging_face_loop(movement_event_t event, movement_settings_t *s
|
||||||
break;
|
break;
|
||||||
case EVENT_LIGHT_BUTTON_DOWN:
|
case EVENT_LIGHT_BUTTON_DOWN:
|
||||||
logger_state->ts_ticks = 2;
|
logger_state->ts_ticks = 2;
|
||||||
_thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h);
|
_thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h, settings->bit.clock_24h_leading_zero);
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_BUTTON_DOWN:
|
case EVENT_ALARM_BUTTON_DOWN:
|
||||||
logger_state->display_index = (logger_state->display_index + 1) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
|
logger_state->display_index = (logger_state->display_index + 1) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
|
||||||
logger_state->ts_ticks = 0;
|
logger_state->ts_ticks = 0;
|
||||||
// fall through
|
// fall through
|
||||||
case EVENT_ACTIVATE:
|
case EVENT_ACTIVATE:
|
||||||
_thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h);
|
_thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h, settings->bit.clock_24h_leading_zero);
|
||||||
break;
|
break;
|
||||||
case EVENT_TICK:
|
case EVENT_TICK:
|
||||||
if (logger_state->ts_ticks && --logger_state->ts_ticks == 0) {
|
if (logger_state->ts_ticks && --logger_state->ts_ticks == 0) {
|
||||||
_thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h);
|
_thermistor_logging_face_update_display(logger_state, settings->bit.use_imperial_units, settings->bit.clock_mode_24h, settings->bit.clock_24h_leading_zero);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_BACKGROUND_TASK:
|
case EVENT_BACKGROUND_TASK:
|
||||||
|
|
|
@ -93,6 +93,14 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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:
|
case EVENT_TIMEOUT:
|
||||||
movement_move_to_face(0);
|
movement_move_to_face(0);
|
||||||
break;
|
break;
|
||||||
|
@ -109,8 +117,10 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||||
char buf[8];
|
char buf[8];
|
||||||
switch (current_page) {
|
switch (current_page) {
|
||||||
case 0:
|
case 0:
|
||||||
if (settings->bit.clock_mode_24h) watch_display_string("24h", 4);
|
if (settings->bit.clock_mode_24h) {
|
||||||
else watch_display_string("12h", 4);
|
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;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (settings->bit.button_should_sound) watch_display_string("y", 9);
|
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];
|
char buf[11];
|
||||||
|
bool set_leading_zero = false;
|
||||||
if (current_page < 3) {
|
if (current_page < 3) {
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) {
|
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);
|
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 {
|
} 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);
|
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);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,10 +189,14 @@ bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *s
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[11];
|
char buf[11];
|
||||||
|
bool set_leading_zero = false;
|
||||||
if (current_page < 3) {
|
if (current_page < 3) {
|
||||||
watch_set_colon();
|
watch_set_colon();
|
||||||
if (settings->bit.clock_mode_24h) {
|
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,
|
sprintf(buf,
|
||||||
"%s %2d%02d%02d",
|
"%s %2d%02d%02d",
|
||||||
set_time_hackwatch_face_titles[current_page],
|
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);
|
watch_display_string(buf, 0);
|
||||||
|
if (set_leading_zero)
|
||||||
|
watch_display_string("0", 4);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue