diff options
author | joeycastillo <joeycastillo@utexas.edu> | 2023-01-17 10:52:42 -0600 |
---|---|---|
committer | joeycastillo <joeycastillo@utexas.edu> | 2023-01-17 10:52:42 -0600 |
commit | 3142fccea3d19dc5b41313627f444851407238a9 (patch) | |
tree | 556c53d0318ac1d56800ed81f16c5606830207c9 /movement/watch_faces/clock | |
parent | a610382f89165370bd9239546dcc4f2fe9bf9e1c (diff) | |
parent | 5163cf1fe1e8bf878bf8d4e54b1fa24dccb4e116 (diff) | |
download | Sensor-Watch-3142fccea3d19dc5b41313627f444851407238a9.tar.gz Sensor-Watch-3142fccea3d19dc5b41313627f444851407238a9.tar.bz2 Sensor-Watch-3142fccea3d19dc5b41313627f444851407238a9.zip |
Merge branch 'main' into default-handler
Diffstat (limited to 'movement/watch_faces/clock')
-rw-r--r-- | movement/watch_faces/clock/simple_clock_face.c | 12 | ||||
-rw-r--r-- | movement/watch_faces/clock/weeknumber_clock_face.c | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/movement/watch_faces/clock/simple_clock_face.c b/movement/watch_faces/clock/simple_clock_face.c index fbc2c4b3..91400b6c 100644 --- a/movement/watch_faces/clock/simple_clock_face.c +++ b/movement/watch_faces/clock/simple_clock_face.c @@ -136,7 +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); - 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: return movement_default_loop_handler(event, settings); 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; |