mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 23:08:11 +00:00
Buzzer: add playForced(); fix per-channel force-on notification ignoring global mute
buzzer.play() was returning early when _is_quiet=true, so channels with explicit notification=ON were silent even though the logic correctly set play=true. playForced() bypasses the quiet check for these overrides. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,18 +15,18 @@ void genericBuzzer::begin() {
|
||||
}
|
||||
|
||||
void genericBuzzer::play(const char *melody) {
|
||||
if (isPlaying()) // interrupt existing
|
||||
{
|
||||
rtttl::stop();
|
||||
}
|
||||
|
||||
if (isPlaying()) rtttl::stop();
|
||||
if (_is_quiet) return;
|
||||
|
||||
rtttl::begin(PIN_BUZZER,melody);
|
||||
rtttl::begin(PIN_BUZZER, melody);
|
||||
// Serial.print("DBG: Playing melody - isQuiet: ");
|
||||
// Serial.println(isQuiet());
|
||||
}
|
||||
|
||||
void genericBuzzer::playForced(const char *melody) {
|
||||
if (isPlaying()) rtttl::stop();
|
||||
rtttl::begin(PIN_BUZZER, melody);
|
||||
}
|
||||
|
||||
bool genericBuzzer::isPlaying() {
|
||||
return rtttl::isPlaying();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ class genericBuzzer
|
||||
{
|
||||
public:
|
||||
void begin(); // set up buzzer port
|
||||
void play(const char *melody); // Generic play function
|
||||
void play(const char *melody);
|
||||
void playForced(const char *melody); // play regardless of quiet state
|
||||
void loop(); // loop driven-nonblocking
|
||||
void startup(); // play startup sound
|
||||
void shutdown(); // play shutdown sound
|
||||
|
||||
Reference in New Issue
Block a user