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.
This commit is contained in:
parent
47dbf9ef3e
commit
8f9122af50
1
main.c
1
main.c
@ -338,7 +338,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
|
||||
board_init();
|
||||
}
|
||||
#endif
|
||||
supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD);
|
||||
reload_requested = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "py/reload.h"
|
||||
#include "supervisor/shared/tick.h"
|
||||
|
||||
#include "shared-bindings/supervisor/Runtime.h"
|
||||
|
||||
static volatile uint32_t autoreload_delay_ms = 0;
|
||||
static bool autoreload_enabled = false;
|
||||
static bool autoreload_suspended = false;
|
||||
@ -44,6 +46,7 @@ inline void autoreload_tick() {
|
||||
!autoreload_suspended && !reload_requested) {
|
||||
mp_raise_reload_exception();
|
||||
reload_requested = true;
|
||||
supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD);
|
||||
supervisor_disable_tick();
|
||||
}
|
||||
autoreload_delay_ms--;
|
||||
@ -91,4 +94,5 @@ void autoreload_now() {
|
||||
}
|
||||
mp_raise_reload_exception();
|
||||
reload_requested = true;
|
||||
supervisor_set_run_reason(RUN_REASON_AUTO_RELOAD);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user