From 0dff4538f3c18b4aa792183864a63e6b2ebcea59 Mon Sep 17 00:00:00 2001 From: lewis Date: Sat, 26 Nov 2022 00:17:54 +0800 Subject: [PATCH 1/2] Add t-echo to the operation after the flash operation fails --- src/mesh/NodeDB.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index c548b0acc..5009a2697 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -475,6 +475,15 @@ bool saveProto(const char *filename, size_t protoSize, size_t objSize, const pb_ DEBUG_MSG("Error: can't rename new pref file\n"); } else { DEBUG_MSG("Can't write prefs\n"); +#ifdef ARCH_NRF52 + static uint8_t failedCounter = 0; + failedCounter++; + if(failedCounter >= 2){ + FSCom.format(); + //After formatting, the device needs to be restarted + nodeDB.resetRadioConfig(); + } +#endif } #else DEBUG_MSG("ERROR: Filesystem not implemented\n"); From cdd499f1472d5bef2d301917ad5246d72cea817f Mon Sep 17 00:00:00 2001 From: lewis Date: Sat, 26 Nov 2022 12:10:10 +0800 Subject: [PATCH 2/2] Add missing restart parameters --- src/mesh/NodeDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 5009a2697..6b2d5bfb3 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -481,7 +481,7 @@ bool saveProto(const char *filename, size_t protoSize, size_t objSize, const pb_ if(failedCounter >= 2){ FSCom.format(); //After formatting, the device needs to be restarted - nodeDB.resetRadioConfig(); + nodeDB.resetRadioConfig(true); } #endif }