Skip to content

Commit b1692d8

Browse files
committed
pbio/sys/hmi_none: Check for shutdown at least once.
If shutdown was already requested before the HMI ran, exit right away. Allows hub.system.shutdown() to work in the simulated hub.
1 parent 76893f6 commit b1692d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/pbio/sys/hmi_none.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ void pbsys_hmi_deinit(void) {
2525

2626
pbio_error_t pbsys_hmi_await_program_selection(void) {
2727

28-
while (pbdrv_button_get_pressed()) {
28+
do {
2929
if (pbsys_status_test(PBIO_PYBRICKS_STATUS_SHUTDOWN_REQUEST)) {
3030
return PBIO_ERROR_CANCELED;
3131
}
3232
pbio_os_run_processes_and_wait_for_event();
33-
}
33+
} while (pbdrv_button_get_pressed());
3434

3535
return pbsys_main_program_request_start(PBIO_PYBRICKS_USER_PROGRAM_ID_REPL, PBSYS_MAIN_PROGRAM_START_REQUEST_TYPE_BOOT);
3636
}

0 commit comments

Comments
 (0)