Skip to content

Commit

Permalink
Fix bond clearing. (Didn't work because of settings.)
Browse files Browse the repository at this point in the history
  • Loading branch information
kareltucek committed Dec 18, 2024
1 parent 257e3fe commit 56ba94d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions device/src/bt_pair.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
10 changes: 5 additions & 5 deletions device/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 56ba94d

Please sign in to comment.