Skip to content

Commit 372ddfd

Browse files
committed
Fix deep sleep masking, cleanup
1 parent 626e4e9 commit 372ddfd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

main.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,28 +352,26 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
352352
if (reload_requested) {
353353
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD;
354354
}
355-
else if (result.return_code == 0) { //TODO mask out PYEXEC_DEEP_SLEEP?
355+
else if (result.return_code == 0) {
356356
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_SUCCESS;
357357
if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_SUCCESS) {
358358
skip_repl = true;
359359
skip_wait = true;
360-
//goto done;
361360
}
362361
}
363362
else {
364363
next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_ERROR;
365-
if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_ERROR) {
366-
// TODO: in what scenario is this acceptable
364+
// Deep sleep cannot be skipped
365+
// TODO: settings in deep sleep should persist, using a new sleep memory API
366+
if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_ERROR
367+
&& !(result.return_code & PYEXEC_DEEP_SLEEP)) {
367368
skip_repl = true;
368369
skip_wait = true;
369-
//goto done;
370370
}
371371
}
372372
if (result.return_code & PYEXEC_FORCED_EXIT) {
373-
// TODO: what scenario does this describe?
374373
skip_repl = reload_requested;
375374
skip_wait = true;
376-
//goto done;
377375
}
378376

379377
if (reload_requested && result.return_code == PYEXEC_EXCEPTION) {
@@ -421,7 +419,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
421419
#if CIRCUITPY_ALARM
422420
bool fake_sleeping = false;
423421
#endif
424-
// bool skip_repl = false;
425422
while (!skip_wait) {
426423
RUN_BACKGROUND_TASKS;
427424

0 commit comments

Comments
 (0)