* IdentityStore::save() was failing on RAK.

* Repeater: CLI 'erase' command added.
This commit is contained in:
Scott Powell 2025-02-04 01:35:04 +11:00
parent a0bb332ce5
commit 29e62b9ce2
5 changed files with 23 additions and 3 deletions

View file

@ -498,6 +498,15 @@ public:
} else {
sprintf(reply, "unknown config: %s", config);
}
} else if (sender_timestamp == 0 && strcmp(command, "erase") == 0) {
#if defined(NRF52_PLATFORM)
bool s = InternalFS.format();
#elif defined(ESP32)
bool s = SPIFFS.format();
#else
#error "need to implement file system erase"
#endif
sprintf(reply, "File system erase: %s", s ? "OK" : "Err");
} else if (memcmp(command, "ver", 3) == 0) {
strcpy(reply, FIRMWARE_VER_TEXT);
} else {
@ -576,7 +585,7 @@ void setup() {
#if defined(NRF52_PLATFORM)
InternalFS.begin();
fs = &InternalFS;
IdentityStore store(InternalFS, "/identity");
IdentityStore store(InternalFS, "");
#elif defined(ESP32)
SPIFFS.begin(true);
fs = &SPIFFS;
@ -585,6 +594,7 @@ void setup() {
#error "need to define filesystem"
#endif
if (!store.load("_main", the_mesh.self_id)) {
MESH_DEBUG_PRINTLN("Generating new keypair");
RadioNoiseListener rng(radio);
the_mesh.self_id = mesh::LocalIdentity(&rng); // create new random identity
store.save("_main", the_mesh.self_id);