move buzzer enabled detection logic into movement for movement_play_signal/tune
this way watch faces don't have to disable/enable the buzzer themselves before calling movement_play_signal() and movement_play_tune()
This commit is contained in:
parent
bfde84f01d
commit
45f402b4ec
@ -294,25 +294,25 @@ 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);
|
||||
}
|
||||
|
||||
void movement_play_signal_background(void) {
|
||||
watch_enable_buzzer();
|
||||
movement_play_signal();
|
||||
if (!buzzer_enabled) {
|
||||
watch_disable_buzzer();
|
||||
}
|
||||
}
|
||||
|
||||
void movement_play_tune(void) {
|
||||
watch_buzzer_play_sequence(signal_tune, NULL);
|
||||
}
|
||||
|
||||
/* Special version of movement_play_tune meant for use during LE mode */
|
||||
void movement_play_tune_background(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);
|
||||
}
|
||||
}
|
||||
|
||||
void movement_play_alarm(void) {
|
||||
|
@ -307,9 +307,7 @@ 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_signal_background(void);
|
||||
void movement_play_tune(void);
|
||||
void movement_play_tune_background(void);
|
||||
void movement_play_alarm(void);
|
||||
void movement_play_alarm_beeps(uint8_t rounds, BuzzerNote alarm_note);
|
||||
|
||||
|
@ -151,11 +151,7 @@ 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:
|
||||
if (watch_is_buzzer_or_led_enabled()) {
|
||||
movement_play_signal();
|
||||
} else {
|
||||
movement_play_signal_background();
|
||||
}
|
||||
break;
|
||||
case EVENT_LIGHT_LONG_UP:
|
||||
/*
|
||||
|
@ -180,11 +180,7 @@ 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);
|
||||
if (watch_is_buzzer_or_led_enabled()) {
|
||||
movement_play_signal();
|
||||
} else {
|
||||
movement_play_signal_background();
|
||||
}
|
||||
break;
|
||||
case EVENT_LIGHT_LONG_PRESS:
|
||||
if (state->flashing_state == 0) {
|
||||
|
@ -136,11 +136,7 @@ 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);
|
||||
if (watch_is_buzzer_or_led_enabled()) {
|
||||
movement_play_tune();
|
||||
} else {
|
||||
movement_play_tune_background();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
|
@ -130,11 +130,7 @@ 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);
|
||||
if (watch_is_buzzer_or_led_enabled()) {
|
||||
movement_play_signal();
|
||||
} else {
|
||||
movement_play_signal_background();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
movement_default_loop_handler(event, settings);
|
||||
|
Loading…
x
Reference in New Issue
Block a user