Skip to content

Commit 15f821b

Browse files
committed
pbio/sys/bluetooth: Show enabled light right away.
This makes it show correctly even if already disabled on boot.
1 parent d1b66d1 commit 15f821b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

lib/pbio/sys/bluetooth.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ PROCESS_THREAD(pbsys_bluetooth_process, ev, data) {
327327
pbdrv_bluetooth_set_receive_handler(handle_receive);
328328

329329
while (!pbsys_status_test(PBIO_PYBRICKS_STATUS_SHUTDOWN)) {
330+
331+
// Show inactive status only if user requested Bluetooth as disabled to
332+
// avoid always flashing red in between program runs when disconnected.
333+
if (!settings->bluetooth_ble_user_enabled) {
334+
pbsys_status_light_bluetooth_set_color(PBIO_COLOR_RED);
335+
}
336+
330337
// make sure the Bluetooth chip is in reset long enough to actually reset
331338
etimer_set(&timer, 150);
332339
PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER && etimer_expired(&timer));
@@ -411,12 +418,6 @@ PROCESS_THREAD(pbsys_bluetooth_process, ev, data) {
411418
reset_all();
412419
PROCESS_WAIT_WHILE(pbsys_status_test(PBIO_PYBRICKS_STATUS_USER_PROGRAM_RUNNING));
413420

414-
// Indicate status only if user requested Bluetooth to be disabled to
415-
// avoid always flashing red in between program runs when disconnected.
416-
if (!settings->bluetooth_ble_user_enabled) {
417-
pbsys_status_light_bluetooth_set_color(PBIO_COLOR_RED);
418-
}
419-
420421
// reset Bluetooth chip
421422
pbdrv_bluetooth_power_on(false);
422423
PROCESS_WAIT_WHILE(pbdrv_bluetooth_is_ready());

0 commit comments

Comments
 (0)