atmel-samd: Fixup autoreset after switching boot to running once.
This commit is contained in:
parent
3f5028c666
commit
b1925b1bd8
@ -64,4 +64,5 @@ void autoreload_start() {
|
|||||||
|
|
||||||
void autoreload_stop() {
|
void autoreload_stop() {
|
||||||
autoreload_delay_ms = 0;
|
autoreload_delay_ms = 0;
|
||||||
|
reload_next_character = false;
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(samd_enable_autoreload_obj, samd_enable_autoreload);
|
|||||||
|
|
||||||
//| .. method:: disable_autoreload()
|
//| .. method:: disable_autoreload()
|
||||||
//|
|
//|
|
||||||
//| Disable autoreload based on USB file write activity until the next reload
|
//| Disable autoreload based on USB file write activity until
|
||||||
//| or until `enable_autoreload` is called.
|
//| `enable_autoreload` is called.
|
||||||
//|
|
//|
|
||||||
STATIC mp_obj_t samd_disable_autoreload(void) {
|
STATIC mp_obj_t samd_disable_autoreload(void) {
|
||||||
autoreload_disable();
|
autoreload_disable();
|
||||||
|
@ -118,7 +118,6 @@ void reset_mp(void) {
|
|||||||
reset_status_led();
|
reset_status_led();
|
||||||
new_status_color(0x8f008f);
|
new_status_color(0x8f008f);
|
||||||
autoreload_stop();
|
autoreload_stop();
|
||||||
autoreload_enable();
|
|
||||||
|
|
||||||
// Sync the file systems in case any used RAM from the GC to cache. As soon
|
// Sync the file systems in case any used RAM from the GC to cache. As soon
|
||||||
// as we re-init the GC all bets are off on the cache.
|
// as we re-init the GC all bets are off on the cache.
|
||||||
@ -249,6 +248,8 @@ bool start_mp(safe_mode_t safe_mode) {
|
|||||||
mp_hal_stdout_tx_str("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\r\n");
|
mp_hal_stdout_tx_str("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\r\n");
|
||||||
} else if (safe_mode != NO_SAFE_MODE) {
|
} else if (safe_mode != NO_SAFE_MODE) {
|
||||||
mp_hal_stdout_tx_str("Running in safe mode! Auto-reload is off.\r\n");
|
mp_hal_stdout_tx_str("Running in safe mode! Auto-reload is off.\r\n");
|
||||||
|
} else if (!autoreload_is_enabled()) {
|
||||||
|
mp_hal_stdout_tx_str("Auto-reload is off.\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -320,11 +321,13 @@ bool start_mp(safe_mode_t safe_mode) {
|
|||||||
mp_hal_stdout_tx_str("\r\n\r\n");
|
mp_hal_stdout_tx_str("\r\n\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cdc_enabled_at_start && autoreload_is_enabled()) {
|
if (!cdc_enabled_at_start) {
|
||||||
|
if (autoreload_is_enabled()) {
|
||||||
mp_hal_stdout_tx_str("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\r\n");
|
mp_hal_stdout_tx_str("Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\r\n");
|
||||||
} else {
|
} else {
|
||||||
mp_hal_stdout_tx_str("Auto-reload is off.\r\n");
|
mp_hal_stdout_tx_str("Auto-reload is off.\r\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (safe_mode != NO_SAFE_MODE) {
|
if (safe_mode != NO_SAFE_MODE) {
|
||||||
mp_hal_stdout_tx_str("\r\nYou are running in safe mode which means something really bad happened.\r\n");
|
mp_hal_stdout_tx_str("\r\nYou are running in safe mode which means something really bad happened.\r\n");
|
||||||
if (safe_mode == HARD_CRASH) {
|
if (safe_mode == HARD_CRASH) {
|
||||||
@ -618,6 +621,7 @@ int main(void) {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
if (!skip_repl) {
|
if (!skip_repl) {
|
||||||
// The REPL mode can change, or it can request a reload.
|
// The REPL mode can change, or it can request a reload.
|
||||||
|
bool autoreload_on = autoreload_is_enabled();
|
||||||
autoreload_disable();
|
autoreload_disable();
|
||||||
new_status_color(REPL_RUNNING);
|
new_status_color(REPL_RUNNING);
|
||||||
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
|
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
|
||||||
@ -625,6 +629,9 @@ int main(void) {
|
|||||||
} else {
|
} else {
|
||||||
exit_code = pyexec_friendly_repl();
|
exit_code = pyexec_friendly_repl();
|
||||||
}
|
}
|
||||||
|
if (autoreload_on) {
|
||||||
|
autoreload_enable();
|
||||||
|
}
|
||||||
reset_samd21();
|
reset_samd21();
|
||||||
reset_mp();
|
reset_mp();
|
||||||
}
|
}
|
||||||
|
@ -131,9 +131,6 @@ int receive_usb(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable autoreload if someone is using the repl.
|
|
||||||
autoreload_disable();
|
|
||||||
|
|
||||||
// Copy from head.
|
// Copy from head.
|
||||||
cpu_irq_disable();
|
cpu_irq_disable();
|
||||||
int data = usb_rx_buf[usb_rx_buf_head];
|
int data = usb_rx_buf[usb_rx_buf_head];
|
||||||
|
Loading…
Reference in New Issue
Block a user