Merge pull request #3603 from A13xB0/companion-buzzer-cli
Add CLI command to toggle the buzzer for companions
This commit is contained in:
commit
b09b12d4ef
4 files changed
+20
No files matched your search
@@ -2124,6 +2124,23 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
if (strcmp(command, "get buzzer") == 0) {
|
||||
sprintf(reply, "> %s", _prefs.buzzer_quiet ? "off" : "on");
|
||||
return true;
|
||||
}
|
||||
if (memcmp(command, "set buzzer ", 11) == 0) {
|
||||
if (strcmp(&command[11], "on") == 0 || strcmp(&command[11], "off") == 0) {
|
||||
_prefs.buzzer_quiet = strcmp(&command[11], "off") == 0;
|
||||
savePrefs();
|
||||
strcpy(reply, "OK");
|
||||
} else {
|
||||
strcpy(reply, "Error: state must be on or off");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (memcmp(command, "set pin ", 8) == 0) {
|
||||
_prefs.ble_pin = atoi(&command[8]);
|
||||
savePrefs();
|
||||
|
||||
@@ -1052,6 +1052,7 @@ void UITask::loop() {
|
||||
userLedHandler();
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
if (buzzer.isQuiet() != (bool)_node_prefs->buzzer_quiet) buzzer.quiet(_node_prefs->buzzer_quiet);
|
||||
if (buzzer.isPlaying()) buzzer.loop();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -485,6 +485,7 @@ void UITask::loop() {
|
||||
userLedHandler();
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
if (buzzer.isQuiet() != (bool)_node_prefs->buzzer_quiet) buzzer.quiet(_node_prefs->buzzer_quiet);
|
||||
if (buzzer.isPlaying()) buzzer.loop();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -691,6 +691,7 @@ void UITask::loop() {
|
||||
userLedHandler();
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
if (buzzer.isQuiet() != (bool)_node_prefs->buzzer_quiet) buzzer.quiet(_node_prefs->buzzer_quiet);
|
||||
if (buzzer.isPlaying()) buzzer.loop();
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user