From 860fe3c005f55105ac622e2777f780167d19c233 Mon Sep 17 00:00:00 2001 From: "jacob.eva" Date: Wed, 23 Oct 2024 11:16:13 +0100 Subject: [PATCH] Add option to wipe BLE bonds --- Bluetooth.h | 6 ++++++ Input.h | 1 + opencom_xl_firmware.ino | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Bluetooth.h b/Bluetooth.h index 5812b8e..e9a07e3 100644 --- a/Bluetooth.h +++ b/Bluetooth.h @@ -371,6 +371,12 @@ char bt_devname[11]; #elif MCU_VARIANT == MCU_NRF52 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() { if (bt_state != BT_STATE_OFF) { bt_allow_pairing = false; diff --git a/Input.h b/Input.h index 86793da..00342ab 100644 --- a/Input.h +++ b/Input.h @@ -22,6 +22,7 @@ #define BUTTON_MIN_DURATION 50 #define BUTTON_3S_DURATION 3000 #define BUTTON_6S_DURATION 6000 + #define BUTTON_9S_DURATION 9000 #define EVENT_ALL 0x00 #define EVENT_CLICKS 0x01 diff --git a/opencom_xl_firmware.ino b/opencom_xl_firmware.ino index 0992e66..72094e1 100644 --- a/opencom_xl_firmware.ino +++ b/opencom_xl_firmware.ino @@ -1489,7 +1489,9 @@ void process_serial() { #if HAS_INPUT void button_event(uint8_t event, unsigned long 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_conf_save(false); } else if (duration > BUTTON_3S_DURATION) {