Files
ESP32-S3-Touch-LCD-5B/wiki/log.md
T
julian f60bdac268 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>
2026-09-21 19:12:31 +02:00

14 KiB
Raw Blame History

Log

Append-only. grep "^## \[" log.md | tail -5 for recent activity.

[2026-07-15] setup | Wiki instantiated

Created schema (CLAUDE.md), index.md, log.md, and five seed pages built from repo knowledge: bmw-m57n-engine, esp32-s3-touch-lcd-5b, can-bus-integration, dual-controller-architecture, open-questions. Deleted Obsidian's default Welcome.md. Flagged: the firmware's CAN ID map looks like placeholders (two IDs exceed 11-bit range); raw/ESP32-S3-Touch-LCD-5B.md is an empty clip and needs re-clipping.

[2026-07-15] ingest | Waveshare ESP32-S3-Touch-LCD-5 product wiki

Re-clipped raw/ESP32-S3-Touch-LCD-5B.md ingested → esp32-s3-touch-lcd-5b-waveshare-wiki. Answered two open questions: CAN transceiver is onboard (TJA1051T/3/1J, terminal block, 120 Ω termination switch off by default) and power is solved by the 7–36 V DC wide input (vehicle 12 V direct). New concern raised: operating temp spec is 0–65 °C, marginal for automotive. Updated esp32-s3-touch-lcd-5b and open-questions; added schematic PDF to sourcing wishlist.

[2026-07-15] ingest | E60 VFL CAN codes spreadsheet + Listen_and_send_PID Arduino sketch

Two raw sources ingested. (1) E60 VFL CAN-Bus Codes.xlsx (community table, ~130 ID blocks from a real pre-facelift E60) → e60-vfl-can-codes-xlsx: independently confirms 0x1D0 coolant raw−48 (0x7A→74 °C) and 0x3B4 battery voltage (leaning 12-bit LE layout, factor ≈0.0147–0.015), adds 0x304 as a 2-byte gear-lever candidate (P=E3/R=C2/N=D1/M=C9, D value suspect), engine-running flag in 0x3B4 byte 3; contains no oil-temp or gearbox-temp rows. (2) Listen_and_send_PID_009c (Arduino MCP2515+ELM327, 2013) → listen-and-send-pid-arduino: transmits E46 cluster frames from OBD PID polling — filed as technique reference for a future diagnostic-request mode; no map changes. can-id-candidates updated: coolant now "very high" confidence; oil/gearbox temps flagged as weakest signals.

[2026-07-15] query | Deep research: E60/E65 CAN IDs for M57N + ZF EGS

Deep-research workflow ran (interrupted twice by session task-loss on Windows; ~82 agents total, 95 claims, 30 adversarial verifications completed; synthesis done manually from the journal). Result: can-id-candidates — coolant/oil temp on 0x1D0 (raw−48, DDE, 100 ms; confirmed live on a real E60), gear on 0x1D2 (EGS, 200 ms, two generation dialects that likely reconcile), gearbox oil temp on 0x0B5 byte 7 (offset disputed 0 vs +40 — bench-critical), battery voltage on 0x3B4 (layout disputed 12-bit×0.015 vs 24-bit×0.001). Fault codes are NOT passively broadcast — require 0x6F1/0x612 diagnostic requests; firmware fault_codes field needs a design decision. Firmware's placeholder IDs contradicted by every source. Updated can-bus-integration; index updated. Cost note: bulk of tokens spent in the initial (pre-interruption) run; resumes replayed from cache.

[2026-07-15] update | Donor and target vehicle confirmed by user

User confirmed: donor chassis is E60/E65 (2003+), transmission is a BMW auto with EGS on the CAN bus, target vehicle is a Nissan Patrol. Created nissan-patrol-swap; updated bmw-m57n-engine (E46-era candidate IDs flagged as probably wrong generation) and open-questions (three questions moved to Answered). Next: web research for E60-generation PT-CAN broadcast IDs.

[2026-07-16] ingest | Gear lever fully decoded & VERIFIED (0x1D2)

User captured steady byte values per lever detent (raw/gear_box_can_revealings.csv) → gear-box-can-revealings. 0x1D2 verified as the gear source: byte0 = P 0xE1 / R 0xD2 / N 0xB4 / D 0x78 (all match documented codes exactly); byte0 can't split D from S/M (shared 0x78) so byte4 does it (0xF0 auto / 0xF1 Sport-Manual / 0xF2 downshift −); byte1 is a drive-gate flag (0x0F→0x5F); byte3 = rolling counter (confirms prediction). 0x0BA also tracks the lever but is messier (D/S-M collide) — don't use. Promoted 0x1D2 gear row to VERIFIED and rewrote the encoding-dispute section in can-id-candidates; updated index. Still open: actual engaged gear number (needs a drive capture) and the manual up-shift (+) value. Next: rewrite firmware gear map to 0x1D2 byte0 (+byte4).

[2026-07-17] update | Driveline screen live; torque decoded; output-shaft scaling revised

Firmware flashed and running on the car. Built a hand-coded Driveline screen (src/, boot screen, swipe to reach Home) showing gear + coolant + gearbox temp + RPM + torque + turbine + output-shaft + status chips. Three findings from the user testing it: (1) Torque decoded & verified — on 0x0A8 TORQ_AVL (available engine torque; user-identified the ID). User's Excel (D2*256+D1)/32 is algebraically bits12-23 ×0.5; confirmed against the repo's 0x0A8 worked example (24 Nm, ALIV=8 in D1 low nibble), ~27-28 Nm at idle. Firmware masks D1's low nibble (alive counter, not torque) and sign-extends. Note 0x0AA TORQ_DVCH is the same layout but driver demand — identical at idle, diverges under load. → can-id-candidates, driveline-speed-signals. (2) Output-shaft scaling revised: a direct Launch reference (output speed 128 rpm at our raw 1192) contradicts the earlier ×0.125 (would predict 149) and points to ~0.107. One eyeballed cross-tool point, so not adopted — but 0.125 is downgraded, and the Launch now gives a direct rpm reference so calibration is just a multi-point sweep + linear fit. Firmware keeps raw counts. (3) Fixed a latent display bug: main.cpp showed DEFAULT_* placeholder temps/voltage as if measured; now gated on valid_flags. Ignition decoded from 0x3B4 byte2 (user: 0x00=on/0x09=off, tracks ignition not engine — both published sources wrong here).

[2026-07-17] ingest | First drive capture — 0x0BA gear ladder verified, output-shaft scaling narrowed

raw/log_20260717_145930.txt (CANNY 5.3 Pico, 1,857 frames / ~34 s, filtered to 0x0BA + 0x1D2) → can-capture-2026-07-17-drive. First capture with the vehicle actually moving. Closes the inference left open yesterday: ST_GR_GRB values 6/7/8/9/A observed directly (238/77/93/127/94 frames) = 2nd–6th, so 0x0BA D0's low nibble is a complete gear source on its own — P/R/N + 1st–6th, reverse included; 0x1D2 is now needed only for lever + mode. Also caught ST_CCLT (converter lockup) live — 422 frames "controlling" in the higher gears, which matters because a locked clutch makes turbine = engine exactly, so the engagement-ratio test needs to read it before trusting a ratio ≈ 1.0 at road speed. Output shaft identification VERIFIED (rises monotonically 1139→16702 across gears 1→6, zero whenever the output is held). Scaling narrowed to ×0.125 (unverified): implies a coherent 901→1872 rpm upshift schedule across five independent ratios, vs 7,200–15,000 rpm for raw-as-rpm against a ~4,500 redline. User confirmed the box is a ZF 6HP26X — same gearset as 6HP26 so the ratio table holds, and the xDrive output variant dates the donor to E60/E61, not E65 (partly answers open Q#2). New question #11: was the transfer case retained? The X box measures output upstream of it, so a Patrol transfer case in the path would make road speed high/low-range dependent. Remaining assumption on the scaling: max-output-per-gear = upshift point — one capture including 0x1A2 closes it (turbine ÷ output = ratio directly). Updated driveline-speed-signals, gear-box-can-revealings, can-id-candidates, nissan-patrol-swap, open-questions, index.

[2026-07-17] ingest | E65_ReverseEngineering repo — both disputes resolved, driveline speeds discovered

User pointed at HeinrichG-V12/E65_ReverseEngineering (per-ID DBC-style docs, worked example on every page) → e65-reverse-engineering-repo. Highest-value source to date; combined with re-analysis of our own raw/can-capture-2026-07-15-gearshift.csv it closed most of the frontier. Resolved: gearbox oil temp = raw − 40 (source example + our own gearbox-31 °C-vs-coolant-37 °C warm-up cross-check; my earlier "leaning offset 0" was wrong); battery = 12-bit LE × 0.015; engine was running in the 2026-07-15 capture (ST_ENGINE_RUN=2 in 397/397) — cold-start capture no longer needed; RPM = 0x0AA ×0.25 (679–684 idle). Discovered: 0x1A2 RPM_GRB_TURB turbine speed — a physical engagement proof (P/N ≈634/628 free-spinning vs D ≈70, R ≈0 stalled — textbook converter behaviour), plus 0x0BA bits 20–39 output shaft (undocumented anywhere; zero in every stationary frame incl. engaged-in-D, non-zero once wheels turn), plus ANG_ACPD pedal % and ST_CLCTR_V cruise state. New page driveline-speed-signals — emphasized per user: no DSC on this bus ⇒ output shaft is our only road-speed source, hence the feedback variable for a future cruise-control PoC (safety envelope documented; actuation = transmitting torque requests, a different risk class from everything read-only so far). Corrected three of my own 2026-07-16 claims: 0x1D2 D1 is the engaged gear (not a "drive-gate flag" — it read 1 because the car was stationary); D4 0xF2 is a persistent Manual mode (not a "downshift event" — it holds across gears 2–6); 0x0BA is not to be dismissed (I'd read D7, an alive counter, instead of D0's ST_GR_GRB — which is the only source of engaged reverse, 0x1D2 D1 staying 0x0F in R). Also: boost is not broadcast (AIP_ENG caps at 1108 hPa = barometric) — confirms the Launch must poll. Updated can-id-candidates, gear-box-can-revealings, open-questions, index. Next: firmware pass over the whole verified map.

[2026-07-16] ingest | First live CAN capture — research map CONFIRMED

First real dump off the swap's bus, taken with the board's own new raw-frame logger ((repo); USB-CDC stream, serial mutex, ~486 frame/s, ~1.4% line loss). Raw filed at raw/can-capture-2026-07-15-gearshift.csv (20,596 frames) → can-capture-2026-07-15. Findings: 15 IDs live incl. all four researched signal IDs (0x1D0, 0x1D2, 0x0B5, 0x3B4) + bonus 0x0AA/0x0BA; firmware's placeholder IDs (0x4F/0x55/0x201/0x1001/0x101F) verified absent; researched-but-absent: 0x130/0x304/0x192. 0x1D0 b0 drifts 0x55→0x58 (coolant −48, ~37→40 °C); 0x1D0 b1 = 0xFF (oil temp unpopulated). 0x1D2 gear encoding resolved: DLC 6, byte0 whole-byte codes (0xE1=P, 0xB4=N, 0x78=D seen live). 0x3B4 at ~5 s rate but payload dormant (0xFF) — engine state unconfirmed. Updated can-id-candidates, can-bus-integration, esp32-s3-touch-lcd-5b, open-questions, index. Also corrected a firmware fact across pages: driver runs TWAI_MODE_NORMAL (ACKs the bus), not LISTEN_ONLY; TJA1051 is non-isolated → must share vehicle ground. Next: cold-start + confirmed-engine-running capture to lock coolant/battery scaling; use differential (per-position) captures for gear.

[2026-09-21] update | .docs folder retired; UART spec moved to docs/; board photo ingested

The repo's .docs/ folder was deleted (user decision). CAN_BUS_INTEGRATION.md documented the dead placeholder IDs and an external transceiver the board does not need — superseded by can-id-candidates and can-bus-integration. UART_PROTOCOL.md (the packet spec, shared with Controller B) moved to docs/UART_PROTOCOL.md as the single copy; Controller B's duplicate was removed. The annotated board photo moved to raw/ → esp32-s3-touch-lcd-5-intro-photo: confirms the terminal-block order, that GPIO 44 exits only as the RS485 A/B pair, and that one 120 Ω switch serves both CAN and RS485. Root CLAUDE.md corrected: verified CAN ID list replaces the placeholders, TWAI_MODE_NORMAL replaces "LISTEN_ONLY", UART TX is GPIO 44 (was written as 43), dummy-data references removed.

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).

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.