Upgrade multimer from OmniPython 0.5
OmniPython 0.6.0 redesigned multimer. This page is what changes for a program, a library and a board config written for 0.5 or earlier. How multimer works is in multimer internals.
Timers
Before |
After |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
gone; |
|
|
|
|
|
unchanged |
A file that only did from multimer import ticks_ms, ticks_diff needs no
change. import multimer as timer is also a legal one-line migration for a
file that used timer.Timer and timer.sleep_ms.
appdev.App
Before |
After |
|---|---|
|
|
|
|
|
|
|
gone ( |
|
gone: timers arm at once on every host |
|
|
|
still optional, still blocks in script mode, returns at once under |
|
unchanged |
|
unchanged ( |
A display-less program that wants to outlive its script body asks:
multimer.keepalive(). An App with a display or a subscription asks for
it already.
Board configs and displays
timer_async = ...lines in board configs go; nothing reads them.requires_async_timeron display classes goes.A display may set
refresh_period_ms(default 33) to say how often it wants to be presented;Appand the LVGL driver follow it. A backend with a real frame signal can override_make_frame_clock.
LVGL programs
Nothing changes in a program’s own code: import display_driver, build the
UI, end the script. The driver’s event_loop(freq=..., asynchronous=...)
still accepts its old arguments; asynchronous is ignored. Programs that
called app.stop_timer() around draw-buffer creation use
with multimer.hold(): instead.
Libraries
A library that runs work from a timer keeps doing so; it gets one
Timerper job instead of a share of the App’s 10 ms tick, and its callback is visible inmultimer.report()under thenameit gives.A library with a critical section that a tick must not interrupt wraps it in
with multimer.hold():. That replaces “checkuses_interruptsand behave differently”.Libraries that hand work to the main thread from a worker keep using
multimer.schedule(fn, arg).
The test kits
OMNIPYTHON_TIMER_ASYNC is retired. The examples kit still accepts it and
ignores it; lv_timer_test_kit.py has one mode.