File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -334,17 +334,19 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
334
334
bool fake_sleeping = false;
335
335
while (true) {
336
336
RUN_BACKGROUND_TASKS ;
337
+
338
+ // If a reload was requested by the supervisor or autoreload, return
337
339
if (reload_requested ) {
338
340
#if CIRCUITPY_ALARM
339
341
if (fake_sleeping ) {
340
342
board_init ();
341
343
}
342
344
#endif
343
- supervisor_set_run_reason (RUN_REASON_AUTO_RELOAD );
344
345
reload_requested = false;
345
346
return true;
346
347
}
347
348
349
+ // If interrupted by keyboard, return
348
350
if (serial_connected () && serial_bytes_available ()) {
349
351
#if CIRCUITPY_ALARM
350
352
if (fake_sleeping ) {
@@ -371,6 +373,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
371
373
}
372
374
#endif
373
375
376
+ // If messages haven't been printed yet, print them
374
377
if (!printed_press_any_key && serial_connected ()) {
375
378
if (!serial_connected_at_start ) {
376
379
print_code_py_status_message (safe_mode );
@@ -597,6 +600,7 @@ int __attribute__((used)) main(void) {
597
600
for (;;) {
598
601
if (!skip_repl ) {
599
602
exit_code = run_repl ();
603
+ supervisor_set_run_reason (RUN_REASON_REPL_RELOAD );
600
604
}
601
605
if (exit_code == PYEXEC_FORCED_EXIT ) {
602
606
if (!first_run ) {
Original file line number Diff line number Diff line change 30
30
#include "py/reload.h"
31
31
#include "supervisor/shared/tick.h"
32
32
33
+ #include "shared-bindings/supervisor/Runtime.h"
34
+
33
35
static volatile uint32_t autoreload_delay_ms = 0 ;
34
36
static bool autoreload_enabled = false;
35
37
static bool autoreload_suspended = false;
@@ -44,6 +46,7 @@ inline void autoreload_tick() {
44
46
!autoreload_suspended && !reload_requested ) {
45
47
mp_raise_reload_exception ();
46
48
reload_requested = true;
49
+ supervisor_set_run_reason (RUN_REASON_AUTO_RELOAD );
47
50
supervisor_disable_tick ();
48
51
}
49
52
autoreload_delay_ms -- ;
@@ -91,4 +94,5 @@ void autoreload_now() {
91
94
}
92
95
mp_raise_reload_exception ();
93
96
reload_requested = true;
97
+ supervisor_set_run_reason (RUN_REASON_AUTO_RELOAD );
94
98
}
You can’t perform that action at this time.
0 commit comments