handle switch to secondary face in default handler

This commit is contained in:
joeycastillo 2023-01-15 09:28:41 -06:00
parent 0ef80b62da
commit 9d47eb9a11

View File

@ -229,7 +229,11 @@ bool movement_default_loop_handler(movement_event_t event, movement_settings_t *
movement_illuminate_led();
break;
case EVENT_MODE_LONG_PRESS:
movement_move_to_face(0);
if (MOVEMENT_SECONDARY_FACE_INDEX && movement_state.current_watch_face == 0) {
movement_move_to_face(MOVEMENT_SECONDARY_FACE_INDEX);
} else {
movement_move_to_face(0);
}
break;
default:
break;
@ -468,20 +472,6 @@ bool app_loop(void) {
if (event.event_type) {
event.subsecond = movement_state.subsecond;
can_sleep = watch_faces[movement_state.current_watch_face].loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_watch_face]);
// Long-pressing MODE brings one back to the first face, provided that the watch face hasn't decided to send them elsewhere
// (and we're not currently on the first face). If we're currently on the first face, a long press
// of MODE sends us to the secondary faces (if defined).
// Note that it's the face's responsibility to provide some way to get to the next face, so if EVENT_MODE_BUTTON_* is
// used for face functionality EVENT_MODE_LONG_PRESS should probably be handled and next_face() triggered in the face
// (which would effectively disable the normal 'long press to face 0' behaviour).
if (event.event_type == EVENT_MODE_LONG_PRESS
&& !movement_state.watch_face_changed) {
if (MOVEMENT_SECONDARY_FACE_INDEX && movement_state.current_watch_face == 0) {
movement_move_to_face(MOVEMENT_SECONDARY_FACE_INDEX);
}
}
event.event_type = EVENT_NONE;
}
// if we have timed out of our timeout countdown, give the app a hint that they can resign.