@@ -212,7 +212,7 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
### OTA updates (`ota` console)
`src/modules/ota_update.cpp` pulls signed firmware from this repo's Gitea releases (`include/config/ota_config.h`: server, repo, Let's Encrypt roots, signing public key). Manual only: Settings → Updates (Check, then Install behind a confirm dialog; verified end-to-end from the screen 2026-09-27) or the console `ota status | check | install [force] | rollback`. `Ota::getStatus()` gives the screen a phase + latest tag + failure reason. Install is refused unless parked (engine off, shaft still, lever not in a drive gear; silent bus = parked), checked before download and again before the slot switch. The manifest's ECDSA P-256 signature over `patrol-a|version|sha256` is checked before download; the streamed image must match that sha256. `verifyRollbackLater()` is overridden so a new image stays pending until `Ota::tick()` confirms it after 30 s - a reset before that rolls back. CI: `.gitea/workflows/firmware.yml` (push `main` -> rolling unsigned pre-release `main-latest`; tag `v*` -> signed release, needs repo secret `BMW_NISSAN_FIRMWARE_SIGNING_KEY`). Release with one push so only the tag build runs: `git tag -a vX.Y.Z -m "..." && git push --follow-tags origin main` (a main push skips itself when its commit is tagged, or when it only touches `wiki/**` / `*.md`). Never put secrets in firmware source - the repo and its release binaries are public. Jobs run inside the loop task (8 KB stack) with mbedtls routed to PSRAM - internal RAM is too tight for a TLS task (15.9 KB free, largest block 7.6 KB with Wi-Fi up). Wi-Fi is joined on the Settings screen (remembered) or with `wifi join`. Details: `wiki/pages/ota-updates.md`.
`src/modules/ota_update.cpp` pulls signed firmware from this repo's Gitea releases (`include/config/ota_config.h`: server, repo, Let's Encrypt roots, signing public key). Manual only: Settings → Updates (Check, then Install behind a confirm dialog; verified end-to-end from the screen 2026-09-27) or the console `ota status | check | install [force] | rollback`. `Ota::getStatus()` gives the screen a phase + latest tag + failure reason. Install is refused unless parked (engine off, shaft still, lever not in a drive gear; silent bus = parked), checked before download and again before the slot switch. The manifest's ECDSA P-256 signature over `patrol-a|version|sha256` is checked before download; the streamed image must match that sha256. `verifyRollbackLater()` is overridden so a new image stays pending until `Ota::tick()` confirms it after 30 s - a reset before that rolls back. CI: `.gitea/workflows/firmware.yml` (push `main` -> rolling unsigned pre-release `main-latest`; tag `v*` -> signed release, needs repo secret `BMW_NISSAN_FIRMWARE_SIGNING_KEY`). CI installs **pioarduino's fork of the PlatformIO core** (v6.1.18 zip, same pin as the platform's `penv_setup.py`), not upstream `platformio`: with `custom_sdkconfig` the build goes through the ESP-IDF path, where the upstream core imports `SCons.Tool.FortranCommon` that pioarduino's SCons 4.8.1 does not ship. The core rebuild makes the first CI build after a `platformio.ini` change ~20 min (esp-idf download + rebuild), cached afterwards. Release with one push so only the tag build runs: `git tag -a vX.Y.Z -m "..." && git push --follow-tags origin main` (a main push skips itself when its commit is tagged, or when it only touches `wiki/**` / `*.md`). Never put secrets in firmware source - the repo and its release binaries are public. Jobs run inside the loop task (8 KB stack) with mbedtls routed to PSRAM - internal RAM is too tight for a TLS task (15.9 KB free, largest block 7.6 KB with Wi-Fi up). Wi-Fi is joined on the Settings screen (remembered) or with `wifi join`. Details: `wiki/pages/ota-updates.md`.
@@ -181,3 +181,11 @@ Branch `display-xip`: pioarduino `custom_sdkconfig` with `CONFIG_SPIRAM_XIP_FROM
## [2026-09-27] build | Step 4: OTA keeps the screen on with a progress bar (branch display-xip)
`ota_update.cpp`: the full-screen notice gained an LVGL bar + percent label + amber "Do not switch off the ignition"; the download loop updates it per percent under a 50 ms LVGL try-lock; the backlight off/on around `writeImage()` is gone. Settings texts updated (confirm dialog, Updates note). Second forced install under `perf` → [[perf-xip-ota-2026-09-27]]: 24–25 panel frames/s and a 41.5 ms gap for the whole download, bar redrawing 2–3×/s. User confirmed on the screen: progress bar visible, no flicker. [[ota-updates]] rewritten for the lit screen; [[open-questions]] #13 step 4 done. Left: dots verdict by eye on the XIP build, CI core rebuild, merge + v0.1.7.
## [2026-09-27] release | v0.1.7: XIP from PSRAM, IRAM-safe panel refill, OTA progress bar, perf monitor, Driveline idle fix
User exercised the `display-xip` build (Wi-Fi scan, update check, install) and reported no flicker or other issues; decision: merge to main and tag **v0.1.7**. Contents since v0.1.6: core rebuilt with `CONFIG_SPIRAM_XIP_FROM_PSRAM` + `CONFIG_LCD_RGB_ISR_IRAM_SAFE` (pioarduino `custom_sdkconfig`, unused IDF components removed); OTA screen stays lit with a progress bar and "Do not switch off the ignition"; `perf` console + `tools/perf_session.py` (fps, PSRAM copy load, idle, panel vsync/gap); Driveline tick writes labels only on change; dead `ESP_PANEL_LCD_RGB_*` flags removed. Verified on the bench: 24–25 panel frames/s and a 41.5 ms gap throughout an OTA download (was 4–8/s). Open: dots in longer use (eyes only), CI core rebuild on the tag build. Pages: [[perf-baseline-2026-09-27]], [[perf-dots-and-ota-2026-09-27]], [[perf-xip-ota-2026-09-27]], [[ota-updates]], [[open-questions]] #13.
## [2026-09-27] build | v0.1.7 CI failure fixed: pioarduino core fork in the workflow, tag moved
Tag build died at the link step: `ModuleNotFoundError: No module named 'SCons.Tool.FortranCommon'`. Cause: CI installed upstream `platformio` via uv while the pioarduino platform pins its own SCons 4.8.1 (no Fortran tools) and, since `custom_sdkconfig`, the build runs through pioarduino's ESP-IDF path where the upstream core imports FortranCommon; locally the penv runs pioarduino's core fork (platform `penv_setup.py` pin v6.1.18), which never hit it — and v0.1.1–v0.1.6 never used that path. Workflow now installs the fork zip; documented in root CLAUDE.md and [[ota-updates]]. No release object existed for v0.1.7, so the tag was deleted on the remote and re-created on the fix commit, pushed with `--follow-tags`.
@@ -75,7 +75,7 @@ The research frontier. Answering any of these should trigger updates across the
**Decision 2026-09-27 (user): this is a must-fix, all steps through XIP, bench time is no constraint.** Two corrections to the record: (a) the flickering dots **still appear occasionally** on v0.1.6 — the scan policy reduced the trigger, it did not remove the weakness; (b) the dark screen during OTA is a **safety/UX defect**, not a mitigation: with no feedback a driver may switch the ignition off mid-update. Requirement: the screen stays on during an update with a visible progress bar and a "do not switch off" message — which needs Step B (flash writes must stop blanking the panel), plus an OTA progress callback on the Updates page. (The OTA design already survives a power cut — the new image is only confirmed after 30 s, else it rolls back — so the risk is a wasted update and a confused user, not a bricked board.)
**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. **Tooling landed 2026-09-27 `(repo)`**: the `perf` console command (`perf on 1` streams a `PERF,` CSV line per second: fps, ms/frame, flush ms/s, LVGL idle, core idle, heap). **Idle baseline, Driveline screen, bench/USB, v0.1.6+perf**: 9.7 fps rendered (= the screen's own update rate), 30 ms per frame avg (122 ms worst in the first window), ~40 kpx/frame, 52 ms/s copying into the PSRAM framebuffer, LVGL idle 68 %, core 0 idle 94 %, core 1 idle 66 %, internal 66.9 KB free / 31.7 KB largest, PSRAM 6.6 MB free. **Provoke session logged 2026-09-27 → [[perf-baseline-2026-09-27]]**: Driveline redraws ~10×/s with nothing changing (39 kpx, 30 ms, a third of core 1 — an unconditional `lv_label_set_text` every 100 ms `(repo)`); screen changes are single 140–330 ms frames (= the swipe lag; not a bounce-buffer matter); the Simulation tab is the heaviest normal load (2 Mpx/s, 26 % of the time writing PSRAM, LVGL idle 9 %); a flash write is invisible to the LVGL counters, so the monitor needs a **panel vsync/refresh counter** to see flicker and dots directly; the monitor is blind during OTA (ticks from the blocked `loop()`). Heap flat throughout (66–67 KB internal, 31.7 KB largest, 6.6 MB PSRAM). **Plan amended**: 1b = stop the Driveline redraw + add vsync counter + timer-driven PERF, re-baseline; step 2 judged on the Simulation tab and during a scan, by the refresh counter. **Step 1b done 2026-09-27 `(verified, bench)`**: Driveline `tick()` now writes labels/chips only on change → idle Driveline 0 fps, 0 ms/s PSRAM copies, LVGL idle 96 %, core 1 idle 96 % (was 9.7 fps / 52 ms/s / 68 % / 66 %). `perf` gained the panel counters: **~24 vsync/s, longest gap 41.5 ms when healthy** — a DMA restart must show as a gap ≥ 2 frames (≈ 83 ms). Reporting runs from an esp_timer, so OTA is no longer a blind spot. **Second session 2026-09-27 → [[perf-dots-and-ota-2026-09-27]]**: (a) with dots on screen and everything idle the panel refreshed perfectly (24/s, 41.5 ms) — **dots are sub-frame DMA data glitches, invisible to the vsync counter, judged by eye only; bounce buffers are the designed fix**; (b) during `ota install` the panel drops to **4–8 refreshes/s with 290–747 ms gaps** — flash writes blank it ~75 % of the time; **no progress bar is possible before step 3**; target 24/s + 41.5 ms during an install. Tuning save and `ota check` lost no frame. **Correction the same evening**: the panel library already runs **10-line bounce buffers** and a **21 MHz** clock (the `platformio.ini` flags saying otherwise were dead names) — so the dots are *late bounce refills* re-sending the previous 10-line chunk (the photo shows text pixels echoed below each line), and step 2 as written is moot. **Step 3 (`CONFIG_SPIRAM_XIP_FROM_PSRAM` + `CONFIG_LCD_RGB_ISR_IRAM_SAFE`, pioarduino `custom_sdkconfig`, branch `display-xip`) now targets both the dots and the OTA blanking.** Fallbacks if dots remain: lower pixel clock (18 MHz), larger bounce buffers, Wi-Fi/LWIP buffers back to internal RAM (`CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=n`, costs internal RAM). **Step 3 built and measured 2026-09-27 17:46 → [[perf-xip-ota-2026-09-27]]: during a full `ota install` the panel held 24–25 refreshes/s with a 41.5 ms gap (stock core: 4–8/s, 290–747 ms). The flash-write blanking is fixed `(verified)`; a progress bar during updates is now possible (step 4). PSRAM free 6.6 → 4.9 MB (code resident there); no render slow-down seen in the one full-redraw sample. Dots on the XIP build still to be judged by eye (Wi-Fi up, idle screen).****Step 4 done 2026-09-27**: the OTA notice keeps the screen on with a progress bar and "Do not switch off the ignition"; second forced install under `perf`: 24–25 frames/s, 41.5 ms gap throughout, bar redrawing 2–3×/s; user: "the progress bar appeared and no flickering or other issues" `(verified)`. Remaining before merging `display-xip` → main and releasing v0.1.7: the user's verdict on the dots (idle screen, Wi-Fi up, several minutes) and a CI run that can rebuild the core.
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. **Tooling landed 2026-09-27 `(repo)`**: the `perf` console command (`perf on 1` streams a `PERF,` CSV line per second: fps, ms/frame, flush ms/s, LVGL idle, core idle, heap). **Idle baseline, Driveline screen, bench/USB, v0.1.6+perf**: 9.7 fps rendered (= the screen's own update rate), 30 ms per frame avg (122 ms worst in the first window), ~40 kpx/frame, 52 ms/s copying into the PSRAM framebuffer, LVGL idle 68 %, core 0 idle 94 %, core 1 idle 66 %, internal 66.9 KB free / 31.7 KB largest, PSRAM 6.6 MB free. **Provoke session logged 2026-09-27 → [[perf-baseline-2026-09-27]]**: Driveline redraws ~10×/s with nothing changing (39 kpx, 30 ms, a third of core 1 — an unconditional `lv_label_set_text` every 100 ms `(repo)`); screen changes are single 140–330 ms frames (= the swipe lag; not a bounce-buffer matter); the Simulation tab is the heaviest normal load (2 Mpx/s, 26 % of the time writing PSRAM, LVGL idle 9 %); a flash write is invisible to the LVGL counters, so the monitor needs a **panel vsync/refresh counter** to see flicker and dots directly; the monitor is blind during OTA (ticks from the blocked `loop()`). Heap flat throughout (66–67 KB internal, 31.7 KB largest, 6.6 MB PSRAM). **Plan amended**: 1b = stop the Driveline redraw + add vsync counter + timer-driven PERF, re-baseline; step 2 judged on the Simulation tab and during a scan, by the refresh counter. **Step 1b done 2026-09-27 `(verified, bench)`**: Driveline `tick()` now writes labels/chips only on change → idle Driveline 0 fps, 0 ms/s PSRAM copies, LVGL idle 96 %, core 1 idle 96 % (was 9.7 fps / 52 ms/s / 68 % / 66 %). `perf` gained the panel counters: **~24 vsync/s, longest gap 41.5 ms when healthy** — a DMA restart must show as a gap ≥ 2 frames (≈ 83 ms). Reporting runs from an esp_timer, so OTA is no longer a blind spot. **Second session 2026-09-27 → [[perf-dots-and-ota-2026-09-27]]**: (a) with dots on screen and everything idle the panel refreshed perfectly (24/s, 41.5 ms) — **dots are sub-frame DMA data glitches, invisible to the vsync counter, judged by eye only; bounce buffers are the designed fix**; (b) during `ota install` the panel drops to **4–8 refreshes/s with 290–747 ms gaps** — flash writes blank it ~75 % of the time; **no progress bar is possible before step 3**; target 24/s + 41.5 ms during an install. Tuning save and `ota check` lost no frame. **Correction the same evening**: the panel library already runs **10-line bounce buffers** and a **21 MHz** clock (the `platformio.ini` flags saying otherwise were dead names) — so the dots are *late bounce refills* re-sending the previous 10-line chunk (the photo shows text pixels echoed below each line), and step 2 as written is moot. **Step 3 (`CONFIG_SPIRAM_XIP_FROM_PSRAM` + `CONFIG_LCD_RGB_ISR_IRAM_SAFE`, pioarduino `custom_sdkconfig`, branch `display-xip`) now targets both the dots and the OTA blanking.** Fallbacks if dots remain: lower pixel clock (18 MHz), larger bounce buffers, Wi-Fi/LWIP buffers back to internal RAM (`CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=n`, costs internal RAM). **Step 3 built and measured 2026-09-27 17:46 → [[perf-xip-ota-2026-09-27]]: during a full `ota install` the panel held 24–25 refreshes/s with a 41.5 ms gap (stock core: 4–8/s, 290–747 ms). The flash-write blanking is fixed `(verified)`; a progress bar during updates is now possible (step 4). PSRAM free 6.6 → 4.9 MB (code resident there); no render slow-down seen in the one full-redraw sample. Dots on the XIP build still to be judged by eye (Wi-Fi up, idle screen).****Step 4 done 2026-09-27**: the OTA notice keeps the screen on with a progress bar and "Do not switch off the ignition"; second forced install under `perf`: 24–25 frames/s, 41.5 ms gap throughout, bar redrawing 2–3×/s; user: "the progress bar appeared and no flickering or other issues" `(verified)`. **Merged to main and tagged v0.1.7 (2026-09-27, user decision)** after the user exercised the XIP build (Wi-Fi scan, update check and install) with no flicker or other issues reported. Whether the dots are fully gone in longer use stays open — report any sighting on v0.1.7 and the fallbacks above apply. First CI run with the core rebuild = the v0.1.7 tag build; if it fails, the release is missing until the workflow is fixed.
2.~~**Step A - bounce buffers only**~~**(void — already on, 10 lines, via the board header; 2026-09-27)** (`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]].
@@ -42,6 +42,8 @@ Push to `main` (no tag) builds a rolling **pre-release `main-latest`** — unsig
Always remember: an install is performed by the firmware that is **already running**, so a fix to the install path only takes effect on the update *after* the one that delivers it (v0.1.1 → v0.1.2 still flickered because v0.1.1 did the writing).
**CI note (2026-09-27):** the v0.1.7 tag build failed with `ModuleNotFoundError: No module named 'SCons.Tool.FortranCommon'` — upstream PlatformIO core + pioarduino's stripped SCons 4.8.1 on the new ESP-IDF (custom_sdkconfig) build path. Fixed by installing pioarduino's core fork in the workflow (same pin the platform uses locally); the tag was moved to the fix commit and pushed again.
**Progress bar on screen (branch `display-xip`, 2026-09-27; supersedes the dark-screen writes of v0.1.2–v0.1.6).** With the core rebuilt to execute from PSRAM and an IRAM-safe panel refill (see [[perf-xip-ota-2026-09-27]]), flash writes no longer blank the panel, so the full-screen notice now stays lit: "Updating to vX", a bar driven per percent from the download loop, and an amber "Do not switch off the ignition". Verified 2026-09-27 by the user ("the progress bar appeared and no flickering") and by `perf`: 24–25 panel frames/s, 41.5 ms gap for the whole download. Previously (v0.1.2–v0.1.6) the backlight was off while the image was written: a full-screen notice "Updating to vX — the screen goes dark for about a minute — do not switch off" shows for 3 s first, then "Installed vX / Restarting…" or "Update failed / Still running vY". Seen by the user on the 2026-09-27 screen installs: dark for about a minute, then the restart. The running version is always shown bottom-right on every screen (`A v0.1.2`).
Known quirk: `ota status` shows the *other* slot's "built" date from the framework's precompiled app descriptor (e.g. "Nov 4 2025"), not our build time — ignore it.
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.