Skip to content

Commit a67ce01

Browse files
committed
pbio/sys/core: Monitor disconnection change.
This is a basic test to unset the connection status to clear the Bluetooth light. This is expected to be generalized when we complete USB support with a proper status indicator. For now, this suffices to avoid introducing a regression after the recent Bluetooth overhaul. Fixes: pybricks/support#2355
1 parent adf3ca2 commit a67ce01

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/pbio/sys/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <stdint.h>
55

6+
#include <pbdrv/bluetooth.h>
67
#include <pbdrv/watchdog.h>
78

89
#include <pbio/busy_count.h>
@@ -37,6 +38,11 @@ PROCESS_THREAD(pbsys_system_process, ev, data) {
3738
pbsys_program_stop_poll();
3839
pbsys_status_light_poll();
3940

41+
// Revisit: Use pbio/sys/host callback to indicate connection changes.
42+
if (!pbdrv_bluetooth_is_connected(PBDRV_BLUETOOTH_CONNECTION_LE)) {
43+
pbsys_status_clear(PBIO_PYBRICKS_STATUS_BLE_HOST_CONNECTED);
44+
}
45+
4046
// keep the hub from resetting itself
4147
pbdrv_watchdog_update();
4248
}

0 commit comments

Comments
 (0)