mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-10 20:07:45 +00:00
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 <benmmeadors@gmail.com>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
@@ -7,6 +7,8 @@ void playShutdownMelody();
|
||||
void playGPSEnableBeep();
|
||||
void playGPSDisableBeep();
|
||||
void playComboTune();
|
||||
void play4ClickDown();
|
||||
void play4ClickUp();
|
||||
void playBoop();
|
||||
void playChirp();
|
||||
void playClick();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user