Reverse lights on DO0, Sport + Vehicle screens, per-DDE live data, ECU identification
Firmware / build (push) Successful in 10m49s

- ReverseLight: isolated output DO0 (CH422G OC0 -> PC817 -> NPN sink) drives the
  reverse-lamp relay while the lever is in R on a live bus with ignition on; 10 Hz
  decision confirmed over 200 ms, written through the panel library's expander
  object so the backlight cannot undo it; `reverse status|on|off|force` console,
  default ON (NVS `revlight_en`). Wiki page reverse-lights-output with the wiring.
- Sport screen: BMW-style power + torque gauges (lv_meter on a dial-face image,
  image needle); PNG sources in assets/, tools/png2lvgl.py converter.
- Vehicle: final drive ratio + tyre circumference -> road speed, hp from torque;
  Settings > Vehicle page; `vehicle` console.
- Bench simulation (`sim` console) overlays torque / rpm / shaft on the snapshot.
- EcuIdent: KWP 1A 86 / 1A 80 read once, stored in NVS, shown on Settings >
  Vehicle, passive ECU CHANGED? check; `ecu` console.
- Ignition fallback from the 0x1D2 lever byte on buses without 0x3B4 (Patrol 2).
- Engine data: per-DDE `2C 10` identifier profiles (Patrol 1 vs Patrol 2
  rail 00C2 / boost 003A / battery 002F); DiagProbe liveConfigure().
- Wiki: Patrol 2 captures, vehicles page, obd identifier table per DDE, logs.
This commit is contained in:
2026-10-28 16:46:42 +01:00
parent 8ded9c2a08
commit 1cba9f30bc
60 changed files with 70386 additions and 100 deletions
+40
View File
@@ -230,3 +230,43 @@ In the car the Driveline showed locked while unlocked and open while locked; the
## [2026-10-07] ingest + build | Boost / charge-air temp / battery identifiers; Engine data screen
Ingested three CANNY-logger captures (`raw/airtemp38-63.txt`, `raw/boost.txt`, `raw/battery12-27.txt`) -> [[launch-captures-2026-10-07]]: the Launch reads `2C 10 16A8` (charge-air temp), `0091` (boost actual), `0093` (battery), each a 2-byte `6C 10` reply. Engine off throughout, so one calibration point each: boost mbar = raw / 8 fits 1028-1034 mbar; temp and battery fits are guesses. User decision: a no-password **Engine data screen** (button on Driveline) showing rail, boost, charge-air temp, battery - polled only while shown, paused while another tester is on the bus, provisional values tagged and raw shown. Updated [[obd-diagnostic-polling]] (identifier table, decision), index.
## [2026-10-13] update | Road speed from the output shaft; Sport screen (torque + power gauges)
User requirements: road speed = output shaft × differential ratio 4.11:1 × tyre circumference, both numbers as settings under System; and a BMW-style "Sport screen" with two gauges, torque and hp (P(W) = Nm × rpm / 9.5488, hp = W / 745.7). Built as `vehicle.cpp` (final drive x100 + tyre mm in NVS, deferred write, `vehicle` console, speed and power maths) and `sport_screen.cpp` (two `lv_meter` gauges 0-600 Nm / 0-300 hp with arc fill, needle, 3 s peak-hold needle; rpm + ~speed below; Sport button on the Driveline). Settings gained a fourth tab, **Vehicle** (-/+ rows, live preview, Reset). The Driveline's bottom row now has four stats: torque, pedal, output (~rpm), speed (~km/h). The final drive 4.11:1 is recorded on [[nissan-patrol-swap]] (user); tyre size is still open (default 2440 mm = 265/70 R16, unverified), so [[open-questions]] #10 is half closed and every speed keeps the `~` of the provisional shaft factor (#8). Flashed to the Main CTRL on COM11 later the same day, together with the `sim` console (next entry).
## [2026-10-13] update | `sim` console: bench torque / rpm / shaft for the screens
User asked whether torque can be simulated to look at the Sport gauges without the bus; the existing `cfg override` only forces the Inst. Cluster's outputs. Added `bench_sim.cpp`: `sim torque <Nm> [rpm <n>] [shaft <rpm>]`, overlaid on the driveline snapshot with ignition on, shown as `IGN SIM` / SIMULATION on the screens, console only (no slider - user decision), never saved, off at boot. The first bench run of `sim torque 350 rpm 2500 shaft 1200` exposed a x10 slip in the speed maths (4.3 km/h for 1199 shaft rpm); fixed to 42.7 km/h, 122.9 hp checked against the formula, `sim` / `vehicle` commands verified on COM11, flashed.
## [2026-10-13] update | Sport gauges redrawn after the BMW photo; needle as a PhotoCraft image
The user shared a photo of the BMW iDrive Sport displays and wanted the gauges like it. Band rebuilt from stacked `lv_meter` arcs (dark red -> orange inward, bright rim, dark dividers, numbers inside the band, unit in the middle, name below, black background; Power left, Torque right). The needle went through three versions: plain line, a hand-drawn tapered wedge in the meter's draw hook, and finally an **image**: the user asked whether to draw PNGs in Photoshop, then pointed at PhotoCraft (storytold/photocraft, open-source Rust Photoshop clone with a built-in MCP server) - installed portable, its `photocraft-cli mcp` registered in Claude Code, and the needle drawn through it (gradient wedge + bright tip, two outer glows, exported `assets/needle.png`, source `assets/needle.pcraft`). `tools/png2lvgl.py` converts to `src/assets/needle_img.c`; `lv_meter_add_needle_img` rotates it. Flashed COM11 with `sim torque 350 rpm 2500` on for the user to judge.
## [2026-10-13] update | BMW gauge deconstructed element by element with the PhotoCraft MCP; dial face as an image
User: "deconstruct the gauge element by element using this new MCP". Opened the photo in PhotoCraft, perspective-cropped the screen straight (`assets/reference/bmw-screen-straight.png`), cut the Torque gauge and three zooms, fitted the rim circle and profiled the band radially and angularly. Findings (fractions of the outer radius): thin bright rim 0.985-1.0; a ruler ring 0.93-0.985 with ~5 fine rungs per cell between two bright lines; a dark gap; the cells ring 0.75-0.91, brightest orange at its inner edge fading to dark red outward, 16 cells with dark gaps, 5 bright spokes at the numbers; numbers at ~0.64 R; sweep ~230 degrees open at the bottom (the firmware had 270); needle from ~0.33 R with a lit tip. The photo's colours are unusable (glass reflection) - structure only. Rebuilt at 420 px as PhotoCraft layers from computed geometry (`assets/dial_geometry.json`, circles as boolean subpaths, 81 rungs and 15 gaps as polygons), exported `assets/dial.png`, source `assets/dial.pcraft`; the Sport screen now shows the image under an lv_meter that draws only numbers and the image needle. Gotcha found: PhotoCraft maps a shape gradient to the bbox of all subpaths including subtracted ones.
## [2026-10-18] ingest + build | Second Patrol's CAN captures; ignition without 0x3B4; the DDE read once (`EcuIdent`)
User: "I have a new patrol with bmw engine. The ECU is the same. I did collected some can bus logs using canny" — three CANNY logs (`raw/ingnition-only.txt`, `raw/engine-on.txt`, `raw/launch-diag-rail-pressure.txt`) → [[can-capture-2026-10-18-patrol-2]]. Offline analysis with the firmware's scalings: every decoded frame identical in layout and plausible in value; **`0x3B4` / `0x3B3` / `0x332` absent** (the firmware's only ignition source), `0x38E` new, `0x1B6` changed; the Launch's `1A 80` reads show a **different DDE** (7794904 / 2004-01-21 vs 7796678 / 2006-02-16); engine-off `TORQ_AVL` is junk (812 Nm); the Launch polled a new rail identifier `00C2`; `0x1D0` bytes 4–5 behave like a fuel counter. Then "How to differentiate between these different DDEs? Tomorrow I will have another setup" → the identity is a label (read once), behaviour adapts to the frames present; user's rule: save the part number at the first start, never re-check at boot, show UNKNOWN ECU until read. Built `(repo)`: ignition fallback from the `0x1D2` lever byte (`0x3B4` keeps precedence for 10 s after it is seen, source logged), torque gated on the run state (Sport + Driveline), `EcuIdent` (`1A 86` then `1A 80` through `DiagProbe`, NVS blobs, Settings → Vehicle line + Re-read ECU, `ecu show | dump | forget`, passive compare of a Launch's `1A 80` → ECU CHANGED?). Flashed to COM11; on the bench `ecu show` = UNKNOWN ECU, no transmit (CAN off). New page [[vehicles]] (one row per setup + capture checklist for tomorrow); [[can-id-candidates]] callout, [[obd-diagnostic-polling]] identifiers + ident layouts, [[open-questions]] #15, [[nissan-patrol-swap]] note.
## [2026-10-18] build | Live-data identifiers are per DDE: Engine data profiles keyed on the ECU identity
User, with the board on Patrol 2 for the first time: "The rail pressure is wrong. It shows nothing. The air intake temp shows some > 300 degree. The boost is static somewhere 2800 mBar. Also the output speed remains 0." Diagnosis from the logs already in `raw/`: Patrol 1's `2C 10 00DF/0091/16A8/0093` are addresses inside that DDE's software; the Launch polled `00C2` for rail on Patrol 2 and sent no `15E0` define. So the rule "the identity is a label" gets its one exception: `(repo)` the Engine data screen now carries a `PROFILES[]` table (part numbers → identifier set + provisional flags), selected through `EcuIdent::hasPart()`, installed into `DiagProbe` with the new `liveConfigure()` (`live_set_t`, 0 = slot never asked). Patrol 2's profile has rail `00C2` only (scale assumed ×0.03 — the Launch showed ~330 bar at idle); boost, charge-air temp and battery read "identifier not known for this ECU yet". No identified ECU or no profile → nothing is polled and the status line says why; the profile is re-evaluated every tick so the first identification takes effect on screen. The output-speed question stays open: every Patrol 2 log is stationary. Pages: [[obd-diagnostic-polling]] (per-DDE identifier table + callout), [[vehicles]] (rule 3, identifier column, checklist asks for a Launch session per value), [[open-questions]] #15, [[can-capture-2026-10-18-patrol-2]] consequence 5. Built; the board was in the car (no COM port), so not flashed from here yet.
## [2026-10-18] update | Patrol 2's own identification read: DDE 7796156 - 2006-05-17
User: "The actual reading is DDE 7796156 - 2006-05-17" (Settings → Vehicle, the board's first key-on on Patrol 2) — the `1A 86` read succeeded on this unit. Like Patrol 1 (7796678 on `1A 80` vs 7799764 on `1A 86`) the two blocks carry different part numbers; the Launch's `1A 80` says 7794904 / 2004-01-21. Both numbers are in the Patrol 2 `PROFILES[]` row `(repo)`; [[vehicles]] row, [[obd-diagnostic-polling]] table header and [[open-questions]] #15 updated. Rebuilt; flashing waits for the board to be back on USB.
## [2026-10-18] verify | Patrol 2 ident dumped over USB: E65 donor; profile firmware flashed
Board back on COM11 (dev build with the per-DDE profiles flashed, SUCCESS). `ecu show`: both blocks stored on Patrol 2 — `1A 86` 66 B part 7796156 / 2006-05-17 / VIN prefix **WBAGM21070 (E65 7-series)**, `1A 80` 31 B part 7794904 / 2004-01-21 (so this board's `1A 80` is answered here, unlike Patrol 1). `diag status`: 0 requests since boot. All four part numbers are in the Patrol 2 `PROFILES[]` row. Donor difference (E60 vs E65) recorded on [[vehicles]], [[nissan-patrol-swap]], [[open-questions]] #15 as the likely reason for the bus and identifier differences `(unverified)`.
## [2026-10-18] ingest + build | Patrol 2 boost `003A` and battery `002F` from two Launch captures; output shaft confirmed
User: "The output shaft is good now" (the earlier 0 was the stationary car) and two new CANNY logs with the Launch on Patrol 2, `raw/charge-air-pressure.txt` and `raw/battery.txt` → [[launch-captures-2026-10-18-patrol-2]]. The Launch polled `2C 10 00 3A` for charge-air pressure (raw 8 071–9 487: 1 018 mbar at idle, 1 186 at the top of a 2 553 rpm blip, decaying to ambient after key-off at ÷ 8) and `2C 10 00 2F` for battery (5 166–5 723: 14.0 V with the alternator, 12.7 V after the engine stop at × 0.002455). No define, no negatives. The Launch's displayed values were not noted, so both keep Patrol 1's scale as `(unverified scale)`. `(repo)` Patrol 2's `PROFILES[]` row = rail `00C2`, boost `003A`, battery `002F`, all provisional; charge-air temperature still "identifier not known". Pages: [[obd-diagnostic-polling]] table, [[vehicles]] row (shaft resolved), [[open-questions]] #15, index. Built; the board was off USB, flash pending.
## [2026-10-28] setup | Reverse lights from DO0 — relay on the isolated output, firmware follows the lever in R
User: "I need to control a relay from ESP32-S3-LCD-5B ... I have some 2N2222 transistors", then "When the R gear is selected I need to light the rear lights." Read the DO circuit off the schematic PDF text (`raw/ESP32-S3-Touch-LCD-5-Sch.pdf`): CH422G **OC0** (pin 8) → R24 100 Ω → PC817 T1 (anode 510 Ω to 3V3) → 1 kΩ → NPN power transistor T2, collector = `DOUT0`, emitter = board GND; OC1/T3/T4 the same for DO1. So the "isolated" outputs return through the board's GND, and OC0 LOW = output on. No 2N2222 needed (no spare native GPIO anyway). New page [[reverse-lights-output]] with the wiring (coil +12 V ↔ DO0, flyback diode, ≤ 450 mA). `(repo)` new `reverse_light.cpp`: lever == R on a live bus with ignition on → DO0 on, 10 Hz decision confirmed over 200 ms, written through the panel library's expander object (the backlight rewrites the cached OC register, so raw I2C would be undone during OTA), `reverse status | on | off | force on|off|auto`, default ON, no Settings row (System page full). [[esp32-s3-touch-lcd-5b]] I/O row updated, index. Not yet seen in the car.