From accd23eddce0af932f6271751baf0bdc89015f0a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 15 Sep 2022 12:15:16 -0500 Subject: [PATCH] Factory reset on device state expired (#1695) --- src/mesh/NodeDB.cpp | 15 +-------------- src/mesh/NodeDB.h | 2 +- variants/t-echo/platformio.ini | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 9af5b39b2..156017491 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -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); } diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 85dfd741e..f609718a9 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -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; diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index 0544a69a0..73b2ae059 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -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