Disable auto-reload in safe mode

This commit is contained in:
microDev 2020-10-07 22:15:05 +05:30
parent 8c428a3bdd
commit d01b9ce933
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730

19
main.c
View File

@ -249,10 +249,7 @@ bool run_code_py(safe_mode_t safe_mode) {
serial_write("\n");
if (autoreload_is_enabled()) {
serial_write_compressed(translate("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\n"));
} else if (safe_mode != NO_SAFE_MODE) {
serial_write_compressed(translate("Running in safe mode! "));
serial_write_compressed(translate("Auto-reload is off.\n"));
} else if (!autoreload_is_enabled()) {
} else {
serial_write_compressed(translate("Auto-reload is off.\n"));
}
}
@ -322,16 +319,16 @@ bool run_code_py(safe_mode_t safe_mode) {
}
if (!serial_connected_before_animation && serial_connected()) {
if (serial_connected_at_start) {
serial_write("\n\n");
}
if (!serial_connected_at_start) {
if (autoreload_is_enabled()) {
serial_write_compressed(translate("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\n"));
} else {
serial_write_compressed(translate("Auto-reload is off.\n"));
}
if (safe_mode != NO_SAFE_MODE) {
serial_write_compressed(translate("Running in safe mode! "));
serial_write_compressed(translate("Not running saved code.\n"));
}
}
print_safe_mode_message(safe_mode);
serial_write("\n");
@ -486,8 +483,10 @@ int __attribute__((used)) main(void) {
reset_devices();
reset_board();
// Turn on autoreload by default but before boot.py in case it wants to change it.
autoreload_enable();
// If not in safe mode turn on autoreload by default but before boot.py in case it wants to change it.
if (safe_mode == NO_SAFE_MODE) {
autoreload_enable();
}
// By default our internal flash is readonly to local python code and
// writable over USB. Set it here so that boot.py can change it.