From 40a21557f0bd331eeae0a524de712bcc2a3c147c Mon Sep 17 00:00:00 2001 From: Julian Cuni Date: Sun, 27 Sep 2026 08:29:02 +0200 Subject: [PATCH] Wiki: display platform plan (open-questions #13), SquareLine decommissioned Co-Authored-By: Claude Opus 5.5 --- wiki/log.md | 5 +++++ wiki/pages/open-questions.md | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/wiki/log.md b/wiki/log.md index 535d9f0..030b6c3 100644 --- a/wiki/log.md +++ b/wiki/log.md @@ -141,3 +141,8 @@ User: swiping main<->Settings 3x froze the UI; random flickering dots on all scr ## [2026-09-27] build | Hand-coded Settings + tabbed Gauge Tuning, remembered Wi-Fi, on-screen updates (v0.1.5) User asked to refactor the Settings and Gauge Tuning UX, save the Wi-Fi connection, and add a check for updates. Decisions (user): sidebar Settings (Wi-Fi / Updates / System), install behind a confirm dialog (not a PIN), one remembered network, Tuning as tabs with big controls. SquareLine Settings screen deleted; WiFiManager rewritten without UI code (remembered network in NVS, auto-join at boot, scans only on request, one retry then back to the ESP-NOW channel, failure reasons on screen, password never logged - the old code printed it). Verified: auto-join after USB flash; user installed v0.1.4 then v0.1.5 from the screen ("All good"); v0.1.4 showed the dots again because it forgot the network after the restart and rescanned. Lessons: a plain `git push` doesn't send tags (v0.1.5 needed `git push origin v0.1.5`); esptool crashes mid-write when its progress bar goes to a cp1252 pipe. Updated ota-updates (status table, decision: Updates on Settings), open-questions #12/#14, esp32-s3-touch-lcd-5b, dual-controller-architecture, index. + +## [2026-09-27] build | SquareLine decommissioned (v0.1.6); display plan recorded + +`include/ui/` deleted (the SquareLine export: ui_init, placeholder screen, helpers, theme manager); its one live line, the dark LVGL theme, moved to `display_init.cpp`. User verified on `dev` (Wi-Fi forget/scan/rejoin, dialogs, keyboard) and installed v0.1.6 from the screen: "all good". SquareLine references left in `.pio/libdeps` are library examples, never compiled. Recorded the agreed display plan in open-questions #13 (baseline -> bounce buffers -> XIP_FROM_PSRAM on a branch), including why bounce buffers alone won't fix flash-write flicker, and why CAN / wire / ESP-NOW need no buffering (dropped-frame counter deferred by the user). + diff --git a/wiki/pages/open-questions.md b/wiki/pages/open-questions.md index aa55e93..5172e76 100644 --- a/wiki/pages/open-questions.md +++ b/wiki/pages/open-questions.md @@ -72,4 +72,12 @@ The research frontier. Answering any of these should trigger updates across the 13. **Internal RAM is nearly exhausted (found 2026-09-26) — largely relieved 2026-09-27:** LVGL's 48 KB pool moved to PSRAM (512 KB) → internal free 16 → **69 KB**, largest block 7.6 → **31.7 KB**, enough for bounce buffers to be attempted. Original finding: With display + Wi-Fi up: 15.9 KB internal free, largest block 7.6 KB (PSRAM 7.1 MB free). OTA works around it ([[ota-updates]]), but anything else that needs an internal allocation (another task, a TLS client, a bigger Wi-Fi burst) can fail. Biggest known consumer: the LVGL 60-line DMA draw buffer (~120 KB). Options: shrink it to ~30–40 lines, or measure what else lives in internal RAM first (`heap_caps_print_heap_info`). Not urgent, but it limits every future feature. **Same project as the display flicker/lag (2026-09-26):** flash writes flicker the PSRAM-fed RGB panel (no bounce buffer) and full-screen transitions stutter. Espressif's cure is bounce buffers + `CONFIG_SPIRAM_XIP_FROM_PSRAM` (needs pioarduino `custom_sdkconfig`), and bounce buffers need internal RAM — so free RAM, add bounce buffers, and measure real render FPS (LVGL perf monitor; the Debug "FPS" counts `loop()` passes, not frames) in one bench session. Quick mitigations shipped in v0.1.2 (instant screen switches, deferred NVS saves, dark screen during OTA). + **Plan agreed 2026-09-27 (next display session, bench + USB, `dev` builds only until verified):** + 1. **Baseline first**: Settings → System → Performance overlay (LVGL's perf monitor = real render FPS + CPU; never measured before). Provoke each symptom on purpose: a Wi-Fi scan (dots), a Tuning edit that gets saved (flash write), an update (flash writes). Without numbers there is no telling whether a change helped. + 2. **Step A - bounce buffers only** (`ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE`, today 0; start at 10 lines = 1024x10 px, ~20 KB each, two buffers, internal DMA-capable RAM). The panel then reads from internal RAM that the CPU refills from PSRAM, so it tolerates short PSRAM stalls. **Expected to cure the Wi-Fi-traffic dots; will NOT cure flash-write flicker**: while flash is written the cache is disabled, so the refill has nothing to read from either. RAM: 67 KB internal free but the largest block is ~32 KB, so two 20 KB buffers may not fit - if not, shrink the LVGL draw buffer 60 -> 40 lines (frees ~40 KB) and check render speed. The refill costs CPU (measure). + 3. **Step B - `CONFIG_SPIRAM_XIP_FROM_PSRAM` (+ `CONFIG_SPIRAM_RODATA`)** via pioarduino `custom_sdkconfig`: code and constants run from PSRAM, so flash writes no longer block PSRAM. **Cures flash-write flicker** (screen could stay on during OTA with a progress bar instead of going dark). Cost/risk: `custom_sdkconfig` rebuilds the Arduino core from source (much slower builds, locally and in CI), and may not work cleanly with this platform version - do it on a branch, release only once it works. + 4. **Measure again after each step** (FPS, CPU, which symptoms still reproduce) and record the numbers here and on [[esp32-s3-touch-lcd-5b]]. + + Not affected by any of this: CAN, the RS485 wire and ESP-NOW - small, bursty, with their own hardware FIFOs and internal-RAM queues; none streams from PSRAM on a deadline (discussed 2026-09-27). The only reverse risk is the CAN RX FIFO overflowing during a flash write (ISR delayed); negligible for rebroadcast values and irrelevant while parked. A dropped-frame counter (TWAI `rx_missed_count` / `rx_overrun_count`) was offered and **deferred by the user**; it becomes worth adding if a value ever glitches while driving, or before diagnostic polling (multi-frame replies must arrive whole). + 14. **Wi-Fi UX (found 2026-09-26) — RESOLVED 2026-09-27 (v0.1.5):** Settings rebuilt as a hand-coded screen (the SquareLine one is deleted) with Wi-Fi / Updates / System sections: connection status with failure reasons, networks nearby, full-screen password page, **one remembered network joined at boot**, scans only on request. User: "Wow, I like it" / "All good". Remaining housekeeping below still applies. Original finding: The Settings Wi-Fi screen had never worked (switch shipped disabled) and, now usable, is "a disaster UX" (user): SquareLine-generated, runtime SSID buttons + floating keyboard + loading overlay, **no on-screen confirmation of a successful join**. Also: A **forgets the network on every reboot** (each boot needs `wifi join`). To do: redesign as a hand-coded screen (like Driveline/Tuning, safe from SquareLine re-exports), show connection state, remember the network in NVS and auto-join; consider housing it on the Diagnostics screen (#12) next to the OTA controls, since Wi-Fi now mainly serves updates. Fixed 2026-09-27: the SSID buttons' pointers dangled after SquareLine deleted the Settings screen (use-after-free on the next scan), and scans ran every 10 s on every screen even when connected (flickering dots) — see [[esp32-s3-touch-lcd-5b]]. Housekeeping: **delete the `v0.1.0` release** on Gitea — installing it would strand the board without working OTA (USB only). → [[ota-updates]]