From 390f0c8248a4aa6f12a4d0e595a4c0a0ca3c3a5f Mon Sep 17 00:00:00 2001 From: Jason P Date: Thu, 8 Jan 2026 16:44:05 -0600 Subject: [PATCH] Screenless Devices want to mute too! (#9210) * Screenless Devices want to mute too! * Add logging for actions * Gate to screenless devices only * WisMesh Tag was missing HAS_SCREEN 0 --------- Co-authored-by: Ben Meadors --- src/buzz/buzz.cpp | 22 ++++++++++++++++++++++ src/buzz/buzz.h | 2 ++ src/input/ButtonThread.cpp | 16 +++++++++++++++- variants/nrf52840/rak_wismeshtag/variant.h | 2 ++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/buzz/buzz.cpp b/src/buzz/buzz.cpp index 89d752c08..6fb28a6ac 100644 --- a/src/buzz/buzz.cpp +++ b/src/buzz/buzz.cpp @@ -35,6 +35,14 @@ struct ToneDuration { #define NOTE_G6 1568 #define NOTE_E7 2637 +#define NOTE_C4 262 +#define NOTE_E4 330 +#define NOTE_G4 392 +#define NOTE_A4 440 +#define NOTE_C5 523 +#define NOTE_E5 659 +#define NOTE_G5 784 + const int DURATION_1_16 = 62; // 1/16 note const int DURATION_1_8 = 125; // 1/8 note const int DURATION_1_4 = 250; // 1/4 note @@ -189,3 +197,17 @@ void playComboTune() }; playTones(melody, sizeof(melody) / sizeof(ToneDuration)); } + +void play4ClickDown() +{ + ToneDuration melody[] = {{NOTE_G5, 55}, {NOTE_E5, 55}, {NOTE_C5, 60}, {NOTE_A4, 55}, {NOTE_G4, 55}, + {NOTE_E4, 65}, {NOTE_C4, 80}, {NOTE_G3, 120}, {NOTE_E3, 160}, {NOTE_SILENT, 120}}; + playTones(melody, sizeof(melody) / sizeof(ToneDuration)); +} + +void play4ClickUp() +{ + // Quick high-pitched notes with trills + ToneDuration melody[] = {{NOTE_F5, 50}, {NOTE_G6, 45}, {NOTE_E7, 60}}; + playTones(melody, sizeof(melody) / sizeof(ToneDuration)); +} \ No newline at end of file diff --git a/src/buzz/buzz.h b/src/buzz/buzz.h index fa0c8c496..1b97e24de 100644 --- a/src/buzz/buzz.h +++ b/src/buzz/buzz.h @@ -7,6 +7,8 @@ void playShutdownMelody(); void playGPSEnableBeep(); void playGPSDisableBeep(); void playComboTune(); +void play4ClickDown(); +void play4ClickUp(); void playBoop(); void playChirp(); void playClick(); diff --git a/src/input/ButtonThread.cpp b/src/input/ButtonThread.cpp index 63fd8b0d7..0d835a3a9 100644 --- a/src/input/ButtonThread.cpp +++ b/src/input/ButtonThread.cpp @@ -248,7 +248,21 @@ int32_t ButtonThread::runOnce() this->notifyObservers(&evt); playComboTune(); break; - +#if !HAS_SCREEN + case 4: + if (moduleConfig.external_notification.enabled && externalNotificationModule) { + externalNotificationModule->setMute(!externalNotificationModule->getMute()); + IF_SCREEN(if (!externalNotificationModule->getMute()) externalNotificationModule->stopNow();) + if (externalNotificationModule->getMute()) { + LOG_INFO("Temporarily Muted"); + play4ClickDown(); // Disable tone + } else { + LOG_INFO("Unmuted"); + play4ClickUp(); // Enable tone + } + } + break; +#endif // No valid multipress action default: break; diff --git a/variants/nrf52840/rak_wismeshtag/variant.h b/variants/nrf52840/rak_wismeshtag/variant.h index 159cabf07..fa3e252ab 100644 --- a/variants/nrf52840/rak_wismeshtag/variant.h +++ b/variants/nrf52840/rak_wismeshtag/variant.h @@ -234,6 +234,8 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG #define RAK_4631 1 +#define HAS_SCREEN 0 + #ifdef __cplusplus } #endif