]> git.earman.xyz Git - sensor-watch.git/commitdiff
Revert "Merge pull request #283 from neutralinsomniac/fix_hourly_chime_background"
authorWesley Aptekar-Cassels <me@wesleyac.com>
Mon, 13 Nov 2023 05:14:41 +0000 (00:14 -0500)
committerWesley Aptekar-Cassels <me@wesleyac.com>
Tue, 9 Jan 2024 21:22:21 +0000 (16:22 -0500)
This reverts commit 5c94111ea20e50cb9dab8f416603403185e933b3, reversing
changes made to bc9b4ce700d3f12adc0daceaa880e3d638df0c2b.

movement/movement.c
movement/movement.h
movement/watch_faces/clock/repetition_minute_face.c
movement/watch_faces/clock/simple_clock_bin_led_face.c
movement/watch_faces/clock/simple_clock_face.c
movement/watch_faces/clock/weeknumber_clock_face.c

index f0868416eb0b2f9cee5271a732692f8c0e5aea91..0c6ed31978c6076122be9215a12cda29129797f7 100644 (file)
@@ -294,25 +294,7 @@ void movement_request_wake() {
 }
 
 void movement_play_signal(void) {
-    bool buzzer_enabled = watch_is_buzzer_or_led_enabled();
-    if (!buzzer_enabled) {
-        watch_enable_buzzer();
-    }
-    watch_buzzer_play_note(BUZZER_NOTE_C8, 75);
-    watch_buzzer_play_note(BUZZER_NOTE_REST, 100);
-    watch_buzzer_play_note(BUZZER_NOTE_C8, 100);
-    if (!buzzer_enabled) {
-        watch_disable_buzzer();
-    }
-}
-
-void movement_play_tune(void) {
-    if (!watch_is_buzzer_or_led_enabled()) {
-        watch_enable_buzzer();
-        watch_buzzer_play_sequence(signal_tune, watch_disable_buzzer);
-    } else {
-        watch_buzzer_play_sequence(signal_tune, NULL);
-    }
+    watch_buzzer_play_sequence(signal_tune, NULL);
 }
 
 void movement_play_alarm(void) {
index 5f30dfb8c652413808665e7870f54013a6316e7d..66bf6af46ce3bdee1e83277c47c80588471025f9 100644 (file)
@@ -307,7 +307,6 @@ void movement_cancel_background_task_for_face(uint8_t watch_face_index);
 void movement_request_wake(void);
 
 void movement_play_signal(void);
-void movement_play_tune(void);
 void movement_play_alarm(void);
 void movement_play_alarm_beeps(uint8_t rounds, BuzzerNote alarm_note);
 
index fc78b2d860b67dcdc11eec1f0ed7c07e395490f2..a0fbe077058c079e2306292d437865ae92bc41c9 100644 (file)
@@ -151,7 +151,19 @@ bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *se
             else watch_clear_indicator(WATCH_INDICATOR_BELL);
             break;
         case EVENT_BACKGROUND_TASK:
-            movement_play_signal();
+            // uncomment this line to snap back to the clock face when the hour signal sounds:
+            // movement_move_to_face(state->watch_face_index);
+            if (watch_is_buzzer_or_led_enabled()) {
+                // if we are in the foreground, we can just beep.
+                movement_play_signal();
+            } else {
+                // if we were in the background, we need to enable the buzzer peripheral first,
+                watch_enable_buzzer();
+                // beep quickly (this call blocks for 275 ms),
+                movement_play_signal();
+                // and then turn the buzzer peripheral off again.
+                watch_disable_buzzer();
+            }
             break;
         case EVENT_LIGHT_LONG_UP:
             /*
index cf39c1886bb8aa8908a2a47b91a494f9a967e2bf..640f0d77f7ea95cb71732a15753ce61cf6327723 100644 (file)
@@ -180,7 +180,17 @@ bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t
         case EVENT_BACKGROUND_TASK:
             // uncomment this line to snap back to the clock face when the hour signal sounds:
             // movement_move_to_face(state->watch_face_index);
-            movement_play_signal();
+            if (watch_is_buzzer_or_led_enabled()) {
+                // if we are in the foreground, we can just beep.
+                movement_play_signal();
+            } else {
+                // if we were in the background, we need to enable the buzzer peripheral first,
+                watch_enable_buzzer();
+                // beep quickly (this call blocks for 275 ms),
+                movement_play_signal();
+                // and then turn the buzzer peripheral off again.
+                watch_disable_buzzer();
+            }
             break;
         case EVENT_LIGHT_LONG_PRESS:
             if (state->flashing_state == 0) {
index ac9a97b21a9fb4886605643ddaee829849cbc422..91400b6c316b51ae081cb0424d5cb68363c0072c 100644 (file)
@@ -136,11 +136,17 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
         case EVENT_BACKGROUND_TASK:
             // uncomment this line to snap back to the clock face when the hour signal sounds:
             // movement_move_to_face(state->watch_face_index);
-            #ifdef SIGNAL_TUNE_DEFAULT
-            movement_play_signal();
-            #else
-            movement_play_tune();
-            #endif
+            if (watch_is_buzzer_or_led_enabled()) {
+                // if we are in the foreground, we can just beep.
+                movement_play_signal();
+            } else {
+                // if we were in the background, we need to enable the buzzer peripheral first,
+                watch_enable_buzzer();
+                // beep quickly (this call blocks for 275 ms),
+                movement_play_signal();
+                // and then turn the buzzer peripheral off again.
+                watch_disable_buzzer();
+            }
             break;
         default:
             return movement_default_loop_handler(event, settings);
index 81df58475ba962dcea335112280e891d76927f7e..4e40ebdcaa21a6b3cc56667b6637a215890730e8 100644 (file)
@@ -130,7 +130,17 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
         case EVENT_BACKGROUND_TASK:
             // uncomment this line to snap back to the clock face when the hour signal sounds:
             // movement_move_to_face(state->watch_face_index);
-            movement_play_signal();
+            if (watch_is_buzzer_or_led_enabled()) {
+                // if we are in the foreground, we can just beep.
+                movement_play_signal();
+            } else {
+                // if we were in the background, we need to enable the buzzer peripheral first,
+                watch_enable_buzzer();
+                // beep quickly (this call blocks for 275 ms),
+                movement_play_signal();
+                // and then turn the buzzer peripheral off again.
+                watch_disable_buzzer();
+            }
             break;
         default:
             movement_default_loop_handler(event, settings);