Skip to content

Commit f38f5db

Browse files
committed
Set reload reason when reloaded from repl
1 parent 17ee507 commit f38f5db

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
334334
bool fake_sleeping = false;
335335
while (true) {
336336
RUN_BACKGROUND_TASKS;
337+
338+
// If a reload was requested by the supervisor or autoreload, return
337339
if (reload_requested) {
338340
#if CIRCUITPY_ALARM
339341
if (fake_sleeping) {
@@ -344,6 +346,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
344346
return true;
345347
}
346348

349+
// If interrupted by keyboard, return
347350
if (serial_connected() && serial_bytes_available()) {
348351
#if CIRCUITPY_ALARM
349352
if (fake_sleeping) {
@@ -370,6 +373,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
370373
}
371374
#endif
372375

376+
// If messages haven't been printed yet, print them
373377
if (!printed_press_any_key && serial_connected()) {
374378
if (!serial_connected_at_start) {
375379
print_code_py_status_message(safe_mode);
@@ -596,6 +600,7 @@ int __attribute__((used)) main(void) {
596600
for (;;) {
597601
if (!skip_repl) {
598602
exit_code = run_repl();
603+
supervisor_set_run_reason(RUN_REASON_REPL_RELOAD);
599604
}
600605
if (exit_code == PYEXEC_FORCED_EXIT) {
601606
if (!first_run) {

0 commit comments

Comments
 (0)