summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames McKenzie <root@ka-ata-killa.panaceas.james.local>2024-04-07 17:00:18 +0100
committerJames McKenzie <root@ka-ata-killa.panaceas.james.local>2024-04-07 17:00:28 +0100
commitcbbc273360db37849eff7258cb27998f3e217445 (patch)
tree1b4480a5d415210839e92eba0dceefcd34979cc7
parent167e5afe663660f1dad06368b25dde947efc0136 (diff)
downloadSensor-Watch-pq-cbbc273360db37849eff7258cb27998f3e217445.tar.gz
Sensor-Watch-pq-cbbc273360db37849eff7258cb27998f3e217445.tar.bz2
Sensor-Watch-pq-cbbc273360db37849eff7258cb27998f3e217445.zip
fix tuning
-rw-r--r--main/fix-tuning.patch88
-rw-r--r--main/series1
2 files changed, 89 insertions, 0 deletions
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