summaryrefslogtreecommitdiffstats
path: root/movement
diff options
context:
space:
mode:
authorjoeycastillo <joeycastillo@utexas.edu>2023-01-17 08:52:01 -0600
committerjoeycastillo <joeycastillo@utexas.edu>2023-01-17 08:52:01 -0600
commit5163cf1fe1e8bf878bf8d4e54b1fa24dccb4e116 (patch)
tree3adc55d137265d6789fa74760a4db00389f22503 /movement
parentca05567576343d7dfe1ee5be8d6347cf463dad7e (diff)
downloadSensor-Watch-5163cf1fe1e8bf878bf8d4e54b1fa24dccb4e116.tar.gz
Sensor-Watch-5163cf1fe1e8bf878bf8d4e54b1fa24dccb4e116.tar.bz2
Sensor-Watch-5163cf1fe1e8bf878bf8d4e54b1fa24dccb4e116.zip
Revert "never disable buzzer output"
This reverts commit 851d047c818dacc30c86f4d87f33247dcfb0095c.
Diffstat (limited to 'movement')
-rw-r--r--movement/watch_faces/clock/simple_clock_face.c12
-rw-r--r--movement/watch_faces/clock/weeknumber_clock_face.c12
-rw-r--r--movement/watch_faces/complication/alarm_face.c10
3 files changed, 31 insertions, 3 deletions
diff --git a/movement/watch_faces/clock/simple_clock_face.c b/movement/watch_faces/clock/simple_clock_face.c
index 76055998..179b23d6 100644
--- a/movement/watch_faces/clock/simple_clock_face.c
+++ b/movement/watch_faces/clock/simple_clock_face.c
@@ -142,7 +142,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);
- 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:
break;
diff --git a/movement/watch_faces/clock/weeknumber_clock_face.c b/movement/watch_faces/clock/weeknumber_clock_face.c
index 45d751af..e49e5abf 100644
--- a/movement/watch_faces/clock/weeknumber_clock_face.c
+++ b/movement/watch_faces/clock/weeknumber_clock_face.c
@@ -136,7 +136,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:
break;
diff --git a/movement/watch_faces/complication/alarm_face.c b/movement/watch_faces/complication/alarm_face.c
index 9acf5899..5ad3976c 100644
--- a/movement/watch_faces/complication/alarm_face.c
+++ b/movement/watch_faces/complication/alarm_face.c
@@ -417,7 +417,15 @@ bool alarm_face_loop(movement_event_t event, movement_settings_t *settings, void
case EVENT_BACKGROUND_TASK:
// play alarm
if (state->alarm[state->alarm_playing_idx].beeps == 0) {
- _alarm_play_short_beep(state->alarm[state->alarm_playing_idx].pitch);
+ // short beep
+ if (watch_is_buzzer_or_led_enabled()) {
+ _alarm_play_short_beep(state->alarm[state->alarm_playing_idx].pitch);
+ } else {
+ // enable, play beep and disable buzzer again
+ watch_enable_buzzer();
+ _alarm_play_short_beep(state->alarm[state->alarm_playing_idx].pitch);
+ watch_disable_buzzer();
+ }
} else {
// regular alarm beeps
movement_play_alarm_beeps((state->alarm[state->alarm_playing_idx].beeps == (ALARM_MAX_BEEP_ROUNDS - 1) ? 20 : state->alarm[state->alarm_playing_idx].beeps),