From 67bc6b1419ab255e716e37aa834f3a0a7047d3e6 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Thu, 17 Mar 2022 17:49:02 +0000 Subject: [PATCH 1/3] try to reset values on nrf using nodeDB methods --- src/mesh/NodeDB.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 5eb8320a..ca81fb03 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -105,6 +105,13 @@ bool NodeDB::resetRadioConfig() Bluefruit.Periph.clearBonds(); Bluefruit.Central.clearBonds(); + + installDefaultDeviceState(); + installDefaultRadioConfig(); + installDefaultChannels(); + saveToDisk(); + saveChannelsToDisk(); + #endif didFactoryReset = true; } From d57ac39b0215bb92d24eda8793b5bf5efa518f6a Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Thu, 17 Mar 2022 18:08:39 +0000 Subject: [PATCH 2/3] move the factory reset stuff above the ble bonds --- src/mesh/NodeDB.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index ca81fb03..204efcda 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -97,6 +97,13 @@ bool NodeDB::resetRadioConfig() nvs_flash_erase(); #endif #ifdef NRF52_SERIES + + installDefaultDeviceState(); + installDefaultRadioConfig(); + installDefaultChannels(); + saveToDisk(); + saveChannelsToDisk(); + Bluefruit.begin(); DEBUG_MSG("Clearing bluetooth bonds!\n"); @@ -106,11 +113,6 @@ bool NodeDB::resetRadioConfig() Bluefruit.Periph.clearBonds(); Bluefruit.Central.clearBonds(); - installDefaultDeviceState(); - installDefaultRadioConfig(); - installDefaultChannels(); - saveToDisk(); - saveChannelsToDisk(); #endif didFactoryReset = true; From e6731e28c1dd5db9667aa7f4eb059ddd5ac1635b Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Thu, 17 Mar 2022 18:33:30 +0000 Subject: [PATCH 3/3] try removing the /prefs dir --- src/mesh/NodeDB.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 204efcda..3ce28d24 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -97,22 +97,16 @@ bool NodeDB::resetRadioConfig() nvs_flash_erase(); #endif #ifdef NRF52_SERIES + FS.rmdir_r("/prefs"); - installDefaultDeviceState(); - installDefaultRadioConfig(); - installDefaultChannels(); - saveToDisk(); - saveChannelsToDisk(); + Bluefruit.begin(); - Bluefruit.begin(); - - DEBUG_MSG("Clearing bluetooth bonds!\n"); - bond_print_list(BLE_GAP_ROLE_PERIPH); - bond_print_list(BLE_GAP_ROLE_CENTRAL); - - Bluefruit.Periph.clearBonds(); - Bluefruit.Central.clearBonds(); + DEBUG_MSG("Clearing bluetooth bonds!\n"); + bond_print_list(BLE_GAP_ROLE_PERIPH); + bond_print_list(BLE_GAP_ROLE_CENTRAL); + Bluefruit.Periph.clearBonds(); + Bluefruit.Central.clearBonds(); #endif didFactoryReset = true;