Report an error when the buzzer setting fails to save
This commit is contained in:
1 parent
bb84f293b7
commit
0769d68ed6
1 file changed
+16
-10
@@ -70,17 +70,23 @@ bool T1000eBoard::handleCommand(const char* command, uint32_t sender_timestamp,
|
|||||||
}
|
}
|
||||||
if (memcmp(command, "set buzzer ", 11) == 0) {
|
if (memcmp(command, "set buzzer ", 11) == 0) {
|
||||||
if (strcmp(&command[11], "on") == 0) {
|
if (strcmp(&command[11], "on") == 0) {
|
||||||
_buzzer_mute_pending = false;
|
if (_prefs && !_prefs->setByKey("buzzer", "1")) {
|
||||||
setBuzzerEnabled(true);
|
strcpy(reply, "Error: failed to save buzzer setting");
|
||||||
if (_prefs) _prefs->setByKey("buzzer", "1");
|
} else {
|
||||||
playTune("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); // same tune as a new message
|
_buzzer_mute_pending = false;
|
||||||
strcpy(reply, "OK - buzzer on");
|
setBuzzerEnabled(true);
|
||||||
|
playTune("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); // same tune as a new message
|
||||||
|
strcpy(reply, "OK - buzzer on");
|
||||||
|
}
|
||||||
} else if (strcmp(&command[11], "off") == 0) {
|
} else if (strcmp(&command[11], "off") == 0) {
|
||||||
setBuzzerEnabled(true);
|
if (_prefs && !_prefs->setByKey("buzzer", "0")) {
|
||||||
_buzzer_mute_pending = true;
|
strcpy(reply, "Error: failed to save buzzer setting");
|
||||||
if (_prefs) _prefs->setByKey("buzzer", "0");
|
} else {
|
||||||
playTune("ack:d=32,o=8,b=120:c"); // same beep as an ack, before going quiet
|
setBuzzerEnabled(true);
|
||||||
strcpy(reply, "OK - buzzer off");
|
_buzzer_mute_pending = true;
|
||||||
|
playTune("ack:d=32,o=8,b=120:c"); // same beep as an ack, before going quiet
|
||||||
|
strcpy(reply, "OK - buzzer off");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
strcpy(reply, "Error: state must be on or off");
|
strcpy(reply, "Error: state must be on or off");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user