From 372ddfd562755753562a610d4e508a7af58051a3 Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Sun, 20 Jun 2021 17:20:47 -0400 Subject: [PATCH] Fix deep sleep masking, cleanup --- main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 78f8216370..3367445102 100755 --- a/main.c +++ b/main.c @@ -352,28 +352,26 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { if (reload_requested) { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD; } - else if (result.return_code == 0) { //TODO mask out PYEXEC_DEEP_SLEEP? + else if (result.return_code == 0) { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_SUCCESS; if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_SUCCESS) { skip_repl = true; skip_wait = true; - //goto done; } } else { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_ERROR; - if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_ERROR) { - // TODO: in what scenario is this acceptable + // Deep sleep cannot be skipped + // TODO: settings in deep sleep should persist, using a new sleep memory API + if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_ERROR + && !(result.return_code & PYEXEC_DEEP_SLEEP)) { skip_repl = true; skip_wait = true; - //goto done; } } if (result.return_code & PYEXEC_FORCED_EXIT) { - // TODO: what scenario does this describe? skip_repl = reload_requested; skip_wait = true; - //goto done; } if (reload_requested && result.return_code == PYEXEC_EXCEPTION) { @@ -421,7 +419,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) { #if CIRCUITPY_ALARM bool fake_sleeping = false; #endif - // bool skip_repl = false; while (!skip_wait) { RUN_BACKGROUND_TASKS;