Skip to content

Commit c22ae25

Browse files
committed
pybricks.messaging.BLERadio: Fix observe not working if hub instantiated later.
The backwards compatibility condition was correctly caught, but the radio would re-initialize anyway.
1 parent cb3d1e5 commit c22ae25

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
[Unreleased]: https://github.com/pybricks/pybricks-micropython/compare/v4.0.0b11...HEAD
88

9+
### Fixed
10+
- Fixed `BLERadio.observe()` not working if a hub was instantiated
11+
after `BLERadio` ([support#2734]).
12+
13+
[support#2734]: https://github.com/pybricks/support/issues/2734
14+
915
## [4.0.0] - 2026-06-08
1016

1117
### Changed

pybricks/messaging/pb_type_ble_radio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,9 @@ static mp_obj_t pb_type_ble_radio_make_new(const mp_obj_type_t *type, size_t n_a
586586
mp_obj_t pb_type_BLE_new(mp_obj_t broadcast_channel_in, mp_obj_t observe_channels_in) {
587587
if (broadcast_channel_in != mp_const_none || observe_channels_in != MP_OBJ_FROM_PTR(&mp_const_empty_tuple_obj)) {
588588
mp_printf(&mp_plat_print, "Hub messaging has been moved. You should use:\n\nfrom pybricks.messaging import BLERadio\nradio = BLERadio(broadcast_channel, observe_channels)\n\n");
589+
return pb_type_ble_radio_init(broadcast_channel_in, observe_channels_in);
589590
}
590-
return pb_type_ble_radio_init(broadcast_channel_in, observe_channels_in);
591+
return mp_const_none;
591592
}
592593
#endif // PYBRICKS_PY_MESSAGING_BLE_RADIO_OLD
593594

0 commit comments

Comments
 (0)