feat(sim): gate the DI wired-switch mirror on GTW_brakeLineSwitchType #19

Merged
outlandnish merged 1 commit from feat/sim-brake-line-switch-mode into main 2026-09-11 11:01:55 -05:00
Owner

Follow-up to the DI wired-brake-switch work (#18): make the 0x1D6 mirror a car-config toggle and stop it clobbering UI/manual brake control.

Behaviour

  • GTW_brakeLineSwitchType gates whether the ECU brake nodes follow the DI's own wired switch (broadcast on 0x1D6 bit33):
    • VC_ONLY — ignore 0x1D6; ESP/IBST/VCLEFT keep UI/manual (dash-toggle) control.
    • DI_VC_SHARED — mirror 0x1D6 into all three vote sources (ESP 0x145 + IBST 0x39D + VCLEFT 0x3C2), so the physical wired switch drives DI_brakePedalState.
  • All three ECU nodes now gate on the mode (previously only VCLEFT was gated; ESP/IBST mirrored unconditionally and got clobbered by a released 0x1D6 — which is why only VCLEFT tracked the dash toggle).
  • Each node learns the mode live from GTW_carConfig 0x7FF mux3, so flipping it is one edit in the dash car-config editor (or a [scenario.GTW] entry).

Default: VC_ONLY (GTW car-config default + node inits), so the sim's brake nodes keep UI control out of the box; set DI_VC_SHARED for the wired-switch passthrough. (Not the real-car default of DI_VC_SHARED — a deliberate bench choice; the DIR itself never reads this signal.)

Shared helpers in tesla_frames: normalize_brake_line_switch_type, gtw_brake_line_switch_type (VCLEFT refactored onto them).

Tests: VC_ONLY-ignores / DI_VC_SHARED-follows for ESP/IBST + VCLEFT, carconfig mux3 learning, and the GTW golden updated for the VC_ONLY default. Full suite green (3164), ruff clean on changed files.

🤖 Generated with Claude Code

Follow-up to the DI wired-brake-switch work (#18): make the 0x1D6 mirror a **car-config toggle** and stop it clobbering UI/manual brake control. **Behaviour** - `GTW_brakeLineSwitchType` gates whether the ECU brake nodes follow the DI's own wired switch (broadcast on 0x1D6 bit33): - **VC_ONLY** — ignore 0x1D6; ESP/IBST/VCLEFT keep UI/manual (dash-toggle) control. - **DI_VC_SHARED** — mirror 0x1D6 into all three vote sources (ESP 0x145 + IBST 0x39D + VCLEFT 0x3C2), so the physical wired switch drives `DI_brakePedalState`. - **All three** ECU nodes now gate on the mode (previously only VCLEFT was gated; ESP/IBST mirrored unconditionally and got clobbered by a released 0x1D6 — which is why only VCLEFT tracked the dash toggle). - Each node learns the mode **live from `GTW_carConfig` 0x7FF mux3**, so flipping it is one edit in the dash car-config editor (or a `[scenario.GTW]` entry). **Default: VC_ONLY** (GTW car-config default + node inits), so the sim's brake nodes keep UI control out of the box; set DI_VC_SHARED for the wired-switch passthrough. (Not the real-car default of DI_VC_SHARED — a deliberate bench choice; the DIR itself never reads this signal.) **Shared helpers** in `tesla_frames`: `normalize_brake_line_switch_type`, `gtw_brake_line_switch_type` (VCLEFT refactored onto them). Tests: VC_ONLY-ignores / DI_VC_SHARED-follows for ESP/IBST + VCLEFT, carconfig mux3 learning, and the GTW golden updated for the VC_ONLY default. Full suite green (3164), ruff clean on changed files. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(sim): gate the DI wired-switch mirror on GTW_brakeLineSwitchType
Some checks failed
Tests / test (pull_request) Has been cancelled
b68e8a9e5c
ESP/IBST/VCLEFT follow the DI's 0x1D6 wired brake switch only in DI_VC_SHARED; in
VC_ONLY they ignore 0x1D6 so UI/manual (dash toggle) control wins. Each ECU node
learns the mode live from GTW_carConfig 0x7FF mux3, so switching behaviour is a
single car-config toggle. Shared helpers in tesla_frames
(normalize_brake_line_switch_type, gtw_brake_line_switch_type).

Default flipped to VC_ONLY (GTW car-config default + node inits) so the sim's brake
nodes keep UI control out of the box; set DI_VC_SHARED (dash car-config editor or a
scenario) to enable the wired-switch passthrough. Before this, ESP/IBST mirrored
0x1D6 unconditionally and got clobbered by a released 0x1D6 while only VCLEFT was
gated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
outlandnish/tm3diag!19
No description provided.