Skip to content

Commit e297f3a

Browse files
committed
pbio/sys/hmi: Fix REPL auto-start.
When auto-starting the REPL, it shouldn't try to run the UI. On EV3, there isn't a compatible UI yet. Fixes pybricks/support#2290
1 parent f66b96d commit e297f3a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/pbio/sys/hmi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ static pbio_error_t pbsys_hmi_monitor_bluetooth_state(pbio_os_state_t *state) {
247247
* ::PBIO_ERROR_TIMEDOUT when there was no user interaction for a long time.
248248
*/
249249
pbio_error_t pbsys_hmi_await_program_selection(void) {
250+
251+
#if PBSYS_CONFIG_USER_PROGRAM_AUTO_START
252+
// Skip any UI, always just start the REPL.
253+
pbsys_main_program_request_start(PBIO_PYBRICKS_USER_PROGRAM_ID_REPL, PBSYS_MAIN_PROGRAM_START_REQUEST_TYPE_BOOT);
254+
return PBIO_SUCCESS;
255+
#endif
256+
250257
pbio_os_state_t btn_state = 0;
251258
pbio_os_state_t ble_state = 0;
252259

lib/pbio/sys/main.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ int main(int argc, char **argv) {
8888
// Keep loading and running user programs until shutdown is requested.
8989
for (;;) {
9090

91-
#if PBSYS_CONFIG_USER_PROGRAM_AUTO_START
92-
pbsys_main_program_request_start(PBIO_PYBRICKS_USER_PROGRAM_ID_REPL, PBSYS_MAIN_PROGRAM_START_REQUEST_TYPE_BOOT);
93-
#endif
94-
9591
// Drives all processes while waiting for user input. This completes
9692
// when a user program request is made using the buttons or by a
9793
// connected host. It is cancelled on shutdown request or idle timeout.

0 commit comments

Comments
 (0)