Skip to content

Commit 65131f9

Browse files
committed
pbio/sys/hmi_pup: Change when advertising blink stops.
It is more intuitive to keep it on until the program starts or until you shut down.
1 parent 39bc99e commit 65131f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/pbio/sys/hmi_pup.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ static pbio_error_t run_ui(pbio_os_state_t *state, pbio_os_timer_t *timer) {
194194

195195
// Stop advertising if we are still doing so.
196196
if (pbsys_status_test(PBIO_PYBRICKS_STATUS_BLE_ADVERTISING)) {
197-
pbsys_status_clear(PBIO_PYBRICKS_STATUS_BLE_ADVERTISING);
198197
DEBUG_PRINT("Stop advertising on HMI exit.\n");
199198
pbdrv_bluetooth_start_advertising(false);
200199
PBIO_OS_AWAIT(state, &sub, pbdrv_bluetooth_await_advertise_or_scan_command(&sub, NULL));
@@ -210,6 +209,11 @@ static pbio_error_t run_ui(pbio_os_state_t *state, pbio_os_timer_t *timer) {
210209
pbdrv_button_get_pressed();
211210
}));
212211

212+
// We have already stopped advertising above, but it is nicer to keep the
213+
// visual active until you release the button. Otherwise, it appears as if
214+
// the hub is already off when you are shutting down.
215+
pbsys_status_clear(PBIO_PYBRICKS_STATUS_BLE_ADVERTISING);
216+
213217
// Start run animations
214218
pbsys_hub_light_matrix_handle_user_program_start();
215219
#if PBSYS_CONFIG_STATUS_LIGHT_STATE_ANIMATIONS

0 commit comments

Comments
 (0)