Set reload reason when reloaded from repl

This commit is contained in:
Lucian Copeland 2021-05-05 17:02:32 -04:00
parent 17ee507f09
commit f38f5dbce6
1 changed files with 5 additions and 0 deletions

5
main.c
View File

@ -334,6 +334,8 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
bool fake_sleeping = false; bool fake_sleeping = false;
while (true) { while (true) {
RUN_BACKGROUND_TASKS; RUN_BACKGROUND_TASKS;
// If a reload was requested by the supervisor or autoreload, return
if (reload_requested) { if (reload_requested) {
#if CIRCUITPY_ALARM #if CIRCUITPY_ALARM
if (fake_sleeping) { if (fake_sleeping) {
@ -344,6 +346,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
return true; return true;
} }
// If interrupted by keyboard, return
if (serial_connected() && serial_bytes_available()) { if (serial_connected() && serial_bytes_available()) {
#if CIRCUITPY_ALARM #if CIRCUITPY_ALARM
if (fake_sleeping) { if (fake_sleeping) {
@ -370,6 +373,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
} }
#endif #endif
// If messages haven't been printed yet, print them
if (!printed_press_any_key && serial_connected()) { if (!printed_press_any_key && serial_connected()) {
if (!serial_connected_at_start) { if (!serial_connected_at_start) {
print_code_py_status_message(safe_mode); print_code_py_status_message(safe_mode);
@ -596,6 +600,7 @@ int __attribute__((used)) main(void) {
for (;;) { for (;;) {
if (!skip_repl) { if (!skip_repl) {
exit_code = run_repl(); exit_code = run_repl();
supervisor_set_run_reason(RUN_REASON_REPL_RELOAD);
} }
if (exit_code == PYEXEC_FORCED_EXIT) { if (exit_code == PYEXEC_FORCED_EXIT) {
if (!first_run) { if (!first_run) {