File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 4848#define CMD_GET_TUNING_PARAMS 43
4949// NOTE: CMD range 44..49 parked, potentially for WiFi operations
5050#define CMD_SEND_BINARY_REQ 50
51+ #define CMD_FACTORY_RESET 51
5152
5253#define RESP_CODE_OK 0
5354#define RESP_CODE_ERR 1
@@ -1361,6 +1362,15 @@ void MyMesh::handleCmdFrame(size_t len) {
13611362 } else {
13621363 writeErrFrame (ERR_CODE_NOT_FOUND);
13631364 }
1365+ } else if (cmd_frame[0 ] == CMD_FACTORY_RESET && memcmp (&cmd_frame[1 ], " reset" , 5 ) == 0 ) {
1366+ bool success = _store->formatFileSystem ();
1367+ if (success) {
1368+ writeOKFrame ();
1369+ delay (1000 );
1370+ board.reboot (); // doesn't return
1371+ } else {
1372+ writeErrFrame (ERR_CODE_FILE_IO_ERROR);
1373+ }
13641374 } else {
13651375 writeErrFrame (ERR_CODE_UNSUPPORTED_CMD);
13661376 MESH_DEBUG_PRINTLN (" ERROR: unknown command: %02X" , cmd_frame[0 ]);
You can’t perform that action at this time.
0 commit comments