Commit Graph

9 Commits

Author SHA1 Message Date
julian 1cba9f30bc 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.
2026-10-28 16:46:42 +01:00
julian 803af7568f Rename Controller A/B -> Main CTRL / Inst. Cluster (user); Sleep when the car is off: Settings switch, deep sleep on quiet CAN + idle screen, CAN RX wake, switch mirrored to the cluster; docs
Firmware / build (push) Successful in 7m22s
2026-09-28 16:38:13 +02:00
julian bbfa5d9e80 tools/perf_session.py: log PERF lines + typed markers while provoking display symptoms
Firmware / build (push) Successful in 4m10s
2026-09-27 16:44:29 +02:00
julian effa949429 OTA updates for Controller A: dual-slot partitions, signed Gitea releases
- partition table: two 7.9 MB OTA slots, SPIFFS dropped, nvs/otadata offsets
  unchanged (tunables survived the one-time USB flash)
- ota_update.cpp: manual `ota status|check|install|rollback` console; HTTPS
  pull from the public repo's latest release, ECDSA P-256 signature over
  "patrol-a|version|sha256" checked before download, streamed image must match,
  parked gate before download and before the slot switch, 30 s
  confirm-or-rollback (verifyRollbackLater override)
- ota_config.h: server/repo, ISRG Root X1 + Root YR, signing public key
- .gitea/workflows/firmware.yml: main -> rolling unsigned pre-release
  main-latest; v* tag -> signed release (needs secret FIRMWARE_SIGNING_KEY)
- wiki: pages/ota-updates.md (design, decisions, B-over-ESP-NOW plan);
  CLAUDE.md, index, log, open-questions #12 updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 21:59:46 +02:00
julian 61e190b1b9 Diag scans: 22 D1xx refuted, 21 xx session-locked; add diag raw toggle + scanner
- diag probe: `diag raw on|off` console command (mutes CANRAW during scans)
- tools/diag_scan.py: identifier-space sweeper via `diag bmw`
- findings: whole 22 D1xx block NRCs (clipping identifiers wrong for this
  DDE); 21 xx sparse - 21 20 = O_269962, measurement blocks gated behind
  diagnostic session / security access -> Launch capture is the path to
  live data
- wiki: route-b source page + obd-diagnostic-polling updated, raw scan logs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-23 16:02:18 +02:00
julian 7a7398243b Diag day: Route A+B verified live, DTCs read, donor identified as E60 530d
- diag probe: add mode 03 (diag dtc), BMW KWP on 0x6F1 with extended
  addressing (diag ident, diag bmw), read-only service whitelist
  (1A/18/21/22), MAX_PAYLOAD 64->384, full hex+ascii dump of BMW replies
- tools/diag_session.py: one-session probe runner, logs into wiki/raw/
- wiki: Route A results (11 mode-01 PIDs, rpm/coolant cross-checked, mode
  09 silent), Route B verified (0x6F1 [12] -> 0x612), 1A 86 ident with
  VIN prefix WBANC92090 (E60 530d), DTCs P0101/P0113/P0500/P0545/P0030
  (disconnected-sensor swap leftovers), open-questions #2/#7 updated

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-23 12:54:24 +02:00
julian e9fc24778a Gauge drive day: CANNY comparison, cluster signal research, serial tools
Wiki: two new pages - canny-5-3-pico-gauge-drive (why the CANNY's 12V
negative output moved the needles and 3.3V push-pull could not; 2SK3069
low-side stage) and patrol-instrument-cluster (tach 2 ppr + trim -13
calibration, NTC temp sender curve, 20 kHz PWM flutter fix, and the
four-layer steppy-needle diagnosis ending at the cluster's ~150 rpm
count quantization, defeated with adaptive dither on B).

Tools: serial_logger.py (multi-port capture to wiki/raw), serial_cmd.py
(one-shot cfg commands to A), dual_serial_capture.py (bench snapshots),
tach_ramp.py / tach_ramp2.py (synthetic rpm sweeps via cfg override).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-23 11:12:20 +02:00
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
julian 87801c593c CAN raw logger + toggle fix; wiki: first live capture confirms ID map
Firmware — make the board a working CAN sniffer and fix real bugs:
- can_driver: add raw candump-style logger (CANRAW,<ts>,<id>,<extd>,<dlc>,<hex>),
  capturing every frame incl. unknown IDs for offline decoding. Single atomic
  write per frame.
- serial_lock: new global serial mutex so concurrent task writes (CAN logger,
  UART 5Hz log, heartbeat) no longer splice mid-line. Corruption 3.2% -> 1.4%.
- Fix CAN toggle: the switch had no event handler registered, so it never
  started CAN and reverted on screen change. Wire up onCANBusToggle.
- platformio: route Serial to native USB-CDC (USB_MODE=1, CDC_ON_BOOT=1) so the
  ~486 frame/s stream isn't throttled by the 115200 UART ceiling; bump monitor
  baud to 921600.
- tools/fix_toolchain_path.py: pre-build workaround for pioarduino nesting the
  Xtensa toolchain bin under a subdir that never reaches PATH.
- Correct misleading "LISTEN_ONLY" log string (driver runs TWAI_MODE_NORMAL).

Wiki — ingest the first live capture off the real swap bus:
- raw/can-capture-2026-07-15-gearshift.csv (20,596 frames) + sources page.
- Research map CONFIRMED: 0x1D0/0x1D2/0x0B5/0x3B4 all live; placeholder IDs
  (0x4F/0x55/0x201/0x1001/0x101F) verified absent; 0x130/0x304/0x192 absent.
- 0x1D0 b0 coolant drifts up (37->40C, -48 holds); 0x1D0 b1 oil temp = 0xFF.
- 0x1D2 gear encoding resolved: DLC 6, byte0 gear codes (E1=P, B4=N, 78=D live).
- Corrected LISTEN_ONLY -> NORMAL/ACK across pages; documented non-isolated
  TJA1051 grounding requirement. Updated index + log.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 12:24:25 +02:00