Add saved Companion sound and vibration controls
Default fresh settings to sound off and vibration on, and keep existing saved choices. Apply changes immediately across all three UIs and make custom notification patterns respect the same mute controls. Keep the Wio Mini Companion within its existing flash boundary by storing its LED switch in a reserved preference byte and shortening CLI help without removing commands. Add coverage for live output changes, persistence, and storage failures. Adapted from https://github.com/meshcore-dev/MeshCore/pull/3603. Co-authored-by: R0ck <develop@hectospark.co.uk>
This commit is contained in:
1 parent
9d52b1fd68
commit
f57dffa2be
30 files changed
+1074
-108
No files matched your search
@@ -48,16 +48,14 @@ static mesh::audio::VoiceClip buttonVoiceClip(ButtonVoicePrompt prompt) {
|
||||
#endif
|
||||
|
||||
void genericBuzzer::begin() {
|
||||
// Serial.print("DBG: Setting up buzzer on pin ");
|
||||
// Serial.println(PIN_BUZZER);
|
||||
#ifdef PIN_BUZZER_EN
|
||||
pinMode(PIN_BUZZER_EN, OUTPUT);
|
||||
digitalWrite(PIN_BUZZER_EN, HIGH);
|
||||
#endif
|
||||
|
||||
quiet(false);
|
||||
digitalWrite(PIN_BUZZER, LOW);
|
||||
pinMode(PIN_BUZZER, OUTPUT);
|
||||
digitalWrite(PIN_BUZZER, LOW); // need to pull low by default to avoid extreme power draw
|
||||
#ifdef PIN_BUZZER_EN
|
||||
digitalWrite(PIN_BUZZER_EN, LOW);
|
||||
pinMode(PIN_BUZZER_EN, OUTPUT);
|
||||
#endif
|
||||
// Start muted until the UI applies the saved preference.
|
||||
quiet(_is_quiet);
|
||||
}
|
||||
|
||||
void genericBuzzer::play(const char *melody) {
|
||||
@@ -79,6 +77,8 @@ void genericBuzzer::play(const char *melody) {
|
||||
}
|
||||
|
||||
void genericBuzzer::playNotification(const char* melody) {
|
||||
// Muted background alerts must not interrupt an explicit button prompt.
|
||||
if (_is_quiet) return;
|
||||
stop();
|
||||
#ifdef PIN_BUZZER_EN
|
||||
digitalWrite(PIN_BUZZER_EN, HIGH);
|
||||
|
||||
Reference in new issue
Block a user