movement: add loudness setting for button press
This commit is contained in:
@@ -67,7 +67,7 @@ static inline void load_countdown(countdown_state_t *state) {
|
||||
|
||||
static inline void button_beep() {
|
||||
// play a beep as confirmation for a button press (if applicable)
|
||||
if (movement_button_should_sound()) watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, WATCH_BUZZER_VOLUME_SOFT);
|
||||
if (movement_button_should_sound()) watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, movement_button_volume());
|
||||
}
|
||||
|
||||
static void schedule_countdown(countdown_state_t *state) {
|
||||
|
||||
@@ -121,7 +121,7 @@ void irq_handler_tc1(void) {
|
||||
|
||||
static inline void _button_beep() {
|
||||
// play a beep as confirmation for a button press (if applicable)
|
||||
if (movement_button_should_sound()) watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, WATCH_BUZZER_VOLUME_SOFT);
|
||||
if (movement_button_should_sound()) watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, movement_button_volume());
|
||||
}
|
||||
|
||||
/// @brief Display minutes, seconds and fractions derived from 128 Hz tick counter
|
||||
|
||||
@@ -118,7 +118,7 @@ bool stopwatch_face_loop(movement_event_t event, void *context) {
|
||||
break;
|
||||
case EVENT_ALARM_BUTTON_DOWN:
|
||||
if (movement_button_should_sound()) {
|
||||
watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, WATCH_BUZZER_VOLUME_SOFT);
|
||||
watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, movement_button_volume());
|
||||
}
|
||||
stopwatch_state->running = !stopwatch_state->running;
|
||||
if (stopwatch_state->running) {
|
||||
|
||||
@@ -42,16 +42,39 @@ static void beep_setting_display(uint8_t subsecond) {
|
||||
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "BTN", "BT");
|
||||
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "beep ", " beep ");
|
||||
if (subsecond % 2) {
|
||||
if (movement_button_should_sound()) {
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " Y");
|
||||
if (movement_button_should_sound()) {
|
||||
if (movement_button_volume() == WATCH_BUZZER_VOLUME_LOUD) {
|
||||
// H for HIGH
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " H");
|
||||
}
|
||||
else {
|
||||
// L for LOW
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " L");
|
||||
}
|
||||
} else {
|
||||
// N for NONE
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " N");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void beep_setting_advance(void) {
|
||||
movement_set_button_should_sound(!movement_button_should_sound());
|
||||
if (!movement_button_should_sound()) {
|
||||
// was muted. make it soft.
|
||||
movement_set_button_should_sound(true);
|
||||
movement_set_button_volume(WATCH_BUZZER_VOLUME_SOFT);
|
||||
beep_setting_display(1);
|
||||
watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, WATCH_BUZZER_VOLUME_SOFT);
|
||||
} else if (movement_button_volume() == WATCH_BUZZER_VOLUME_SOFT) {
|
||||
// was soft. make it loud.
|
||||
movement_set_button_volume(WATCH_BUZZER_VOLUME_LOUD);
|
||||
beep_setting_display(1);
|
||||
watch_buzzer_play_note_with_volume(BUZZER_NOTE_C7, 50, WATCH_BUZZER_VOLUME_LOUD);
|
||||
} else {
|
||||
// was loud. make it silent.
|
||||
movement_set_button_should_sound(false);
|
||||
beep_setting_display(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void timeout_setting_display(uint8_t subsecond) {
|
||||
|
||||
Reference in New Issue
Block a user