Let's abuse _asyncios TaskQueue to implement a very simple priority queue task scheduler.
Despite documentation, Circuitpython doesn't usually ship with a min-heap module; it does however implement a pairing-heap for TaskQueue in native code.
Why not use asyncio directly?
all-out asyncio is a bit heavy,
doesn't add a lot of usefull functionality in the case of the (mostly) sequential KMK,
can be really difficult to grok for the causal user,
would require extensive rewrites to benefit from.
An example of a periodically self-rescheduling task is included with the RGB extension.
Let's abuse _asyncios TaskQueue to implement a very simple priority queue task scheduler. Despite documentation, Circuitpython doesn't usually ship with a min-heap module; it does however implement a pairing-heap for
TaskQueue
in native code.Why not use asyncio directly?
An example of a periodically self-rescheduling task is included with the RGB extension.