main.c: Fix safe mode
Back in #5536 I modified how boot_out.txt got written. However, I broke USB enumeration in the safe-mode case. This fixes it so that a safe-mode board still connects on USB with all defaults. (tested on a macropad)
This commit is contained in:
parent
c27b3a0e4f
commit
c607efe557
10
main.c
10
main.c
@ -645,10 +645,6 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
|
||||
&& safe_mode == NO_SAFE_MODE
|
||||
&& MP_STATE_VM(vfs_mount_table) != NULL;
|
||||
|
||||
if (!ok_to_run) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const char * const boot_py_filenames[] = STRING_LIST("boot.py", "boot.txt");
|
||||
|
||||
// Do USB setup even if boot.py is not run.
|
||||
@ -661,6 +657,9 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
|
||||
usb_set_defaults();
|
||||
#endif
|
||||
|
||||
pyexec_result_t result = {0, MP_OBJ_NULL, 0};
|
||||
|
||||
if (ok_to_run) {
|
||||
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
|
||||
vstr_t boot_text;
|
||||
vstr_init(&boot_text, 512);
|
||||
@ -670,8 +669,6 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
|
||||
// Write version info
|
||||
mp_printf(&mp_plat_print, "%s\nBoard ID:%s\n", MICROPY_FULL_VERSION_INFO, CIRCUITPY_BOARD_ID);
|
||||
|
||||
pyexec_result_t result = {0, MP_OBJ_NULL, 0};
|
||||
|
||||
bool found_boot = maybe_run_list(boot_py_filenames, &result);
|
||||
(void) found_boot;
|
||||
|
||||
@ -709,6 +706,7 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
|
||||
filesystem_flush();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CIRCUITPY_USB
|
||||
// Some data needs to be carried over from the USB settings in boot.py
|
||||
|
Loading…
Reference in New Issue
Block a user