Link protocol v2, ESP-NOW leg, gauge tunables + tuning screen; remove Home screen
Protocol v2 (shared header, byte-identical with the 1.3 repo): - typed DATA/CONFIG frames: 0xAA | ver | type | len | payload | XOR | 0x55 - gear split into lever (P/R/N/D/S/M) + target/engaged nibbles, engine rpm, alert bitmap decided here from tunable thresholds, link_config_t tunables - docs/UART_PROTOCOL.md rewritten for v2 Controller A modules: - tunables: gauge calibration + alert thresholds in NVS, 'cfg' serial console, bench override (never persisted) - espnow_link: every frame also broadcast on ESP-NOW ch 1; radio stays in STA (WiFiManager no longer powers it off) - uart_manager: DATA at 5 Hz + CONFIG on change/5 s on both transports - can_driver: publishes gear pieces and rpm, evaluates alerts - tuning_screen: hand-coded Gauge Tuning page (swipe right from Driveline), -/+ rows, enable switches, override sliders, Driveline/Defaults buttons UI: SquareLine Home screen (3 meters + battery) and meters_manager removed; Driveline is the boot screen; Settings back-gesture calls app_show_driveline(). tools/fix_penv_deps.ps1: repairs the shared PlatformIO penv after a 1.3 build. Bench-verified with Controller B: both transports alive, dedupe, override rpm 2000 -> 133.3 Hz tach output. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
|
||||
|
||||
- [[can-bus-integration]] — the core challenge; current firmware ID map flagged as placeholder, verification plan
|
||||
- [[driveline-speed-signals]] — **engine / turbine / output-shaft speeds**: turbine speed as physical proof of gear engagement, and the output-shaft field that is our **only road-speed source** (no DSC on this bus) — the feedback variable for a future cruise-control PoC, with the safety envelope that would require
|
||||
- [[dual-controller-architecture]] — Controller A → UART 5Hz → Controller B (1.3" display); packet format
|
||||
- [[dual-controller-architecture]] — Controller A → UART1 + ESP-NOW, protocol v2 → Controller B (1.3" display + Patrol gauge outputs); A owns alerts and the gauge tunables (`cfg` console)
|
||||
|
||||
## Synthesis
|
||||
|
||||
|
||||
+12
@@ -49,3 +49,15 @@ The repo's `.docs/` folder was deleted (user decision). `CAN_BUS_INTEGRATION.md`
|
||||
**Missing source**: the schematic PDF (`ESP32-S3-Touch-LCD-5-Sch.pdf`) was in `.docs/` at the start of the 2026-09-21 session and was not on disk by the time of this cleanup (never git-tracked). Its net list was read earlier that session and is reflected in [[esp32-s3-touch-lcd-5b]]; re-download it into `raw/` — still on the sourcing wishlist in [[open-questions]].
|
||||
|
||||
Sibling wiki instantiated today at `../../ESP32-S3-LCD-1.3/wiki/` for Controller B (link, redundancy, gauge outputs). Cross-references from there use the text form `(sibling: 5B wiki → page)`.
|
||||
|
||||
## [2026-09-21] update | Link protocol v2: ESP-NOW second transport, gear/rpm/alerts on the wire, tunables console
|
||||
|
||||
Firmware (not yet committed): shared header v2 with typed DATA/CONFIG frames; `Tunables` module (gauge calibration + alert thresholds in NVS, `cfg show|set|override|reset` on the USB console); `EspNowLink` broadcasts every frame alongside UART1 (radio now stays in STA mode — WiFiManager's off no longer calls `WIFI_OFF`); CAN driver publishes lever + target/engaged gear nibbles and rpm, and evaluates coolant/gearbox/battery/cooling-demand alerts against the tunables. Bench-verified with Controller B: both transports alive, every frame deduplicated, `cfg override rpm 2000` drove B's tach output at 133.3 Hz. `docs/UART_PROTOCOL.md` rewritten for v2. [[dual-controller-architecture]] and index updated. Build note: IDF 5.5's ESP-NOW send callback takes `wifi_tx_info_t*`; and the two repos must not be built concurrently (shared penv).
|
||||
|
||||
## [2026-09-21] update | Gauge Tuning screen
|
||||
|
||||
New hand-coded screen `src/modules/tuning_screen.cpp` (swipe right from Driveline; left back to Driveline, right to Home): edits the Patrol gauge tunables and alert thresholds on the touchscreen, with a calibration override panel (RPM and duty sliders). Same `Tunables` path as the `cfg` console; `Tunables::setOverride()` added; NVS save now strips overrides. LVGL 8 note: no margin styles (`lv_obj_set_style_margin_*` does not exist), use padding or flex gaps.
|
||||
|
||||
## [2026-09-21] update | SquareLine Home screen removed; Driveline is the boot screen
|
||||
|
||||
User decision: the Home screen (three arc meters + battery) is not needed. Deleted `include/ui/screens/ui_Home_Screen.c/h`, its four image assets and `src/modules/meters_manager.*`; `ui_init()` now loads an empty placeholder and `display_init.cpp` shows the hand-coded Driveline screen; the generated Settings screen's right-swipe calls a new C entry point `app_show_driveline()`; Driveline swipes left to Settings and right to Gauge Tuning; Tuning swipes left back. Firmware flash shrank ~100 KB. If SquareLine re-exports a Home screen it must be deleted from the SquareLine project, not wired back in. Built and flashed.
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
---
|
||||
type: concept
|
||||
tags: [architecture, uart]
|
||||
updated: 2026-07-15
|
||||
updated: 2026-09-21
|
||||
---
|
||||
|
||||
# Dual-Controller Architecture
|
||||
|
||||
The system is two ESP32-S3 boards linked by UART (repo):
|
||||
The system is two ESP32-S3 boards linked by UART **and ESP-NOW** (repo, protocol v2 since 2026-09-21):
|
||||
|
||||
```
|
||||
BMW M57N CAN bus ──▶ Controller A ──UART 5Hz──▶ Controller B
|
||||
(this repo: (ESP32-S3-LCD-1.3,
|
||||
5" 1024×600 display) 1.3" round display)
|
||||
BMW M57N CAN bus ──▶ Controller A ──UART1 + ESP-NOW, 5 Hz──▶ Controller B ──▶ Patrol tach + temp gauge
|
||||
(this repo: (ESP32-S3-LCD-1.3,
|
||||
5" 1024×600 display) 1.3" round display, gauge outputs)
|
||||
```
|
||||
|
||||
- **Controller A** — [[esp32-s3-touch-lcd-5b]]: listens to the CAN bus, renders the main UI, and re-broadcasts a compact sensor packet over UART1 (GPIO 43/44, 115200 baud) at 5 Hz.
|
||||
- **Controller B** — ESP32-S3-Touch-LCD-1.3: a secondary display fed purely by that UART stream. Lives in a sibling repo (`bmw-patrol/` parent directory).
|
||||
|
||||
## UART packet (repo)
|
||||
## Link protocol v2 (repo, 2026-09-21)
|
||||
|
||||
`0xAA` start · version · length · `automotive_data_t` (gear position, gear number, coolant/oil/gearbox temps, battery voltage, fault codes) · XOR checksum · `0x55` end. Full spec in the repo's UART protocol documentation (commit 49aaf06).
|
||||
`0xAA | 0x02 | type | length | payload | XOR | 0x55`, identical on UART1 (GPIO 44 → SP3485 → `485_A`/`485_B`) and ESP-NOW broadcast (channel 1). DATA frames (lever, target/engaged gear nibbles, rpm, temps, battery, alert bitmap, valid flags) every 200 ms; CONFIG frames (`link_config_t`: Patrol gauge calibration + alert thresholds, edited on A via the `cfg` serial console and stored in NVS) on change and every 5 s. Alerts are decided here; B only renders them. Spec: `docs/UART_PROTOCOL.md`. Bench-verified with both transports live and B deduplicating every frame `(verified 2026-09-21)`.
|
||||
|
||||
Controller B's side of this (receiver, ESP-NOW channel hopping, gauge outputs, bench wiring) is documented in the sibling wiki: `../../ESP32-S3-LCD-1.3/wiki/pages/controller-link.md` and `patrol-gauge-outputs.md`.
|
||||
|
||||
## Why it matters for the wiki
|
||||
|
||||
Any change to what data we extract from the [[can-bus-integration]] ripples into this packet **and** into Controller B's parser — both ends must move together.
|
||||
Any change to what data we extract from the [[can-bus-integration]] ripples into this packet **and** into Controller B's parser — both ends must move together: edit `include/protocol/automotive_data.h` here, bump `PACKET_VERSION`, copy the header byte-identical to B (B rejects other versions).
|
||||
|
||||
## Related
|
||||
|
||||
|
||||
Reference in New Issue
Block a user