Skip to content

mpconfig: Use RUN_BACKGROUND_TASKS as the micropython event hook #10379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions py/circuitpy_mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ void background_callback_run_all(void);

#define MICROPY_VM_HOOK_LOOP RUN_BACKGROUND_TASKS;
#define MICROPY_VM_HOOK_RETURN RUN_BACKGROUND_TASKS;
#define MICROPY_INTERNAL_EVENT_HOOK (RUN_BACKGROUND_TASKS)

// CIRCUITPY_AUTORELOAD_DELAY_MS = 0 will completely disable autoreload.
#ifndef CIRCUITPY_AUTORELOAD_DELAY_MS
Expand Down
8 changes: 0 additions & 8 deletions py/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,6 @@ void mp_event_wait_indefinite(void) {
MICROPY_EVENT_POLL_HOOK
#else
mp_event_handle_nowait();

// CIRCUITPY-CHANGE: don't starve CircuitPython background tasks
RUN_BACKGROUND_TASKS;

MICROPY_INTERNAL_WFE(-1);
#endif
}
Expand All @@ -287,10 +283,6 @@ void mp_event_wait_ms(mp_uint_t timeout_ms) {
MICROPY_EVENT_POLL_HOOK
#else
mp_event_handle_nowait();

// CIRCUITPY-CHANGE: don't starve CircuitPython background tasks
RUN_BACKGROUND_TASKS;

MICROPY_INTERNAL_WFE(timeout_ms);
#endif
}