feat(lua): add app navigation history

Make sys.launch push the current path and argument, sys.replace switch without pushing, and sys.back restore the previous route. The status-bar chevron uses the same back action, failed child apps return to their caller, and history is capped at eight routes. Remove the redundant Settings back card.
This commit is contained in:
2026-08-02 13:30:12 -04:00
parent 01dfc4b458
commit 0ca1fd9842
11 changed files with 147 additions and 75 deletions
+4 -3
View File
@@ -11,10 +11,10 @@ Compared against crosspoint-reader at `src/util/lua/LuaBindings*.cpp`.
`fs.listDirs`, `fs.listFiles`, `fs.exists`, `fs.readFile`, `fs.writeFile`,
`gui.getWidth`, `gui.getHeight`, `gui.fillRect`, `gui.drawRect`, `gui.drawLine`,
`sys.getMillis`, `sys.delay`, `sys.exit`, `log.debug/info/error`, the whole `http` table,
`sys.getMillis`, `sys.delay`, `log.debug/info/error`, the whole `http` table,
`sys.setTickInterval`, `wifi.getStatus`, `wifi.isConnected`, `wifi.getLocalIP`, and the
`init()` / `draw()` / `on_tick()` callbacks. `init()` is required in both, so a
misspelled entry point is an error rather than an app that quietly draws nothing.
`draw()` / `on_tick()` callbacks. `init()` is required in both, so a misspelled entry
point is an error rather than an app that quietly draws nothing.
`wifi.getStatus()` returns `{state, ssid, ip, rssi}` in both. crosspoint returned a bare
string until this was reconciled; a string had nowhere to put the address and signal
@@ -26,6 +26,7 @@ strength a status screen wants. Its `state` vocabulary is a subset: crosspoint r
| Area | crosspoint-reader | slate32 | Why |
|---|---|---|---|
| App lifecycle | `sys.exit()`, `init()` | `sys.back()`, `sys.launch/replace(path, arg)`, `init(arg)` | slate32 apps form a reloadable route stack; only the path and optional string cross between Lua states. |
| Input | `input.wasPressed(button)` and friends, 8 named buttons | `input.getTouch`, `getRawTouch`, `touched` | Different hardware. A touch panel has no button names and a button device has no coordinates. |
| Drawing | `gui.drawText(font, x, y, text, color, style)`, `getTextWidth(font, text)` | `gui.drawText(text, x, y, color, bg)`, `gui.getTextWidth(text)` | crosspoint ships several fonts; this firmware has one built-in font scaled by `gui.setTextSize(n)`, and needs an opaque background colour because the panel is not e-ink. |
| Refresh | `gui.refresh(mode)`, `REFRESH_FULL/HALF/FAST` | none | An LCD has no waveform modes. |