Factory reset on device state expired (#1695)

This commit is contained in:
Ben Meadors 2022-09-15 12:15:16 -05:00 committed by GitHub
parent e93b98ff98
commit accd23eddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 16 deletions

View File

@ -259,7 +259,6 @@ void NodeDB::installDefaultDeviceState()
void NodeDB::init()
{
DEBUG_MSG("Initializing NodeDB\n");
// saveToDisk();
loadFromDisk();
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
@ -374,19 +373,7 @@ void NodeDB::loadFromDisk()
} else {
if (devicestate.version < DEVICESTATE_MIN_VER) {
DEBUG_MSG("Warn: devicestate %d is old, discarding\n", devicestate.version);
installDefaultDeviceState();
#ifdef ARCH_ESP32
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
nvs_flash_erase();
#endif
#ifdef ARCH_NRF52
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();
#endif
factoryReset();
} else {
DEBUG_MSG("Loaded saved devicestate version %d\n", devicestate.version);
}

View File

@ -13,7 +13,7 @@ DeviceState versions used to be defined in the .proto file but really only this
#define here.
*/
#define DEVICESTATE_CUR_VER 16
#define DEVICESTATE_CUR_VER 17
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
extern DeviceState devicestate;

View File

@ -3,7 +3,7 @@
extends = nrf52840_base
board = t-echo
debug_tool = jlink
upload_protocol = jlink
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library - NOTE: WE NOT LONGER USE TFT_eSPI, it was for an earlier version of the TTGO eink screens
# -DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30