Driveline screen: show engaged gear number; reset on ignition-off
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>
This commit is contained in:
@@ -90,6 +90,13 @@ typedef struct {
|
||||
bool ignition_on; // 0x3B4 byte 2 low nibble. This bus's only
|
||||
// ignition/terminal signal — CAS (0x130) is not
|
||||
// present in the swap.
|
||||
uint8_t lever; // 0x1D2 byte 0 as gear_position_t: the selected
|
||||
// detent (P/R/N/D). GEAR_UNKNOWN before first frame.
|
||||
uint8_t engaged_gear; // 0x1D2 byte 1: gear the box is actually in, 1..6;
|
||||
// 0 = none (P/R/N, and R which is unnumbered here).
|
||||
// Populated in plain D too, not just S/M.
|
||||
uint8_t gear_mode; // 0x1D2 byte 4 raw: GEAR_MODE_DRIVE_AUTO / _SPORT
|
||||
// / _MANUAL. Only meaningful when lever == D.
|
||||
bool gear_mismatch; // lever (0x1D2) vs gearbox (0x0BA) disagree,
|
||||
// sustained past the debounce window
|
||||
} driveline_t;
|
||||
|
||||
Reference in New Issue
Block a user