Commit Graph

17 Commits

Author SHA1 Message Date
evan 6e9cede336 feat: scrolling 2026-08-06 09:05:14 -04:00
evan 1adf121dc6 feat(nav)!: own routing in Lua now that the runtime only carries arguments
sys.startApp(path, args) tears the runtime down and starts over from a
file, and keeps nothing else: no history, no title, no app identity. All
of that can ride in the arguments, so it does, and sdcard/.lua/lib/nav.lua
is the single writer of that table.

nav owns the back stack, the bar's title and /.lua/data/<AppId>, which
means the launcher, what "back" reaches and how deep a route nests are
editable on the card rather than in a reflash. Apps call nav.launch,
nav.replace and nav.back; sys.startApp has one caller.

Boot passes no arguments at all, which is how main.lua tells a cold start
from a navigation and opens its own launcher, replacing the home field the
runtime used to read. Arguments cross as JSON, so history is a list of
tables rather than a packed string, and an app passing something JSON
cannot carry sees the error at its own nav call.
2026-08-05 17:04:49 -04:00
evan 97abf037b8 refactor(lua)!: camelCase handlers, and type the app tables
Follows the submodule: on_touch_down and friends become onTouchDown, the last
snake_case left in the surface now that handlers are table fields rather than
globals.

main.lua declares SlateApp, this card's contract with its apps, and every app
composes what it fills -- PaintApp is SlateApp plus TouchHandlers, Home is
SlateApp alone -- which is also the only static record of the features an app
needs.
2026-08-05 10:42:06 -04:00
evan 7bc9afae33 refactor(lua)!: migrate to the per-feature namespaces
Follows lib/esp32-lua-api: gui -> screen, node -> tree, settings and input
split into screen/sys/touch/buttons. Settings is one provider lighter, with
timezone on Sys and rotation and theme on Gui, which now applies and persists a
rotation in one call. The calibration screen stashes the rotation it borrows
rather than relying on a transient setter.
2026-08-05 10:26:43 -04:00
evan 823a664af7 fix(settings): report a failed scan instead of indexing nil
wifi.scan() returns nil and a reason when the radio cannot allocate, which
took the app down with it.
2026-08-04 21:30:25 -04:00
evan 1aa3a59ca9 feat: give /.lua/main.lua the whole screen and the app contract
The firmware knew where apps, data and modules lived, called four globals,
and painted a status bar into a strip it clipped every app out of. None of
that was its business, and the viewport made the bar something an app could
neither compose with nor replace.

It now loads one file. main.lua mounts the route inside its own node tree,
so the bar is a sibling of the app rather than chrome painted over it: one
layout, one hit test, no inset arithmetic and no invalidation flags on the
C++ side. Apps and main.lua are tables -- they share a lua_State, so globals
would collide -- and a screen changes by rebuilding from node().
2026-08-04 21:15:21 -04:00
evan b3b5a9b2a3 feat(settings): persist the theme through the settings binding
Keeps one writer for saved state: ui.setTheme() writes through
settings.setTheme() and then reloads the palette C cannot see.
2026-08-04 20:44:13 -04:00
evan 9e58e72bf6 build: add a format target and one shared editor config
clang-format had no config here, so adopting the submodule's puts both repos
on the same pointer alignment. .editorconfig is what lua-language-server reads
on save, which is why the Lua tree had drifted between tabs and two widths.
2026-08-04 13:20:08 -04:00
evan fce0dfb70a feat(ble): add a NimBLE provider and fold its controls into Settings
Bluedroid cannot initialize beside the Lua runtime on this heap, so the
provider is NimBLE-Arduino. Scans keep the six strongest devices in a fixed
buffer rather than growing one. The standalone BLE app is gone: it was a
screen of toggles that belongs next to the other device settings.
2026-08-04 13:11:17 -04:00
evan 2724b070d0 chore: lsp + formatting 2026-08-04 10:12:38 -04:00
evan 000eba138a chore: bump esp32-lua-api for embedded platform modules
ui.lua and hints.lua are now compiled to bytecode and linked into the
firmware. The SD card copies (via make sdcard) still shadow them for
development, but a fresh card works without them.
2026-08-03 21:09:54 -04:00
evan 8c8339781a chore: update dep 2026-08-03 20:55:40 -04:00
evan 32280be3a4 chore: bump esp32-lua-api for root border fix 2026-08-03 20:49:18 -04:00
evan 7510bb38a5 feat(sdcard)!: move the card to /.lua and the shared Lua API
Apps live under /.lua/apps with data in /.lua/data, matching the runtime's
paths. ui.lua and hints.lua ship from the submodule through `make sdcard`
rather than a copy that drifts, so theme.lua and the firmware's own ui.lua
are gone.

App-visible changes: text takes a font role rather than a text size, the
theme palette names roles (color/background) instead of fg/bg, ticks are
timer.every, on_press is on_click, and centring is layout alignment now
that textAlign left the node contract.
2026-08-03 18:32:58 -04:00
evan 45abf8a767 refactor: run apps on the shared esp32-lua-api runtime
Replaces the firmware's own lua_State, bindings, module loader, node tree
and navigation history with lib/esp32-lua-api. What is left in src/host is
the hardware behind the provider interfaces plus the chrome the firmware
owns: the viewport, the status bar and touch polling.

src/lua became src/host because src is on the include path, so a directory
named lua shadowed the library's <lua/providers.h> and #pragma once then
silently skipped it.
2026-08-03 18:12:33 -04:00
evan a40d2441f6 build: vendor Lua through the shared esp32-lua-api submodule
Replaces lib/Lua (5.4.7) with lib/esp32-lua-api, which vendors 5.4.8 and
carries the shared runtime the firmware bindings are about to move onto.
2026-08-03 17:48:42 -04:00
evan ad396d3f01 feat: Lua app firmware for the E32R40T display module
Boots to a launcher that lists /apps/<name>/main.lua on the SD card and runs
the selected app in a vendored Lua 5.4 with gui, input, fs, sys and log
bindings. Settings persist as a Lua table in /settings.lua, covering touch
calibration and screen rotation, with a settings app to edit both. Rotation is
applied after mapping raw touch into the panel's rotation-0 frame, so turning
the UI never invalidates a calibration.
2026-07-31 21:28:11 -04:00