Skip to content

Commit 416a29e

Browse files
committed
drv/bluetooth_stm32_cc2640: fix technic hub broadcast
Broadcasting was not working on Technic hub when it was not connected to another device (e.g. computer or remote control). This adds a check for connected state and applies the same hack of using ADV_IND like City hub if needed. Fixes: pybricks/support#1086
1 parent d80df1a commit 416a29e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
### Fixed
1414
- Fixed BLE broadcast not working on City hub.
1515
- Fixed crash on BTStack hubs when program stopped during call to `ble.broadcast()`.
16+
- Fixed BLE broadcast not working on Technic hub when not connected ([support#1086]).
1617

1718
[support#402]: https://github.com/pybricks/support/issues/402
19+
[support#1086]: https://github.com/pybricks/support/issues/402
1820

1921
## [3.3.0b5] - 2023-05-16
2022

lib/pbio/drv/bluetooth/bluetooth_stm32_cc2640.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,10 @@ static PT_THREAD(broadcast_task(struct pt *pt, pbio_task_t *task)) {
864864
// send something over the air.
865865
ADV_IND,
866866
#else
867-
ADV_NONCONN_IND,
867+
// Technic hub will send non-connectable advertisements only if
868+
// it is connected to something else, otherwise we need the same
869+
// hack as the City hub.
870+
(conn_handle == NO_CONNECTION && remote_handle == NO_CONNECTION) ? ADV_IND : ADV_NONCONN_IND,
868871
#endif
869872
GAP_INITIATOR_ADDR_TYPE_PRIVATE_NON_RESOLVE, NULL,
870873
GAP_CHANNEL_MAP_ALL, GAP_FILTER_POLICY_SCAN_ANY_CONNECT_ANY);

0 commit comments

Comments
 (0)