From 4fe6a7bbb183271763c757d4cabf372a38de1bb1 Mon Sep 17 00:00:00 2001 From: David Volovskiy Date: Mon, 18 Aug 2025 22:10:49 -0400 Subject: [PATCH 1/4] Moved Simon face --- {legacy/watch_faces => watch-faces}/complication/simon_face.c | 0 {legacy/watch_faces => watch-faces}/complication/simon_face.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {legacy/watch_faces => watch-faces}/complication/simon_face.c (100%) rename {legacy/watch_faces => watch-faces}/complication/simon_face.h (100%) diff --git a/legacy/watch_faces/complication/simon_face.c b/watch-faces/complication/simon_face.c similarity index 100% rename from legacy/watch_faces/complication/simon_face.c rename to watch-faces/complication/simon_face.c diff --git a/legacy/watch_faces/complication/simon_face.h b/watch-faces/complication/simon_face.h similarity index 100% rename from legacy/watch_faces/complication/simon_face.h rename to watch-faces/complication/simon_face.h From eeeb9865ac4692d40ec876215fb3990e02e11d40 Mon Sep 17 00:00:00 2001 From: David Volovskiy Date: Tue, 19 Aug 2025 06:59:59 -0400 Subject: [PATCH 2/4] Refactored text display --- movement_faces.h | 1 + watch-faces.mk | 1 + watch-faces/complication/simon_face.c | 42 ++++++++++++++------------- watch-faces/complication/simon_face.h | 4 +-- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/movement_faces.h b/movement_faces.h index fc43716d..d86e72d4 100644 --- a/movement_faces.h +++ b/movement_faces.h @@ -73,4 +73,5 @@ #include "wareki_face.h" #include "deadline_face.h" #include "wordle_face.h" +#include "simon_face.h" // New includes go above this line. diff --git a/watch-faces.mk b/watch-faces.mk index 22e262cf..3f1f8946 100644 --- a/watch-faces.mk +++ b/watch-faces.mk @@ -48,4 +48,5 @@ SRCS += \ ./watch-faces/sensor/lis2dw_monitor_face.c \ ./watch-faces/complication/wareki_face.c \ ./watch-faces/complication/deadline_face.c \ + ./watch-faces/complication/simon_face.c \ # New watch faces go above this line. diff --git a/watch-faces/complication/simon_face.c b/watch-faces/complication/simon_face.c index 41bc5c3d..55f484bf 100644 --- a/watch-faces/complication/simon_face.c +++ b/watch-faces/complication/simon_face.c @@ -47,18 +47,19 @@ static inline uint8_t _simon_get_rand_num(uint8_t num_values) { } static void _simon_clear_display(simon_state_t *state) { - if (state->playing_state == SIMON_NOT_PLAYING) { - watch_display_string(" ", 0); - } else { - sprintf(_simon_display_buf, " %2d ", state->sequence_length); - watch_display_string(_simon_display_buf, 0); + watch_clear_display(); + if (state->playing_state != SIMON_NOT_PLAYING) { + sprintf(_simon_display_buf, "%2d", state->sequence_length); + watch_display_text(WATCH_POSITION_TOP_RIGHT, _simon_display_buf); } } static void _simon_not_playing_display(simon_state_t *state) { _simon_clear_display(state); - sprintf(_simon_display_buf, "SI %d", state->best_score); + watch_display_text(WATCH_POSITION_TOP, "SI"); + sprintf(_simon_display_buf, "%d", state->best_score); + watch_display_text(WATCH_POSITION_BOTTOM, _simon_display_buf); if (!state->soundOff) watch_set_indicator(WATCH_INDICATOR_BELL); else @@ -67,14 +68,13 @@ static void _simon_not_playing_display(simon_state_t *state) { watch_set_indicator(WATCH_INDICATOR_SIGNAL); else watch_clear_indicator(WATCH_INDICATOR_SIGNAL); - watch_display_string(_simon_display_buf, 0); switch (state->mode) { case SIMON_MODE_EASY: - watch_display_string("E", 9); + watch_display_text(WATCH_POSITION_SECONDS, " E"); break; case SIMON_MODE_HARD: - watch_display_string("H", 9); + watch_display_text(WATCH_POSITION_SECONDS, " H"); break; default: break; @@ -90,24 +90,27 @@ static void _simon_reset(simon_state_t *state) { static void _simon_display_note(SimonNote note, simon_state_t *state) { - char *ndtemplate = NULL; - + watch_clear_display(); + if (note == SIMON_WRONG_NOTE) { + watch_display_text(WATCH_POSITION_TOP_LEFT, "OH"); + watch_display_text(WATCH_POSITION_BOTTOM, "NOOOOO"); + return; + } + sprintf(_simon_display_buf, "%2d", state->sequence_length); + watch_display_text(WATCH_POSITION_TOP_RIGHT, _simon_display_buf); switch (note) { case SIMON_LED_NOTE: - ndtemplate = "LI%2d "; + watch_display_text(WATCH_POSITION_TOP_LEFT, "LI"); break; case SIMON_ALARM_NOTE: - ndtemplate = " %2d AL"; + watch_display_text(WATCH_POSITION_SECONDS, "AL"); break; case SIMON_MODE_NOTE: - ndtemplate = " %2dDE "; + watch_display_text(WATCH_POSITION_HOURS, DE"); + break; + default: break; - case SIMON_WRONG_NOTE: - ndtemplate = "OH NOOOOO"; } - - sprintf(_simon_display_buf, ndtemplate, state->sequence_length); - watch_display_string(_simon_display_buf, 0); } static void _simon_play_note(SimonNote note, simon_state_t *state, bool skip_rest) { @@ -220,7 +223,6 @@ void simon_face_setup(uint8_t watch_face_index, } void simon_face_activate(void *context) { - (void) settings; (void) context; simon_state_t *state = (simon_state_t *)context; _simon_change_speed(state); diff --git a/watch-faces/complication/simon_face.h b/watch-faces/complication/simon_face.h index 63e83895..a3dd743b 100644 --- a/watch-faces/complication/simon_face.h +++ b/watch-faces/complication/simon_face.h @@ -95,8 +95,8 @@ void simon_face_activate(void *context); bool simon_face_loop(movement_event_t event, void *context); void simon_face_resign(void *context); -#define simon_face \ - ((const watch_face_t){ \ +#define simon_face \ + ((const watch_face_t){ \ simon_face_setup, \ simon_face_activate, \ simon_face_loop, \ From 3220ab4a3abd11dc493b5eb83dd4e1b8f7c532c5 Mon Sep 17 00:00:00 2001 From: David Volovskiy Date: Tue, 19 Aug 2025 07:00:35 -0400 Subject: [PATCH 3/4] Added fallbacks on custom dispaly texts --- watch-faces/complication/simon_face.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/watch-faces/complication/simon_face.c b/watch-faces/complication/simon_face.c index 55f484bf..ef8b0095 100644 --- a/watch-faces/complication/simon_face.c +++ b/watch-faces/complication/simon_face.c @@ -57,7 +57,7 @@ static void _simon_clear_display(simon_state_t *state) { static void _simon_not_playing_display(simon_state_t *state) { _simon_clear_display(state); - watch_display_text(WATCH_POSITION_TOP, "SI"); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "SIMON", "SI"); sprintf(_simon_display_buf, "%d", state->best_score); watch_display_text(WATCH_POSITION_BOTTOM, _simon_display_buf); if (!state->soundOff) @@ -106,7 +106,7 @@ static void _simon_display_note(SimonNote note, simon_state_t *state) { watch_display_text(WATCH_POSITION_SECONDS, "AL"); break; case SIMON_MODE_NOTE: - watch_display_text(WATCH_POSITION_HOURS, DE"); + watch_display_text_with_fallback(WATCH_POSITION_HOURS, "Md", "DE"); break; default: break; From 7ec68ad2189035401b7f59cd0411ed77686c265b Mon Sep 17 00:00:00 2001 From: David Volovskiy Date: Tue, 19 Aug 2025 22:00:03 -0400 Subject: [PATCH 4/4] Included delay library --- watch-faces/complication/simon_face.c | 1 + 1 file changed, 1 insertion(+) diff --git a/watch-faces/complication/simon_face.c b/watch-faces/complication/simon_face.c index ef8b0095..642b32a2 100644 --- a/watch-faces/complication/simon_face.c +++ b/watch-faces/complication/simon_face.c @@ -23,6 +23,7 @@ */ #include "simon_face.h" +#include "delay.h" #include #include #include