diff --git a/py/runtime.c b/py/runtime.c index f5d219728f..c3ada72296 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -69,11 +69,10 @@ void mp_init(void) { // no pending exceptions to start with MP_STATE_THREAD(mp_pending_exception) = MP_OBJ_NULL; #if MICROPY_ENABLE_SCHEDULER + // no pending callbacks to start with + MP_STATE_VM(sched_state) = MP_SCHED_IDLE; #if MICROPY_SCHEDULER_STATIC_NODES - if (MP_STATE_VM(sched_head) == NULL) { - // no pending callbacks to start with - MP_STATE_VM(sched_state) = MP_SCHED_IDLE; - } else { + if (MP_STATE_VM(sched_head) != NULL) { // pending callbacks are on the list, eg from before a soft reset MP_STATE_VM(sched_state) = MP_SCHED_PENDING; }