This commit is contained in:
Alco | AH-wood 2026-04-20 12:32:19 +00:00 committed by GitHub
commit 2455229621
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 47 additions and 19 deletions

18
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,18 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "PlatformIO Build",
"type": "shell",
"command": "platformio",
"args": [
"run"
],
"isBackground": false,
"problemMatcher": [
"$platformio"
],
"group": "build"
}
]
}

View file

@ -591,14 +591,14 @@ void UITask::notify(UIEventType t) {
#if defined(PIN_BUZZER)
switch(t){
case UIEventType::contactMessage:
// gemini's pick
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7");
// Play message sound using class member
buzzer.play(buzzer.message_song);
break;
case UIEventType::channelMessage:
buzzer.play("kerplop:d=16,o=6,b=120:32g#,32c#");
buzzer.play(buzzer.channel_song); // Play channel message sound
break;
case UIEventType::ack:
buzzer.play("ack:d=32,o=8,b=120:c");
buzzer.play(buzzer.ack_song); // Play ack sound
break;
case UIEventType::roomMessage:
case UIEventType::newContactMessage:

View file

@ -93,14 +93,14 @@ void UITask::notify(UIEventType t) {
#if defined(PIN_BUZZER)
switch(t){
case UIEventType::contactMessage:
// gemini's pick
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7");
// Play message sound using class member
buzzer.play(buzzer.message_song);
break;
case UIEventType::channelMessage:
buzzer.play("kerplop:d=16,o=6,b=120:32g#,32c#");
buzzer.play(buzzer.channel_song); // Play channel message sound
break;
case UIEventType::ack:
buzzer.play("ack:d=32,o=8,b=120:c");
buzzer.play(buzzer.ack_song); // Play ack sound
break;
case UIEventType::roomMessage:
case UIEventType::newContactMessage:

View file

@ -5,14 +5,20 @@
/* class abstracts underlying RTTTL library
Just a simple imlementation to start. At the moment use same
melody for message and discovery
Suggest enum type for different sounds
- on message
- on discovery
Just a simple implementation to start. Use RTTTL strings directly for different events.
Example usage:
genericBuzzer buzzer;
buzzer.begin();
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); // Play message sound
buzzer.play("Discovery:d=4,o=5,b=180:8e6,8d6,8c6"); // Play discovery sound
You can configure the melodies by changing the RTTTL strings in your code.
TODO
- make message ring tone configurable
- make message ring tone configurable at runtime
*/
@ -20,7 +26,7 @@ class genericBuzzer
{
public:
void begin(); // set up buzzer port
void play(const char *melody); // Generic play function
void play(const char *melody); // Play RTTTL melody
void loop(); // loop driven-nonblocking
void startup(); // play startup sound
void shutdown(); // play shutdown sound
@ -28,10 +34,14 @@ class genericBuzzer
void quiet(bool buzzer_state); // enables or disables the buzzer
bool isQuiet(); // get buzzer state on/off
private:
// gemini's picks:
const char *startup_song = "Startup:d=4,o=5,b=160:16c6,16e6,8g6";
const char *shutdown_song = "Shutdown:d=4,o=5,b=100:8g5,16e5,16c5";
// Example RTTTL melodies for startup/shutdown/message/discovery
const char *startup_song = "Startup:d=4,o=5,b=160:16c6,16e6,8g6";
const char *shutdown_song = "Shutdown:d=4,o=5,b=100:8g5,16e5,16c5";
const char *message_song = "MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7";
const char *discovery_song = "Discovery:d=4,o=5,b=180:8e6,8d6,8c6";
const char *channel_song = "kerplop:d=16,o=6,b=120:32g#,16c#"; // more of a "plop" sound for channel change
const char *ack_song = "ack:d=16,o=8,b=120:c8,c6"; // Two beeps: first high (C8), then low (C6)
private:
bool _is_quiet = true;
};