Skip to content

Commit

Permalink
drv/bluetooth_stm32_bluenrg: use random address
Browse files Browse the repository at this point in the history
This changes the driver to use a random Bluetooth address when
advertising/accepting connections. This will help prevent issues with
Bluetooth stacks caching the attribute database of the official LEGO
firmware and trying to use it for the Pybricks firmware or vice versa.

The Bluetooth chip appears to use the same random address after each
reset, so we don't get the full benefit avoiding caching issues when
the Pybricks firmware GATT database changes.

Issue: pybricks/support#600
  • Loading branch information
dlech committed Oct 20, 2022
1 parent 5046a36 commit c17c33f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pbio/drv/bluetooth/bluetooth_stm32_bluenrg.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static PT_THREAD(set_discoverable(struct pt *pt, pbio_task_t *task)) {
hci_le_set_scan_response_data_end();

PT_WAIT_WHILE(pt, write_xfer_size);
aci_gap_set_discoverable_begin(ADV_IND, 0, 0, PUBLIC_ADDR, NO_WHITE_LIST_USE,
aci_gap_set_discoverable_begin(ADV_IND, 0, 0, RANDOM_ADDR, NO_WHITE_LIST_USE,
0, NULL, sizeof(service_uuids), service_uuids, 0, 0);
PT_WAIT_UNTIL(pt, hci_command_complete);
aci_gap_set_discoverable_end();
Expand Down

0 comments on commit c17c33f

Please sign in to comment.