summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy O'Brien <neutral@fastmail.com>2023-01-23 15:15:57 -0500
committerGitHub <noreply@github.com>2023-01-23 14:15:57 -0600
commit3cd8e5c47ed1e0fa45b4cd29a42d9e606a12fcab (patch)
tree4f01b90ec291893a415c117ac05e4a59dabb22a4
parent8d20b46fec6e24d8a9e6bf13c24a2b65b2615dc9 (diff)
downloadSensor-Watch-3cd8e5c47ed1e0fa45b4cd29a42d9e606a12fcab.tar.gz
Sensor-Watch-3cd8e5c47ed1e0fa45b4cd29a42d9e606a12fcab.tar.bz2
Sensor-Watch-3cd8e5c47ed1e0fa45b4cd29a42d9e606a12fcab.zip
tarot: avoid mandatory function call on every tick (#185)
-rw-r--r--movement/watch_faces/complication/tarot_face.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/movement/watch_faces/complication/tarot_face.c b/movement/watch_faces/complication/tarot_face.c
index fe29f8a7..39feaf15 100644
--- a/movement/watch_faces/complication/tarot_face.c
+++ b/movement/watch_faces/complication/tarot_face.c
@@ -179,30 +179,28 @@ static void pick_cards(tarot_state_t *state) {
}
static void display_animation(tarot_state_t *state) {
- if (state->is_picking) {
- if (state->animation_frame == 0) {
- watch_display_string(" ", 7);
- watch_set_pixel(1, 4);
- watch_set_pixel(1, 6);
- state->animation_frame = 1;
- } else if (state->animation_frame == 1) {
- watch_clear_pixel(1, 4);
- watch_clear_pixel(1, 6);
- watch_set_pixel(2, 4);
- watch_set_pixel(0, 6);
- state->animation_frame = 2;
- } else if (state->animation_frame == 2) {
- watch_clear_pixel(2, 4);
- watch_clear_pixel(0, 6);
- watch_set_pixel(2, 5);
- watch_set_pixel(0, 5);
- state->animation_frame = 3;
- } else if (state->animation_frame == 3) {
- state->animation_frame = 0;
- state->is_picking = false;
- movement_request_tick_frequency(1);
- tarot_display(state);
- }
+ if (state->animation_frame == 0) {
+ watch_display_string(" ", 7);
+ watch_set_pixel(1, 4);
+ watch_set_pixel(1, 6);
+ state->animation_frame = 1;
+ } else if (state->animation_frame == 1) {
+ watch_clear_pixel(1, 4);
+ watch_clear_pixel(1, 6);
+ watch_set_pixel(2, 4);
+ watch_set_pixel(0, 6);
+ state->animation_frame = 2;
+ } else if (state->animation_frame == 2) {
+ watch_clear_pixel(2, 4);
+ watch_clear_pixel(0, 6);
+ watch_set_pixel(2, 5);
+ watch_set_pixel(0, 5);
+ state->animation_frame = 3;
+ } else if (state->animation_frame == 3) {
+ state->animation_frame = 0;
+ state->is_picking = false;
+ movement_request_tick_frequency(1);
+ tarot_display(state);
}
}
@@ -246,7 +244,9 @@ bool tarot_face_loop(movement_event_t event, movement_settings_t *settings, void
tarot_display(state);
break;
case EVENT_TICK:
- display_animation(state);
+ if (state->is_picking) {
+ display_animation(state);
+ }
break;
case EVENT_MODE_BUTTON_UP:
movement_move_to_next_face();