mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 13:41:28 +00:00
Factory reset on device state expired (#1695)
This commit is contained in:
parent
e93b98ff98
commit
accd23eddc
@ -259,7 +259,6 @@ void NodeDB::installDefaultDeviceState()
|
|||||||
void NodeDB::init()
|
void NodeDB::init()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Initializing NodeDB\n");
|
DEBUG_MSG("Initializing NodeDB\n");
|
||||||
// saveToDisk();
|
|
||||||
loadFromDisk();
|
loadFromDisk();
|
||||||
|
|
||||||
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
|
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
|
||||||
@ -374,19 +373,7 @@ void NodeDB::loadFromDisk()
|
|||||||
} else {
|
} else {
|
||||||
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
||||||
DEBUG_MSG("Warn: devicestate %d is old, discarding\n", devicestate.version);
|
DEBUG_MSG("Warn: devicestate %d is old, discarding\n", devicestate.version);
|
||||||
installDefaultDeviceState();
|
factoryReset();
|
||||||
#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
|
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Loaded saved devicestate version %d\n", devicestate.version);
|
DEBUG_MSG("Loaded saved devicestate version %d\n", devicestate.version);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ DeviceState versions used to be defined in the .proto file but really only this
|
|||||||
#define here.
|
#define here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEVICESTATE_CUR_VER 16
|
#define DEVICESTATE_CUR_VER 17
|
||||||
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
|
#define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER
|
||||||
|
|
||||||
extern DeviceState devicestate;
|
extern DeviceState devicestate;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
extends = nrf52840_base
|
extends = nrf52840_base
|
||||||
board = t-echo
|
board = t-echo
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
upload_protocol = jlink
|
|
||||||
# add our variants files to the include and src paths
|
# 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
|
# 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
|
# -DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30
|
||||||
|
Loading…
Reference in New Issue
Block a user