Add option to wipe BLE bonds

This commit is contained in:
jacob.eva 2024-10-23 11:16:13 +01:00
parent a60ad3445e
commit 860fe3c005
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E
3 changed files with 10 additions and 1 deletions

View File

@ -371,6 +371,12 @@ char bt_devname[11];
#elif MCU_VARIANT == MCU_NRF52 #elif MCU_VARIANT == MCU_NRF52
uint8_t eeprom_read(uint32_t mapped_addr); uint8_t eeprom_read(uint32_t mapped_addr);
void bt_bond_wipe() {
// Delete all bonding data
Bluefruit.Periph.clearBonds();
led_indicate_info(2);
}
void bt_stop() { void bt_stop() {
if (bt_state != BT_STATE_OFF) { if (bt_state != BT_STATE_OFF) {
bt_allow_pairing = false; bt_allow_pairing = false;

View File

@ -22,6 +22,7 @@
#define BUTTON_MIN_DURATION 50 #define BUTTON_MIN_DURATION 50
#define BUTTON_3S_DURATION 3000 #define BUTTON_3S_DURATION 3000
#define BUTTON_6S_DURATION 6000 #define BUTTON_6S_DURATION 6000
#define BUTTON_9S_DURATION 9000
#define EVENT_ALL 0x00 #define EVENT_ALL 0x00
#define EVENT_CLICKS 0x01 #define EVENT_CLICKS 0x01

View File

@ -1489,7 +1489,9 @@ void process_serial() {
#if HAS_INPUT #if HAS_INPUT
void button_event(uint8_t event, unsigned long duration) { void button_event(uint8_t event, unsigned long duration) {
if (duration > BUTTON_MIN_DURATION) { if (duration > BUTTON_MIN_DURATION) {
if (duration > BUTTON_6S_DURATION) { if (duration > BUTTON_9S_DURATION) {
bt_bond_wipe();
} else if (duration > BUTTON_6S_DURATION) {
bt_stop(); bt_stop();
bt_conf_save(false); bt_conf_save(false);
} else if (duration > BUTTON_3S_DURATION) { } else if (duration > BUTTON_3S_DURATION) {