Skip to content

Commit ccafa60

Browse files
committed
pbio/sys/hmi: Allow shutdown in auto program-start case.
Otherwise, it will forever restart the REPL.
1 parent 851c0c5 commit ccafa60

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/pbio/sys/hmi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ static pbio_error_t pbsys_hmi_monitor_bluetooth_state(pbio_os_state_t *state) {
258258
pbio_error_t pbsys_hmi_await_program_selection(void) {
259259

260260
#if PBSYS_CONFIG_USER_PROGRAM_AUTO_START
261-
// Skip any UI, always just start the REPL.
261+
// Skip any UI, always just start the REPL except on shutdown.
262+
if (pbsys_status_test(PBIO_PYBRICKS_STATUS_SHUTDOWN_REQUEST)) {
263+
return PBIO_ERROR_CANCELED;
264+
}
262265
pbsys_main_program_request_start(PBIO_PYBRICKS_USER_PROGRAM_ID_REPL, PBSYS_MAIN_PROGRAM_START_REQUEST_TYPE_BOOT);
263266
return PBIO_SUCCESS;
264267
#endif

0 commit comments

Comments
 (0)