Rename -> Inst. Cluster (user); power manager: deep sleep on link silence, wake on IO1 or 60 s probe boot; Ota::isBusy; sleep bit in shared header
Firmware / build (push) Successful in 2m59s

This commit is contained in:
2026-09-28 16:38:23 +02:00
parent 43697f3cc8
commit 6854aa1c46
33 changed files with 266 additions and 97 deletions
+6 -6
View File
@@ -1,22 +1,22 @@
# Wiki Schema
This directory is a **personal knowledge wiki** for the ESP32-S3-LCD-1.3 project — Controller B, the slave/extension unit of the BMW M57N → Nissan Patrol swap display system. It is maintained by the LLM agent; the human curates sources and asks questions. Read this file before doing anything in `wiki/`.
This directory is a **personal knowledge wiki** for the ESP32-S3-LCD-1.3 project — Inst. Cluster, the slave/extension unit of the BMW M57N → Nissan Patrol swap display system. It is maintained by the LLM agent; the human curates sources and asks questions. Read this file before doing anything in `wiki/`.
It is the sibling of the wiki in `../../ESP32-S3-Touch-LCD-5B/wiki/` (Controller A). The two repos are separate git repositories with separate remotes. **Never create or edit files outside this repo's directory.** Cross-references into the sibling wiki are plain text, not `[[wikilinks]]` (Obsidian vaults do not link across vaults) — write them as `(sibling: 5B wiki → page-name)`.
It is the sibling of the wiki in `../../ESP32-S3-Touch-LCD-5B/wiki/` (Main CTRL). The two repos are separate git repositories with separate remotes. **Never create or edit files outside this repo's directory.** Cross-references into the sibling wiki are plain text, not `[[wikilinks]]` (Obsidian vaults do not link across vaults) — write them as `(sibling: 5B wiki → page-name)`.
## What this wiki is for
Domain knowledge that is NOT derivable from the firmware repo:
- Waveshare ESP32-S3-LCD-1.3 hardware: pinout, free GPIO, peripherals, power, quirks, gotchas
- The link between Controller A and Controller B: physical layer, packet contract, timing, failure modes, and the wired + BLE redundancy design
- Controller B's outputs into the Nissan Patrol: driving the cluster's RPM and coolant-temperature gauges, driver electronics, cluster behaviour
- The link between Main CTRL and Inst. Cluster: physical layer, packet contract, timing, failure modes, and the wired + BLE redundancy design
- Inst. Cluster's outputs into the Nissan Patrol: driving the cluster's RPM and coolant-temperature gauges, driver electronics, cluster behaviour
- Design decisions and their rationale; what was tried and why it was rejected
- Findings from datasheets, forum posts, Waveshare docs, bench measurements, scope traces
What does NOT belong here: code structure, build commands, firmware implementation details. The repo (its root `CLAUDE.md` and `README.md`) is the source of truth for those. The wiki may *reference* firmware facts when they matter for domain reasoning (e.g. "firmware currently times out after 1 s without a packet"), always marked `(repo)`.
Division of labour with the sibling wiki: **CAN bus decoding, the BMW engine, the donor vehicle and the swap itself live in the 5B wiki.** This wiki only records what Controller B needs from that work (which signals it consumes, which packet fields carry them). Do not duplicate CAN ID tables here — point at the sibling.
Division of labour with the sibling wiki: **CAN bus decoding, the BMW engine, the donor vehicle and the swap itself live in the 5B wiki.** This wiki only records what Inst. Cluster needs from that work (which signals it consumes, which packet fields carry them). Do not duplicate CAN ID tables here — point at the sibling.
## Layout
@@ -46,7 +46,7 @@ wiki/
- `(verified)` — confirmed on real hardware / with a meter or scope by the user
- `(source: X)` — from an ingested source in `raw/` (summarised in `sources/`)
- `(repo)` — what the firmware currently does (not necessarily correct!)
- `(sibling: 5B wiki → page)` — established in the Controller A wiki; check there before relying on it
- `(sibling: 5B wiki → page)` — established in the Main CTRL wiki; check there before relying on it
- `(unverified)` — LLM prior knowledge, forum lore, or a design proposal; treat as a hypothesis
- Contradictions between sources — including between the two repos' copies of the shared protocol header — get flagged inline with a `> [!warning]` callout, not silently resolved.
+2 -2
View File
@@ -9,13 +9,13 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
## Entities
- [[esp32-s3-lcd-1-3]] — Waveshare 1.3" round-display board (Controller B): specs, the **verified 16-pin header pinout** (IO1–5, IO7–14 all free-function), GPIO budget (10 clean spares), CH343 console on UART0, BLE 5
- [[esp32-s3-lcd-1-3]] — Waveshare 1.3" round-display board (Inst. Cluster): specs, the **verified 16-pin header pinout** (IO1–5, IO7–14 all free-function), GPIO budget (10 clean spares), CH343 console on UART0, BLE 5
## Concepts
- [[controller-link]] — the A → B link, **protocol v2 (verified 2026-09-21)**: typed DATA/CONFIG frames on UART1 **and** ESP-NOW with dedupe, split gear fields, rpm, A-side alerts; pins (A TX = GPIO 44 → 485_A → B IO1 on the bench); the RS485-in-the-car question; v1 and the old enum drift kept for the record
- [[link-redundancy]] — wired + wireless redundancy: **ESP-NOW leg built and bench-verified** (both paths carry every frame, B dedupes and hops channels); RS485 for the car and BLE still open; failover policy notes
- [[controller-b-ota]] — **implemented and verified end-to-end 2026-09-27 (B `dev` → `v0.1.0` from A's console)**: B pulls its own signed release over Wi-Fi; `link pair` on A sends a random key over the UART wire once; credentials and OTA commands travel in AES-256-GCM `SECURE` frames; B reports version/phase/progress in `STATUS` frames; A's Updates page has a Controller B card; B's updater = port of A's; CI workflow + `v0.1.0` procedure
- [[controller-b-ota]] — **implemented and verified end-to-end 2026-09-27 (B `dev` → `v0.1.0` from A's console)**: B pulls its own signed release over Wi-Fi; `link pair` on A sends a random key over the UART wire once; credentials and OTA commands travel in AES-256-GCM `SECURE` frames; B reports version/phase/progress in `STATUS` frames; A's Updates page has a Inst. Cluster card; B's updater = port of A's; CI workflow + `v0.1.0` procedure
- [[patrol-gauge-outputs]] — Patrol tachometer (IO7, 14-bit LEDC, 4 ppr) and coolant gauge (IO8, 8-bit PWM, CANNY duty law) **outputs implemented and bench-verified**; tunables on A via `cfg` console; prior art from the CANNY program; driver stage and needle calibration still to do
## Synthesis
+10 -6
View File
@@ -8,7 +8,7 @@ Created schema (`CLAUDE.md`, modelled on the sibling 5B wiki with a sibling-refe
Findings recorded during setup:
- Header pinout verified from the photo: IO1–5 and IO7–14, 13 free-function GPIOs; the wiring guide's IO35–42 table is wrong.
- Controller A cannot drive the Patrol gauges (no free native GPIO; DO terminals are I2C-expander + optocoupler). B can, via LEDC on IO7/IO8 — proposal only.
- Main CTRL cannot drive the Patrol gauges (no free native GPIO; DO terminals are I2C-expander + optocoupler). B can, via LEDC on IO7/IO8 — proposal only.
- A transmits on GPIO 44 (code), not 43 (two stale docs). GPIO 44 leaves the 5B only as an RS485 A/B pair — how that reaches B's IO1 is unknown and is now open question #1.
- The two repos' `gear_position_t` enums have drifted (Sport/Manual vs M1–M6 at values 4+). Open question #2.
- The packet has no RPM field; A has RPM verified from CAN 0x0AA. `engine_oil_temp` has no real source on this engine.
@@ -54,22 +54,22 @@ Implemented in both repos (not yet committed): shared header v2 (typed DATA/CONF
A gained a hand-coded LVGL Gauge Tuning screen (Home → right → Driveline → right): −/+ rows for every `link_config_t` field, enable switches, and an override panel with RPM/duty sliders; changes go through `Tunables` (saved + pushed), overrides never persisted (A's NVS save strips them). Built and flashed. Step-by-step needle calibration procedure added to [[patrol-gauge-outputs]].
## [2026-09-27] update | SquareLine retired on Controller B; LVGL lock; oil quadrant dropped; 16 MB flash declared
## [2026-09-27] update | SquareLine retired on Inst. Cluster; LVGL lock; oil quadrant dropped; 16 MB flash declared
Mirror of the A-side clean-up. `include/ui/` (SquareLine export) deleted; the screen is now `src/modules/gauge_screen.cpp` - same layout minus the engine-oil cell (user decision, closes open question #8: the M57N has no oil temperature sensor), battery centred at the bottom. Kept the two fonts and six icons the screen uses as plain LVGL arrays in `src/assets/`. New `DisplayInit::lock()/unlock()` recursive mutex: `lvglTask` renders under it and `loop()` updates under it - before, the higher-priority render task could preempt `loop()` mid-`lv_label_set_text()`, the bug class that froze A. Labels, colours and icons are written only on change. `DebugMonitor` now records A's debug flag in the receiver and applies it from `loop()` under the lock (it used to touch LVGL from the ESP-NOW callback). `lv_conf.h`: 128 KB pool in PSRAM, logging off, `LV_TICK_CUSTOM` from `millis()`. `platformio.ini`: flash declared 16 MB with `default_16MB.csv` (two 6.5 MB OTA slots; NVS unchanged so the cached gauge config survives), stale `-mfix-esp32-psram-cache-issue` and include paths removed. Waveshare's page adds nothing new for firmware (Arduino core 2.0.x, LVGL 8.3.7 demo, 800 mA LDO); no operating-temperature figure. Built and flashed COM13. Updated [[esp32-s3-lcd-1-3]], [[open-questions]] #8, index; root CLAUDE.md and README.
## [2026-09-27] query | OTA for B: pull design chosen, written up
User asked about updating B "via ESP-NOW". Compared A-pushes-chunks vs B-pulls-itself; user chose the pull design. Facts checked: B's Arduino 2.0.17 `qio_opi` sdkconfig has bootloader rollback, ECDSA P-256 and PEM parsing enabled (no core rebuild), 235 KB internal free after today's clean-up, partition table already has two OTA slots. Design page [[controller-b-ota]]: credential handoff via a pairing key exchanged over the UART wire on the bench then encrypted ESP-NOW unicast (both repos are public, so a compiled-in key would protect nothing); STATUS frames B→A for version + phase and A's Updates page gets a Controller B row; OTA_CMD trigger behind A's parking gate; B's OTA module = port of A's with link-data gate and a small on-screen notice; B CI workflow + `BMW_NISSAN_FIRMWARE_SIGNING_KEY` secret on the B repo (user action). New frame types 0x03–0x06, PACKET_VERSION stays 2. Open question #12 added.
User asked about updating B "via ESP-NOW". Compared A-pushes-chunks vs B-pulls-itself; user chose the pull design. Facts checked: B's Arduino 2.0.17 `qio_opi` sdkconfig has bootloader rollback, ECDSA P-256 and PEM parsing enabled (no core rebuild), 235 KB internal free after today's clean-up, partition table already has two OTA slots. Design page [[controller-b-ota]]: credential handoff via a pairing key exchanged over the UART wire on the bench then encrypted ESP-NOW unicast (both repos are public, so a compiled-in key would protect nothing); STATUS frames B→A for version + phase and A's Updates page gets a Inst. Cluster row; OTA_CMD trigger behind A's parking gate; B's OTA module = port of A's with link-data gate and a small on-screen notice; B CI workflow + `BMW_NISSAN_FIRMWARE_SIGNING_KEY` secret on the B repo (user action). New frame types 0x03–0x06, PACKET_VERSION stays 2. Open question #12 added.
## [2026-09-27] update | Controller B OTA implemented on both boards; STATUS + gates verified; pairing awaits the wire
## [2026-09-27] update | Inst. Cluster OTA implemented on both boards; STATUS + gates verified; pairing awaits the wire
Implemented the [[controller-b-ota]] design end to end. Shared header: `STATUS` 0x03 / `PAIR` 0x04 / `SECURE` 0x05 (+ inner `OTA_CMD` 0x11, `WIFI_CREDS` 0x12), `PACKET_MAX_PAYLOAD` 160, new `include/protocol/link_secure.h` (AES-256-GCM seal/open, key fingerprint; mbedtls names differ between IDF 4.4 and 5.5, handled). Decision: application-level GCM instead of ESP-NOW peer encryption (no PMK/LMK bookkeeping, no broadcast-vs-encrypted-peer doubt). B: `link_peer.cpp` (NVS key + A's MAC, credentials in namespace `wifi`, mailboxes so the Wi-Fi/UART tasks never touch NVS, STATUS every 5 s / on change, nonce replay window), `console.cpp` (line reader + handler chain, `help`), `ota_update.cpp` (port of A's: link-data gate, joins Wi-Fi only for the job, notice line on the screen via `GaugeScreen::setNotice()`, pumps STATUS from the download loop), `include/config/ota_config.h` (`patrol-b`, this repo, same roots + public key), `.gitea/workflows/firmware.yml`, `tools/ota/firmware_signing_pub.pem`. A: `link_peer.cpp` (`link status|pair|unpair|creds|ota ...`, automatic credential sync, B card on Settings → Updates), `EspNowLink` receive callback + `sendTo()`, `UARTManager::sendWire()`, `WiFiManager::getSavedCredentials()`, `Ota::isParked()`. Bench (A COM14, B COM13): B's STATUS frames reach A (MAC 10:51:DB:8F:B6:5C, `dev`, heap 234 KB); `ota check` on B refuses "no Wi-Fi credentials from A yet"; `link ota check` on A refuses "not paired"; `link pair` on A sent PAIR ×3 but B never saw it: **B's UART leg is silent (uart=0) — no wire on the bench right now**. Next: connect `485_A → IO1` + GND, `link pair`, credentials, tag `v0.1.0`, install from A's screen. Build notes: run `pio` from PowerShell (idf_tools refuses MSYS/Git Bash); the first build after switching between the two projects reinstalls the other Arduino core and can fail once with a `TypeError` — run it again.
## [2026-09-27] verify | Controller B updated over the air from A: dev → v0.1.0, end to end
## [2026-09-27] verify | Inst. Cluster updated over the air from A: dev → v0.1.0, end to end
User connected `485_A → IO1` (ground via the USB hub). B had rebooted on plug-in (A's card flipped to "not heard" for 15 s) and logged checksum-error bursts, but `uart alive` with good frames. `link pair` on A: PAIR ×3 over the wire, B `PAIRED ... fingerprint A9B7`, A `Controller B confirmed pairing` in < 5 s, then A pushed the `ArtServis` credentials by itself and B stored them. `link ota check` before the release existed: B joined the AP in ~2 s, got 404 → "no release published yet", reported to A as *failed* + reason (truncated to 32 chars), left Wi-Fi, re-locked on channel 1. CI: B's `main-latest` built in < 3 min; the `v0.1.0` tag build took ~12 min but published `firmware.bin` 1,248,432 B + `manifest.txt` (target patrol-b, sha256 `3c33d20f…3415`, ECDSA sig). `link ota check` → `update available, latest v0.1.0`; `link ota install` → download + flash to app1 in ~50 s with 0/10/…/100 % on B's console, `verified and installed v0.1.0`, reboot, `Firmware v0.1.0` banner, STATUS to A resumed, `confirmed - rollback cancelled` at 30 s, `ota status` slot app1 valid. Heap 230 KB before/after, loop stack headroom 3.4 KB. Not yet eyeballed: the Updates-page buttons on A and the progress line on B's screen (same code path as the console). Wiki [[controller-b-ota]] verification table and risks updated, [[open-questions]] #12 answered.
User connected `485_A → IO1` (ground via the USB hub). B had rebooted on plug-in (A's card flipped to "not heard" for 15 s) and logged checksum-error bursts, but `uart alive` with good frames. `link pair` on A: PAIR ×3 over the wire, B `PAIRED ... fingerprint A9B7`, A `Inst. Cluster confirmed pairing` in < 5 s, then A pushed the `ArtServis` credentials by itself and B stored them. `link ota check` before the release existed: B joined the AP in ~2 s, got 404 → "no release published yet", reported to A as *failed* + reason (truncated to 32 chars), left Wi-Fi, re-locked on channel 1. CI: B's `main-latest` built in < 3 min; the `v0.1.0` tag build took ~12 min but published `firmware.bin` 1,248,432 B + `manifest.txt` (target patrol-b, sha256 `3c33d20f…3415`, ECDSA sig). `link ota check` → `update available, latest v0.1.0`; `link ota install` → download + flash to app1 in ~50 s with 0/10/…/100 % on B's console, `verified and installed v0.1.0`, reboot, `Firmware v0.1.0` banner, STATUS to A resumed, `confirmed - rollback cancelled` at 30 s, `ota status` slot app1 valid. Heap 230 KB before/after, loop stack headroom 3.4 KB. Not yet eyeballed: the Updates-page buttons on A and the progress line on B's screen (same code path as the console). Wiki [[controller-b-ota]] verification table and risks updated, [[open-questions]] #12 answered.
## [2026-09-27] update | Round-panel redesign of B's screen: warning ring, tell-tales, whole-degree values
@@ -78,3 +78,7 @@ User asked for an automotive look, a Wi-Fi indicator and a sense of urgency on c
## [2026-09-28] update | B's screen: arc gauges with needles instead of digits (user's design)
User saw the 2026-09-27 layout ("not bad") and redesigned it: no temperature digits; coolant as an arc on the LEFT rim from compass 230° (bottom-left, cold) to 320° (top-left, hot) with a needle, gearbox oil mirrored on the RIGHT from 140° to 40°; arcs blue when cool grading to red at the hot end; each icon just past the hot end, upper-left / upper-right; battery digits stay at the bottom. Implemented in `gauge_screen.cpp`: gradient = 9-10 `lv_arc` segments of 10° (1° overlap, no seams) coloured blue→neutral→red, needle = 3 px white `lv_line` from r 92 to 113 recomputed only on an angle change, band r 100-110 inside the 6 px warning ring, icons centred at r 66 (angles 245° / 295° LVGL). Scales: coolant 50-120 °C, gearbox 40-150 °C (thresholds 100 / 130 sit at ~70 % / ~80 % of the sweep). Ring blink / red icons / tell-tales unchanged. Built and flashed COM13, clean boot; the user is looking at it.
## [2026-09-28] verify | Renamed Inst. Cluster; deep sleep on link silence with wire + timer wake, verified on the bench
User renamed the boards (Controller A → Main CTRL, Controller B → Inst. Cluster) across the repo. New `power_manager.cpp`: when the Main CTRL's "Sleep when the car is off" switch arrives as `CFG_SLEEP_WHEN_SILENT` (bit 7 of `out_enable`, cached in NVS with the gauge config), the board deep-sleeps after 60 s without a DATA frame (gauges low, backlight off), waking on UART RX IO1 (ext0, pull-up) or a 60 s timer. A timer wake is a *probe boot*: setup skips the serial waits, the panel stays dark, 4 s of listening, then sleep again unless the Main CTRL is heard. `Ota::isBusy()` blocks sleep during a job. Console `sleep status | now`. Bench, timestamps from the console: `t=60442 ms: link silent for 60 s - deep sleep` → `rst:0x5 (DSLEEP)` **60.1 s later** → `probe boot (timer)` → `t=4043 ms: probe: nothing heard - deep sleep`. Bug found and fixed on the way: the flag was printed at init before `GaugeOutputs::init()` had loaded the cached config ("off" while it was on). Not verified: wake through the wire (needs the Main CTRL awake and the wire), and how the probe boot looks on the panel (should stay dark).
+8 -8
View File
@@ -4,7 +4,7 @@ tags: [ota, wifi, esp-now, security, verified]
updated: 2026-09-27
---
# Over-the-air updates for Controller B
# Over-the-air updates for Inst. Cluster
**Status 2026-09-27: implemented on both controllers and VERIFIED END-TO-END on the bench - B went from `dev` to `v0.1.0` on a command typed on A, rebooted and confirmed itself.** B pulls its own signed release from Gitea over Wi-Fi; A hands B the network credentials and the trigger over the existing link, and shows B's progress on its own Updates page. Design chosen by the user over "A streams the image through ESP-NOW" (comparison below). Everything reuses A's proven pipeline ([[ota-updates]] in the sibling wiki).
@@ -12,13 +12,13 @@ updated: 2026-09-27
| Step | State |
|---|---|
| B → A STATUS frames (version, phase, heap, uptime) over ESP-NOW unicast | `(verified 2026-09-27)` A's console `link status` lists B's MAC, `dev`, heap 234 KB; A's Updates page shows the Controller B card |
| B → A STATUS frames (version, phase, heap, uptime) over ESP-NOW unicast | `(verified 2026-09-27)` A's console `link status` lists B's MAC, `dev`, heap 234 KB; A's Updates page shows the Inst. Cluster card |
| Gates on both sides (unpaired → refused, no credentials → refused, key mismatch → refused) | `(verified 2026-09-27)` each refusal text seen on the consoles |
| `link pair` over the UART wire | `(verified 2026-09-27 21:2x)` wire `485_A → IO1`, ground shared through the USB hub only. A: `PAIR sent over the wire 3 time(s); new key fingerprint A9B7`; B: `PAIRED over the wire ... A = 30:ED:A0:17:B2:4C` (+ one "re-confirmed" for the repeats); A: `Controller B confirmed pairing (fingerprint A9B7)` within 5 s |
| `link pair` over the UART wire | `(verified 2026-09-27 21:2x)` wire `485_A → IO1`, ground shared through the USB hub only. A: `PAIR sent over the wire 3 time(s); new key fingerprint A9B7`; B: `PAIRED over the wire ... A = 30:ED:A0:17:B2:4C` (+ one "re-confirmed" for the repeats); A: `Inst. Cluster confirmed pairing (fingerprint A9B7)` within 5 s |
| Encrypted credential handoff | `(verified)` A pushed `ArtServis` on its own right after pairing; B: `Wi-Fi credentials for 'ArtServis' stored`; `wifi status` on B lists the network |
| `link ota check` from A | `(verified)` B joined the AP (IP 10.0.10.101, channel 1) in ~2 s, before the release existed: `no release published yet (push a v* tag)` reported back to A as phase *failed* + message; after the release: `latest release v0.1.0 (1248432 bytes, signature OK)`, A: `update available, latest v0.1.0` |
| `link ota install` from A, first signed release `v0.1.0` | `(verified)` download + flash of 1,248,432 B into `app1` in ~50 s, `verified and installed v0.1.0`, reboot, banner `Firmware v0.1.0`, `NEW IMAGE, unconfirmed`, STATUS to A resumed within seconds (`firmware v0.1.0`), `firmware v0.1.0 confirmed - rollback cancelled` at 30 s; `ota status`: slot app1 state valid. Loop stack headroom after a job: 3.4 KB; heap 230 KB before/after |
| Screen path (Controller B card on A's Updates page, B's on-screen notice line) | same request functions as the console commands, but the buttons have **not been tapped yet** and the "Updating v0.1.0 N%" line on B's round screen was not watched - user to confirm on the next update |
| Screen path (Inst. Cluster card on A's Updates page, B's on-screen notice line) | same request functions as the console commands, but the buttons have **not been tapped yet** and the "Updating v0.1.0 N%" line on B's round screen was not watched - user to confirm on the next update |
## Why pull, not push
@@ -34,7 +34,7 @@ updated: 2026-09-27
### 1. Pairing (once, on the bench, over the wire)
`link pair` on A's console. A generates a random 32-byte key, sends `PAIR` (magic, key, A's STA MAC) **three times over UART1 only** and stores the key in NVS (`linkpeer/key`). B accepts `PAIR` only from the UART source (a `PAIR` heard on the radio is dropped and logged), stores key + A's MAC in NVS (`linkpeer/key`, `linkpeer/amac`) and answers with a STATUS carrying `key_fp` = first two bytes of SHA-256(key). A logs `Controller B confirmed pairing (fingerprint XXXX)` when it matches. Both repos are public, so this is the only secret and it never travels by radio. Survives reflashes (NVS); an NVS erase on either side means re-pairing at home — the car has no wire today ([[controller-link]]).
`link pair` on A's console. A generates a random 32-byte key, sends `PAIR` (magic, key, A's STA MAC) **three times over UART1 only** and stores the key in NVS (`linkpeer/key`). B accepts `PAIR` only from the UART source (a `PAIR` heard on the radio is dropped and logged), stores key + A's MAC in NVS (`linkpeer/key`, `linkpeer/amac`) and answers with a STATUS carrying `key_fp` = first two bytes of SHA-256(key). A logs `Inst. Cluster confirmed pairing (fingerprint XXXX)` when it matches. Both repos are public, so this is the only secret and it never travels by radio. Survives reflashes (NVS); an NVS erase on either side means re-pairing at home — the car has no wire today ([[controller-link]]).
### 2. SECURE frames (A → B, ESP-NOW unicast)
@@ -49,7 +49,7 @@ Everything A sends B by radio that matters goes inside `PACKET_TYPE_SECURE`: `no
### 4. A's Updates page
Settings → Updates now has two cards, **Controller A** and **Controller B**, each with Installed / Latest / a status line / Check / Install. B's buttons are enabled only when B is heard, paired with *this* key and holds credentials; the status line otherwise says which of those is missing. Install asks for confirmation, then `LinkPeer::requestInstall()` applies A's parking gate (engine off, shaft still, lever P/N — `Ota::isParked()`), requires **A itself to be on Wi-Fi** (same network as B ⇒ same radio channel ⇒ B's STATUS frames keep arriving while B is joined) and sends the `OTA_CMD`.
Settings → Updates now has two cards, **Main CTRL** and **Inst. Cluster**, each with Installed / Latest / a status line / Check / Install. B's buttons are enabled only when B is heard, paired with *this* key and holds credentials; the status line otherwise says which of those is missing. Install asks for confirmation, then `LinkPeer::requestInstall()` applies A's parking gate (engine off, shaft still, lever P/N — `Ota::isParked()`), requires **A itself to be on Wi-Fi** (same network as B ⇒ same radio channel ⇒ B's STATUS frames keep arriving while B is joined) and sends the `OTA_CMD`.
### 5. B's updater (`src/modules/ota_update.cpp`)
@@ -67,9 +67,9 @@ Port of A's module. Differences: gate = link data (`rpm == 0`, lever P/N/unknown
1. Bench: both boards on USB, `485_A → IO1`, GND → GND, 5B's 120 Ω switch OFF. B's 5-second stats line must say `uart alive`.
2. A console: `link pair` → A prints the fingerprint; within 5 s `link status` shows `key XXXX (matches)` and B's console printed `PAIRED over the wire`.
3. A on Wi-Fi with its remembered network → within ~15 s A logs `Wi-Fi credentials for '<ssid>' sent to Controller B (encrypted)`, B logs `stored`, `link status` shows `Wi-Fi creds yes`.
3. A on Wi-Fi with its remembered network → within ~15 s A logs `Wi-Fi credentials for '<ssid>' sent to Inst. Cluster (encrypted)`, B logs `stored`, `link status` shows `Wi-Fi creds yes`.
4. Tag this repo (`git tag -a v0.1.0 -m ... && git push --follow-tags origin master`), wait for the Gitea release with `manifest.txt`.
5. A: Settings → Updates → Controller B → Check → "Version v0.1.0 is available for Controller B" → Install → confirm. B's screen shows "Updating v0.1.0 N%", A's card shows the percentage, B restarts, its STATUS says `v0.1.0` with "new firmware, confirming..." for 30 s, then plain. Console alternative: `link ota check`, `link ota install`.
5. A: Settings → Updates → Inst. Cluster → Check → "Version v0.1.0 is available for Inst. Cluster" → Install → confirm. B's screen shows "Updating v0.1.0 N%", A's card shows the percentage, B restarts, its STATUS says `v0.1.0` with "new firmware, confirming..." for 30 s, then plain. Console alternative: `link ota check`, `link ota install`.
## Risks / open
+2 -2
View File
@@ -6,10 +6,10 @@ updated: 2026-09-21
# Controller Link (A → B)
The system is two ESP32-S3 boards. Controller A (Waveshare ESP32-S3-Touch-LCD-5B, sibling repo) reads the BMW PT-CAN bus and owns all decoding; Controller B ([[esp32-s3-lcd-1-3]], this repo) is a **slave / extension**: it consumes a compact packet, displays it, and will drive the Patrol gauges from it ([[patrol-gauge-outputs]]).
The system is two ESP32-S3 boards. Main CTRL (Waveshare ESP32-S3-Touch-LCD-5B, sibling repo) reads the BMW PT-CAN bus and owns all decoding; Inst. Cluster ([[esp32-s3-lcd-1-3]], this repo) is a **slave / extension**: it consumes a compact packet, displays it, and will drive the Patrol gauges from it ([[patrol-gauge-outputs]]).
```
BMW PT-CAN ──▶ Controller A (5B) ──UART 5 Hz──▶ Controller B (1.3)
BMW PT-CAN ──▶ Main CTRL (5B) ──UART 5 Hz──▶ Inst. Cluster (1.3)
╰── BLE (planned, redundant) ──╯ → [[link-redundancy]]
```
+2 -2
View File
@@ -6,7 +6,7 @@ updated: 2026-09-27
# Waveshare ESP32-S3-LCD-1.3
Controller B of the [[controller-link]] — the compact secondary unit. Receives the sensor stream from Controller A, shows it on a 1.3" round-masked display, and is the board chosen to drive the Patrol cluster gauges ([[patrol-gauge-outputs]]) because it is the only one of the two with free hardware-PWM pins on a header.
Inst. Cluster of the [[controller-link]] — the compact secondary unit. Receives the sensor stream from Main CTRL, shows it on a 1.3" round-masked display, and is the board chosen to drive the Patrol cluster gauges ([[patrol-gauge-outputs]]) because it is the only one of the two with free hardware-PWM pins on a header.
## Specs (source: waveshare-wiki-esp32-s3-lcd-1-3)
@@ -56,7 +56,7 @@ Header GPIOs and their current use `(repo)`:
| GPIO | Use today | Note |
|---|---|---|
| IO1 | UART1 RX from Controller A | keep |
| IO1 | UART1 RX from Main CTRL | keep |
| IO2 | UART1 TX (link is receive-only, so idle) | effectively free |
| IO3 | free | S3 strapping pin (JTAG select) — avoid |
| IO4, IO5 | free | |
+2 -2
View File
@@ -6,7 +6,7 @@ updated: 2026-09-21
# Open Questions
The research frontier for Controller B. Answering any of these should trigger updates across the wiki. Ordered roughly by how much they block progress.
The research frontier for Inst. Cluster. Answering any of these should trigger updates across the wiki. Ordered roughly by how much they block progress.
## Blocking
@@ -22,7 +22,7 @@ The research frontier for Controller B. Answering any of these should trigger up
13. **CANNY 5.3 pico details**: what is the HR PWM base clock (period 255 = what frequency), and what sat between the CANNY pin and the gauge wire? The user may still have the unit and harness. → [[temp-stage-cfd]]
8. ~~**Does `engine_oil_temp` stay in the packet?**~~ **Answered 2026-09-27 (user): dropped from the screen.** The field stays in the packet (protocol v2 unchanged, never valid on this engine), but B's hand-coded screen no longer has an oil quadrant - the battery cell sits alone at the bottom.
12. **OTA for Controller B** — **answered 2026-09-27** → [[controller-b-ota]]: implemented and verified end-to-end on the bench (pair over the wire, automatic credential handoff, `link ota check` / `install` from A, B `dev` → `v0.1.0`, reboot, self-confirm). Left to eyeball: the Controller B card on A's Updates page and B's on-screen progress line during the next update; the bench wire wants a proper GND (checksum-error bursts with hub-only ground).
12. **OTA for Inst. Cluster** — **answered 2026-09-27** → [[controller-b-ota]]: implemented and verified end-to-end on the bench (pair over the wire, automatic credential handoff, `link ota check` / `install` from A, B `dev` → `v0.1.0`, reboot, self-confirm). Left to eyeball: the Inst. Cluster card on A's Updates page and B's on-screen progress line during the next update; the bench wire wants a proper GND (checksum-error bursts with hub-only ground).
## Hardware