* companion: added CMD_FACTORY_RESET (51)
This commit is contained in:
@@ -48,6 +48,7 @@
|
|||||||
#define CMD_GET_TUNING_PARAMS 43
|
#define CMD_GET_TUNING_PARAMS 43
|
||||||
// NOTE: CMD range 44..49 parked, potentially for WiFi operations
|
// NOTE: CMD range 44..49 parked, potentially for WiFi operations
|
||||||
#define CMD_SEND_BINARY_REQ 50
|
#define CMD_SEND_BINARY_REQ 50
|
||||||
|
#define CMD_FACTORY_RESET 51
|
||||||
|
|
||||||
#define RESP_CODE_OK 0
|
#define RESP_CODE_OK 0
|
||||||
#define RESP_CODE_ERR 1
|
#define RESP_CODE_ERR 1
|
||||||
@@ -1361,6 +1362,15 @@ void MyMesh::handleCmdFrame(size_t len) {
|
|||||||
} else {
|
} else {
|
||||||
writeErrFrame(ERR_CODE_NOT_FOUND);
|
writeErrFrame(ERR_CODE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
} else if (cmd_frame[0] == CMD_FACTORY_RESET && memcmp(&cmd_frame[1], "reset", 5) == 0) {
|
||||||
|
bool success = _store->formatFileSystem();
|
||||||
|
if (success) {
|
||||||
|
writeOKFrame();
|
||||||
|
delay(1000);
|
||||||
|
board.reboot(); // doesn't return
|
||||||
|
} else {
|
||||||
|
writeErrFrame(ERR_CODE_FILE_IO_ERROR);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
writeErrFrame(ERR_CODE_UNSUPPORTED_CMD);
|
writeErrFrame(ERR_CODE_UNSUPPORTED_CMD);
|
||||||
MESH_DEBUG_PRINTLN("ERROR: unknown command: %02X", cmd_frame[0]);
|
MESH_DEBUG_PRINTLN("ERROR: unknown command: %02X", cmd_frame[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user