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 <damien@micropython.org>
This commit is contained in:
parent
ee4ffc1804
commit
9ee116c452
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user