From 79ff361f06e0693114a33d1613feb81d4c2ff624 Mon Sep 17 00:00:00 2001 From: James Haggerty Date: Wed, 12 Oct 2022 13:35:08 +1100 Subject: Make long press mode go back to face 0 instead of next face --- movement/movement.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'movement/movement.c') diff --git a/movement/movement.c b/movement/movement.c index d79142ec..3d8fac01 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -407,9 +407,14 @@ 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]); - // escape hatch: a watch face may not resign on EVENT_MODE_BUTTON_DOWN. In that case, a long press of MODE should let them out. - if (event.event_type == EVENT_MODE_LONG_PRESS) { - movement_move_to_next_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). + // 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.current_watch_face > 0 && movement_state.current_watch_face == movement_state.next_watch_face) { + movement_move_to_face(0); can_sleep = false; } event.event_type = EVENT_NONE; -- cgit v1.2.3 From 4de51740fb22d702610072019ee11371191c2d65 Mon Sep 17 00:00:00 2001 From: joeycastillo Date: Tue, 11 Oct 2022 23:14:59 -0500 Subject: don't sleep on watch face change --- movement/movement.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'movement/movement.c') diff --git a/movement/movement.c b/movement/movement.c index 3d8fac01..c70e1aaa 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -413,9 +413,11 @@ bool app_loop(void) { // 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.current_watch_face > 0 && movement_state.current_watch_face == movement_state.next_watch_face) { + if (event.event_type == EVENT_MODE_LONG_PRESS + && movement_state.current_watch_face > 0 + && movement_state.current_watch_face == movement_state.next_watch_face) { movement_move_to_face(0); - can_sleep = false; + movement_state.watch_face_changed = true; } event.event_type = EVENT_NONE; } @@ -481,7 +483,13 @@ bool app_loop(void) { event.subsecond = 0; - return can_sleep && (movement_state.light_ticks == -1) && !movement_state.is_buzzing; + // if the watch face changed, we can't sleep because we need to update the display. + if (movement_state.watch_face_changed) can_sleep = false; + + // if the buzzer or the LED is on, we need to stay awake to keep the TCC running. + if (movement_state.is_buzzing || movement_state.light_ticks != -1) can_sleep = false; + + return can_sleep; } static movement_event_type_t _figure_out_button_event(bool pin_level, movement_event_type_t button_down_event_type, uint8_t *down_timestamp) { -- cgit v1.2.3 From 957f97ffad0d37f028ac49e63e9536fad8f1dd69 Mon Sep 17 00:00:00 2001 From: joeycastillo Date: Tue, 11 Oct 2022 23:40:19 -0500 Subject: no need to set this (set in movement_move_to_face) --- movement/movement.c | 1 - 1 file changed, 1 deletion(-) (limited to 'movement/movement.c') diff --git a/movement/movement.c b/movement/movement.c index c70e1aaa..9409d037 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -417,7 +417,6 @@ bool app_loop(void) { && movement_state.current_watch_face > 0 && movement_state.current_watch_face == movement_state.next_watch_face) { movement_move_to_face(0); - movement_state.watch_face_changed = true; } event.event_type = EVENT_NONE; } -- cgit v1.2.3 From 1bb656db91c6b5b9bc4a5cf60c49b14d346731df Mon Sep 17 00:00:00 2001 From: joeycastillo Date: Wed, 12 Oct 2022 00:20:11 -0500 Subject: use watch_face_changed property --- movement/movement.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'movement/movement.c') diff --git a/movement/movement.c b/movement/movement.c index 9409d037..8c58b202 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -415,7 +415,7 @@ bool app_loop(void) { // (which would effectively disable the normal 'long press to face 0' behaviour). if (event.event_type == EVENT_MODE_LONG_PRESS && movement_state.current_watch_face > 0 - && movement_state.current_watch_face == movement_state.next_watch_face) { + && !movement_state.watch_face_changed) { movement_move_to_face(0); } event.event_type = EVENT_NONE; -- cgit v1.2.3