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
1 changed files with 9 additions and 10 deletions

19
main.c
View File

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