From 9ee116c452e6569d70cdebaade5dd25a1555b82b Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 6 May 2021 10:49:43 +1000 Subject: [PATCH] stm32/boardctrl: Adjust logic for running boot.py, main.py. This new logic is equivalent to the old logic when the only possibilities for reset_mode are NORMAL, SAFE_MODE and FILESYSTEM, which is the standard case. But the new logic also allows other reset_mode values (eg BOOTLOADER) to run boot.py and main.py. Signed-off-by: Damien George --- ports/stm32/boardctrl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ports/stm32/boardctrl.c b/ports/stm32/boardctrl.c index 8cc519d8e9..f1b7a4e81c 100644 --- a/ports/stm32/boardctrl.c +++ b/ports/stm32/boardctrl.c @@ -143,8 +143,7 @@ void boardctrl_top_soft_reset_loop(boardctrl_state_t *state) { } int boardctrl_run_boot_py(boardctrl_state_t *state) { - bool run_boot_py = state->reset_mode == BOARDCTRL_RESET_MODE_NORMAL - || state->reset_mode == BOARDCTRL_RESET_MODE_FACTORY_FILESYSTEM; + bool run_boot_py = state->reset_mode != BOARDCTRL_RESET_MODE_SAFE_MODE; if (run_boot_py) { // Run boot.py, if it exists. @@ -176,8 +175,7 @@ int boardctrl_run_boot_py(boardctrl_state_t *state) { } int boardctrl_run_main_py(boardctrl_state_t *state) { - bool run_main_py = (state->reset_mode == BOARDCTRL_RESET_MODE_NORMAL - || state->reset_mode == BOARDCTRL_RESET_MODE_FACTORY_FILESYSTEM) + bool run_main_py = state->reset_mode != BOARDCTRL_RESET_MODE_SAFE_MODE && pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL; if (run_main_py) {