From 56ba94d8af9326e502c730026428cdd3a6b05d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Tu=C4=8Dek?= Date: Wed, 18 Dec 2024 16:36:24 +0100 Subject: [PATCH] Fix bond clearing. (Didn't work because of settings.) --- device/src/bt_pair.c | 4 ++++ device/src/main.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/device/src/bt_pair.c b/device/src/bt_pair.c index b2ed3143b..464232763 100644 --- a/device/src/bt_pair.c +++ b/device/src/bt_pair.c @@ -210,12 +210,16 @@ bool BtPair_IsDeviceBonded(const bt_addr_le_t *addr) void deleteBondIfUnknown(const struct bt_bond_info *info, void *user_data) { if (!HostConnections_IsKnownBleAddress(&info->addr)) { + printk(" - Deleting an unknown bond!\n"); deleteBond(info); + } else { + printk(" - Keeping a known bond.\n"); } }; void BtPair_ClearUnknownBonds() { + printk("Clearing bonds\n"); bt_foreach_bond(BT_ID_DEFAULT, deleteBondIfUnknown, NULL); UsbCommand_UpdateNewPairingsFlag(); } diff --git a/device/src/main.c b/device/src/main.c index 08e31897e..7c4ef95a9 100644 --- a/device/src/main.c +++ b/device/src/main.c @@ -129,6 +129,11 @@ int main(void) { Ledmap_InitLedLayout(); } + bt_enable(NULL); + + // has to be after bt_enable, has to be before ApplyConfig + InitSettings(); + // read configurations { InitFlash(); @@ -155,11 +160,6 @@ int main(void) { USB_EnableHid(); // has to be after USB_SetSerialNumber - bt_enable(NULL); - - // has to be after bt_enable - InitSettings(); - // has to be after InitSettings BtManager_InitBt(); BtManager_StartBt();