Skip to content

Commit 271ae77

Browse files
committed
pbio/sys/hmi: Fix waiting on Bluetooth to get ready.
When disabling, it should wait while ready, so until not ready. Fixes 660d728. This was only working on hubs with the btstack driver due to a change in the pbdrv_bluetooth_is_ready(), but we can revert that now.
1 parent 0bbc88f commit 271ae77

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/pbio/drv/bluetooth/bluetooth_btstack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ void pbdrv_bluetooth_power_on(bool on) {
627627
}
628628

629629
bool pbdrv_bluetooth_is_ready(void) {
630-
return hci_get_state() != HCI_STATE_OFF || !pbdrv_bluetooth_powered_on;
630+
return hci_get_state() != HCI_STATE_OFF;
631631
}
632632

633633
const char *pbdrv_bluetooth_get_hub_name(void) {

lib/pbio/sys/hmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static pbio_error_t pbsys_hmi_monitor_bluetooth_state(pbio_os_state_t *state) {
188188

189189
// Start with Bluetooth off.
190190
pbdrv_bluetooth_power_on(false);
191-
PBIO_OS_AWAIT_UNTIL(state, pbdrv_bluetooth_is_ready());
191+
PBIO_OS_AWAIT_WHILE(state, pbdrv_bluetooth_is_ready());
192192
// Hack: this is a remnant of pbsys/bluetooth. It needs to be included
193193
// in the pbdrv_bluetooth_power_on(false) once it is made awaitable.
194194
static pbio_os_timer_t timer;

0 commit comments

Comments
 (0)