@@ -124,7 +124,7 @@ static void reset_devices(void) {
124
124
}
125
125
126
126
STATIC void start_mp (supervisor_allocation * heap , bool first_run ) {
127
- autoreload_stop ();
127
+ autoreload_reset ();
128
128
supervisor_workflow_reset ();
129
129
130
130
// Stack limit should be less than real stack size, so we have a chance
@@ -329,7 +329,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re
329
329
result .exception = MP_OBJ_NULL ;
330
330
result .exception_line = 0 ;
331
331
332
- bool skip_repl ;
332
+ bool skip_repl = false ;
333
333
bool skip_wait = false;
334
334
bool found_main = false;
335
335
uint8_t next_code_options = 0 ;
@@ -389,13 +389,13 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re
389
389
390
390
// Print done before resetting everything so that we get the message over
391
391
// BLE before it is reset and we have a delay before reconnect.
392
- if (reload_requested && result .return_code == PYEXEC_EXCEPTION ) {
392
+ if (result .return_code == PYEXEC_RELOAD ) {
393
393
serial_write_compressed (translate ("\nCode stopped by auto-reload.\n" ));
394
394
} else {
395
395
serial_write_compressed (translate ("\nCode done running.\n" ));
396
396
}
397
397
398
- // Finished executing python code. Cleanup includes a board reset.
398
+ // Finished executing python code. Cleanup includes filesystem flush and a board reset.
399
399
cleanup_after_vm (heap , result .exception );
400
400
401
401
// If a new next code file was set, that is a reason to keep it (obviously). Stuff this into
@@ -407,8 +407,10 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re
407
407
next_code_options |= SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET ;
408
408
}
409
409
410
- if (reload_requested ) {
410
+ if (result . return_code & PYEXEC_RELOAD ) {
411
411
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD ;
412
+ skip_repl = true;
413
+ skip_wait = true;
412
414
} else if (result .return_code == 0 ) {
413
415
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_SUCCESS ;
414
416
if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_SUCCESS ) {
@@ -426,7 +428,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re
426
428
}
427
429
}
428
430
if (result .return_code & PYEXEC_FORCED_EXIT ) {
429
- skip_repl = reload_requested ;
431
+ skip_repl = false ;
430
432
skip_wait = true;
431
433
}
432
434
}
@@ -473,7 +475,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re
473
475
RUN_BACKGROUND_TASKS ;
474
476
475
477
// If a reload was requested by the supervisor or autoreload, return
476
- if (reload_requested ) {
478
+ if (result . return_code & PYEXEC_RELOAD ) {
477
479
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD ;
478
480
// Should the STICKY_ON_SUCCESS and STICKY_ON_ERROR bits be cleared in
479
481
// next_code_stickiness_situation? I can see arguments either way, but I'm deciding
@@ -627,13 +629,14 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re
627
629
}
628
630
}
629
631
632
+ // Done waiting, start the board back up.
633
+
630
634
// free code allocation if unused
631
635
if ((next_code_options & next_code_stickiness_situation ) == 0 ) {
632
636
free_memory (next_code_allocation );
633
637
next_code_allocation = NULL ;
634
638
}
635
639
636
- // Done waiting, start the board back up.
637
640
#if CIRCUITPY_STATUS_LED
638
641
if (led_active ) {
639
642
new_status_color (BLACK );
@@ -757,7 +760,7 @@ STATIC int run_repl(bool first_run) {
757
760
usb_setup_with_vm ();
758
761
#endif
759
762
760
- autoreload_suspend (AUTORELOAD_LOCK_REPL );
763
+ autoreload_suspend (AUTORELOAD_SUSPEND_REPL );
761
764
762
765
// Set the status LED to the REPL color before running the REPL. For
763
766
// NeoPixels and DotStars this will be sticky but for PWM or single LED it
@@ -787,7 +790,7 @@ STATIC int run_repl(bool first_run) {
787
790
status_led_deinit ();
788
791
#endif
789
792
790
- autoreload_resume (AUTORELOAD_LOCK_REPL );
793
+ autoreload_resume (AUTORELOAD_SUSPEND_REPL );
791
794
return exit_code ;
792
795
}
793
796
0 commit comments