refactor: replace the TICK_MS global with app.setTickInterval()

A magic global that the runtime reads once at startup could not be changed later, gave
no feedback when misspelled, and was a second spelling of a mechanism the sibling
firmware already had. app.setTickInterval(ms) clamps to 33..3600000, takes 0 to stop,
and errors when on_tick() is not defined -- by the time init() runs the chunk body has
finished, so a missing callback is a typo rather than a race.

Also drops the code comments pointing at the other repo. Where the two APIs agree or
differ belongs in docs/lua-api-parity.md; a comment beside a constant explaining that
another firmware picked the same number is noise a reader here cannot act on.
This commit is contained in:
2026-08-01 17:58:11 -04:00
parent d338dfe3e8
commit 8045faddb4
13 changed files with 83 additions and 45 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ def render(modules):
"-- Callbacks an app may define as globals:",
"-- init() once, before the first draw (required)",
"-- draw() every 33 ms while the app runs",
"-- on_tick() every TICK_MS, when that global is set",
"-- on_tick() at the interval app.setTickInterval() asked for",
"-- on_touch_down(x, y) finger down",
"-- on_touch_up(x, y) finger up",
"-- on_touch(x, y) tap, fired on release like a click",