From cbbc273360db37849eff7258cb27998f3e217445 Mon Sep 17 00:00:00 2001 From: James McKenzie Date: Sun, 7 Apr 2024 17:00:18 +0100 Subject: fix tuning --- main/fix-tuning.patch | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++ main/series | 1 + 2 files changed, 89 insertions(+) create mode 100644 main/fix-tuning.patch diff --git a/main/fix-tuning.patch b/main/fix-tuning.patch new file mode 100644 index 0000000..0ad8582 --- /dev/null +++ b/main/fix-tuning.patch @@ -0,0 +1,88 @@ +diff --git a/movement/watch_faces/complication/tuning_tones_face.c b/movement/watch_faces/complication/tuning_tones_face.c +index a139427..4ab8dfe 100644 +--- a/movement/watch_faces/complication/tuning_tones_face.c ++++ b/movement/watch_faces/complication/tuning_tones_face.c +@@ -38,23 +38,23 @@ + */ + + typedef struct Note { +- BuzzerNote note; ++ int8_t notes[3]; + char * name; + } Note; + + static Note notes[] = { +- { .note = BUZZER_NOTE_C5, .name = "C " }, +- { .note = BUZZER_NOTE_C5SHARP_D5FLAT, .name = "Db" }, +- { .note = BUZZER_NOTE_D5, .name = "D " }, +- { .note = BUZZER_NOTE_D5SHARP_E5FLAT, .name = "Eb" }, +- { .note = BUZZER_NOTE_E5, .name = "E " }, +- { .note = BUZZER_NOTE_F5, .name = "F " }, +- { .note = BUZZER_NOTE_F5SHARP_G5FLAT, .name = "Gb" }, +- { .note = BUZZER_NOTE_G5, .name = "G " }, +- { .note = BUZZER_NOTE_G5SHARP_A5FLAT, .name = "Ab" }, +- { .note = BUZZER_NOTE_A5, .name = "A " }, +- { .note = BUZZER_NOTE_A5SHARP_B5FLAT, .name = "Bb" }, +- { .note = BUZZER_NOTE_B5, .name = "B " }, ++ { .notes = { BUZZER_NOTE_C5, 64 , 0 }, .name = "C " }, ++ { .notes = { BUZZER_NOTE_C5SHARP_D5FLAT, 64 , 0 }, .name = "Db" }, ++ { .notes = { BUZZER_NOTE_D5, 64 , 0 }, .name = "D " }, ++ { .notes = { BUZZER_NOTE_D5SHARP_E5FLAT, 64 , 0 }, .name = "Eb" }, ++ { .notes = { BUZZER_NOTE_E5, 64 , 0 }, .name = "E " }, ++ { .notes = { BUZZER_NOTE_F5, 64 , 0 }, .name = "F " }, ++ { .notes = { BUZZER_NOTE_F5SHARP_G5FLAT, 64 , 0 }, .name = "Gb" }, ++ { .notes = { BUZZER_NOTE_G5, 64 , 0 }, .name = "G " }, ++ { .notes = { BUZZER_NOTE_G5SHARP_A5FLAT, 64 , 0 }, .name = "Ab" }, ++ { .notes = { BUZZER_NOTE_A5, 64 , 0 }, .name = "A " }, ++ { .notes = { BUZZER_NOTE_A5SHARP_B5FLAT, 64 , 0 }, .name = "Bb" }, ++ { .notes = { BUZZER_NOTE_B5, 64 , 0 }, .name = "B " }, + }; + + static size_t note_count = sizeof notes / sizeof *notes; +@@ -80,12 +80,22 @@ void tuning_tones_face_activate(movement_settings_t *settings, void *context) { + (void) context; + } + ++static int8_t note; ++ ++static void go_again(void) { ++ watch_buzzer_play_sequence(notes[note].notes, go_again); ++} ++ + static void update_buzzer(const tuning_tones_state_t *state) + { + if (state->playing) { ++ watch_enable_buzzer(); ++ note = state->note_ind; ++ go_again(); ++ } else { ++ watch_buzzer_abort_sequence(); + watch_set_buzzer_off(); +- watch_set_buzzer_period(NotePeriods[notes[state->note_ind].note]); +- watch_set_buzzer_on(); ++ watch_disable_buzzer(); + } + } + +@@ -110,11 +120,8 @@ bool tuning_tones_face_loop(movement_event_t event, movement_settings_t *setting + break; + case EVENT_ALARM_BUTTON_DOWN: + state->playing = !state->playing; +- if (!state->playing) { +- watch_set_buzzer_off(); +- } else { +- update_buzzer(state); +- } ++ update_buzzer(state); ++ break; + case EVENT_ALARM_BUTTON_UP: + break; + case EVENT_TIMEOUT: +@@ -135,6 +142,6 @@ void tuning_tones_face_resign(movement_settings_t *settings, void *context) { + + if (state->playing) { + state->playing = false; +- watch_set_buzzer_off(); ++ update_buzzer(state); + } + } diff --git a/main/series b/main/series index e9f9a1f..83498bd 100644 --- a/main/series +++ b/main/series @@ -6,6 +6,7 @@ fix-serial.patch metric.patch siderial.patch moon.patch +fix-tuning.patch #debug-compile.patch #set-time.patch #dont_set_time_if_no_debugger.patch -- cgit v1.2.3