Clear bluetooth bonds on multi-press and factory_reset (#1176)

* Clear bluetooth bonds on multi-press and factory_reset
This commit is contained in:
Ben Meadors
2022-02-01 18:32:26 -06:00
committed by GitHub
parent dd31a829fb
commit b21b7de04b
6 changed files with 40 additions and 2 deletions

View File

@@ -26,6 +26,11 @@
#include <nvs_flash.h>
#endif
#ifdef NRF52_SERIES
#include <bluefruit.h>
#include <utility/bonding.h>
#endif
NodeDB nodeDB;
// we have plenty of ram so statically alloc this tempbuf (for now)
@@ -90,6 +95,16 @@ bool NodeDB::resetRadioConfig()
#ifndef NO_ESP32
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
nvs_flash_erase();
#endif
#ifdef NRF52_SERIES
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
didFactoryReset = true;
}