Skip to content

Commit 17ee507

Browse files
committed
Remove overwrite of run_reason in main
When `reload_requested` is detected, the run reason will no longer be automatically overwritten as an AUTO_RELOAD, making SUPERVISOR_RELOAD a detectable reload reason. Autoreload now sets the reload reason itself.
1 parent a2ae503 commit 17ee507

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
340340
board_init();
341341
}
342342
#endif
343-
supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD);
344343
reload_requested = false;
345344
return true;
346345
}

supervisor/shared/autoreload.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "py/reload.h"
3131
#include "supervisor/shared/tick.h"
3232

33+
#include "shared-bindings/supervisor/Runtime.h"
34+
3335
static volatile uint32_t autoreload_delay_ms = 0;
3436
static bool autoreload_enabled = false;
3537
static bool autoreload_suspended = false;
@@ -44,6 +46,7 @@ inline void autoreload_tick() {
4446
!autoreload_suspended && !reload_requested) {
4547
mp_raise_reload_exception();
4648
reload_requested = true;
49+
supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD);
4750
supervisor_disable_tick();
4851
}
4952
autoreload_delay_ms--;
@@ -91,4 +94,5 @@ void autoreload_now() {
9194
}
9295
mp_raise_reload_exception();
9396
reload_requested = true;
97+
supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD);
9498
}

0 commit comments

Comments
 (0)