User-verified: 0x3B4's ignition nibble flips the instant the key toggles, even
though the message is nominally 5 s periodic - it transmits on-change too. So
the ignition-off screen reset is effectively immediate, correcting the earlier
assumption that it could lag by a few seconds. Comment/doc only, no logic change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Gear hero now shows the engaged gear, not just the lever letter. P/R/N stay as
letters; in the Drive detent it composes mode + number - D3 / S3 / M3 - from
0x1D2 byte 1 (engaged gear, populated in plain D too, verified climbing 1..6 in
the drive capture) and byte 4 (mode). Falls back to the bare mode letter before
the box reports a number, and in R (unnumbered here).
The three 0x1D2 pieces (lever, engaged gear, mode) are now carried in
driveline_t so the screen can compose its own label without disturbing the UART
packet's gear_position enum. lever defaults to GEAR_UNKNOWN, not 0 (which is
GEAR_PARK), so it doesn't read "P" before the first frame.
Ignition-off now blanks every readout instead of freezing the last frame, per
request - the screen goes quiet with the car. The ignition chip still shows IGN
OFF; the rest mute, since their values are meaningless with the key out. Driven
by 0x3B4's ignition nibble (5 s message, so the reset lags key-off by up to a
few seconds).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Turbine speed removed from the display - it's an engagement diagnostic, not a
driver number, and the Launch now gives output speed directly so it's no
longer needed for the ratio-calibration method either. Still decoded in the
driver. Its screen slot now shows accelerator pedal %.
Output shaft now displays approximate rpm instead of raw counts, via a
PROVISIONAL factor from the single Launch reference (128 rpm / 1192 raw =
~0.107, through a known zero). The tile is labelled "OUTPUT (~rpm)" - the "~"
keeps an unlocked scaling from reading as exact. Replace the factor once a
multi-point Launch sweep gives a real fit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Boot screen: land on the Driveline data screen instead of the SquareLine
gauges Home screen. Done in display_init after ui_init while the backlight is
still off (no flash of the wrong screen); Home stays reachable by swiping off
Driveline.
Engine torque added to the screen, decoded from 0x0A8 TORQ_AVL (available/
delivered torque), bits 12-23, signed x0.5 Nm. The user identified the ID and
supplied the spreadsheet formula (D2*256+D1)/32, which is algebraically
bits12-23 x0.5; confirmed against the repo's 0x0A8 worked example (24 Nm).
Firmware masks D1's low nibble (that's the alive counter, not torque - the
repo example shows ALIV=8 there) and sign-extends so overrun reads negative.
0x0AA TORQ_DVCH is the same layout but driver demand - identical at idle,
diverges under load - so the delivered value is the right one to show.
Output-shaft scaling revised: a direct Launch reference (output speed 128 rpm
at our raw 1192) implies ~0.107, contradicting the earlier x0.125 (which would
predict 149). One eyeballed cross-tool point, so nothing is adopted - the
field stays raw counts - but 0.125 is downgraded in firmware and wiki, and the
Launch now gives a direct rpm reference so calibration is just a multi-point
sweep and a linear fit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
New hand-coded LVGL screen (src/modules/driveline_screen.*) showing only
signals verified on this bus: gear as the hero, coolant and gearbox oil temp
flanking it, an engine RPM bar, and turbine / output-shaft speeds, plus
ignition, engine-run, converter-clutch, gearbox-cooling and gear-mismatch
status. Reached by swiping right from Home.
It lives in src/ and hooks its gesture onto the Home screen at RUNTIME rather
than editing ui_Home_Screen.c, because SquareLine Studio overwrites
include/ui/ on every export - that is how the CAN toggle's event handler went
missing. LVGL dispatches to every registered callback, so the runtime hook
coexists with the generated left-swipe handler instead of replacing it. Same
reasoning the existing meters_manager already follows.
Output shaft is labelled "raw" and shown as counts: the x0.125 scaling is
still a hypothesis, so inventing a unit here would launder it into fact.
Also fixes a defect found while wiring this up: main.cpp updated the Home
screen's meters and battery label unconditionally, but those fields are
pre-seeded with DEFAULT_* constants. With no CAN data the display showed a
confident 92.0degC engine oil temp and 12.45V battery that had never been
measured. Two of them have no source on this bus at all - engine oil temp has
no sensor (0x1D0 byte 1 is permanently 0xFF), and 0x3B4 publishes the
battery's not-available marker on nearly every frame. Now gated on
valid_flags, so an unmeasured value reads "--.--" instead of a plausible lie.
Same class of bug in the driver: 0x3B4's U_BT was accepted even when it read
0xFFF, which would have put a confident 61V on screen. Now rejected, leaving
the valid flag clear.
Decodes ignition state from 0x3B4 byte 2 (user-verified: 0x00 = on, 0x09 =
off, unmoved by the engine starting). Both the E65 repo (ST_ENGINE_RUN) and
the E60 VFL sheet (engine flag, 0x09 = running) are wrong about this field on
our bus - inverted and mislabelled. Noted at the definition so it doesn't get
"corrected" back. It also restores ignition sensing, which we thought was
lost with CAS/0x130 absent from the swap.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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>