Return to clock mode on inactivity timeout in settings
_settings_loop() never handled EVENT_TIMEOUT, so leaving the watch face parked in settings mode (4Hz tick, blinking abbreviation) with no button presses meant it stayed there indefinitely instead of returning to the clock display like every other face's settings mode does on timeout. Factor the existing EVENT_MODE_BUTTON_UP transition logic into _exit_settings_mode() and reuse it for EVENT_TIMEOUT.
This commit is contained in:
@@ -321,6 +321,21 @@ static bool _clock_loop(movement_event_t event, world_clock2_state_t *state)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Leave settings mode and return to the clock display */
|
||||||
|
static void _exit_settings_mode(movement_event_t event, world_clock2_state_t *state)
|
||||||
|
{
|
||||||
|
/* Find next selected zone */
|
||||||
|
if (!state->zones[state->current_zone].selected)
|
||||||
|
state->current_zone = _next_selected_zone(state, FORWARD);
|
||||||
|
|
||||||
|
/* Switch to display mode */
|
||||||
|
state->current_mode = WORLD_CLOCK2_MODE_CLOCK;
|
||||||
|
state->show_zone_name = NAME_DISPLAY_TIME;
|
||||||
|
refresh_face = true;
|
||||||
|
movement_request_tick_frequency(1);
|
||||||
|
_clock_display(event, state);
|
||||||
|
}
|
||||||
|
|
||||||
static bool _settings_loop(movement_event_t event, world_clock2_state_t *state)
|
static bool _settings_loop(movement_event_t event, world_clock2_state_t *state)
|
||||||
{
|
{
|
||||||
uint8_t zone;
|
uint8_t zone;
|
||||||
@@ -358,18 +373,12 @@ static bool _settings_loop(movement_event_t event, world_clock2_state_t *state)
|
|||||||
_settings_display(event, state);
|
_settings_display(event, state);
|
||||||
break;
|
break;
|
||||||
case EVENT_MODE_BUTTON_UP:
|
case EVENT_MODE_BUTTON_UP:
|
||||||
/* Find next selected zone */
|
_exit_settings_mode(event, state);
|
||||||
if (!state->zones[state->current_zone].selected)
|
|
||||||
state->current_zone = _next_selected_zone(state, FORWARD);
|
|
||||||
|
|
||||||
/* Switch to display mode */
|
|
||||||
state->current_mode = WORLD_CLOCK2_MODE_CLOCK;
|
|
||||||
state->show_zone_name = NAME_DISPLAY_TIME;
|
|
||||||
refresh_face = true;
|
|
||||||
movement_request_tick_frequency(1);
|
|
||||||
_clock_display(event, state);
|
|
||||||
_beep(BEEP_BUTTON);
|
_beep(BEEP_BUTTON);
|
||||||
break;
|
break;
|
||||||
|
case EVENT_TIMEOUT:
|
||||||
|
_exit_settings_mode(event, state);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return movement_default_loop_handler(event);
|
return movement_default_loop_handler(event);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user