End-to-end path
Chassis/Haldex CAN frame -> can_rx.cpp
-> mapped decode attempt (bus/id/signal/mux/unit)
-> telemetry state update (speed/throttle/rpm)
-> fallback decode if mapped signal stale/missing
-> calcs.cpp computes lock_target
-> frames.cpp applies generation-specific byte shaping
-> transmit to Haldex bus
-> optional rebroadcast status on chassis bus
Timing model
- CAN RX loops run continuously with short task delay (
vTaskDelay(1)).
- Mapped telemetry freshness uses per-input timestamps with 1000 ms timeout.
- UI polling is periodic and non-real-time; control loop timing is firmware-owned.
Detailed sequence (chassis receive loop)
- Refresh mapping bindings from current configured signal keys.
- Receive frame from chassis bus.
- Cache frame for CAN view.
- Try mapped decode for throttle, rpm, and speed using DBC descriptor matching.
- Mark each mapped signal fresh if decode succeeded.
- Compute mapped freshness flags (
speed, throttle, rpm).
- If not standalone mode, run fallback extraction for stale or missing mapped inputs.
- If mode is not stock, call lock data and frame mutation path for selected generation.
- Transmit toward Haldex with generated-frame marker for diagnostics.
Fallback hierarchy example (speed)
- Preferred: mapped DBC signal key from setup mapping.
- Fallback 1: ABS aggregate speed decode from BR1 frame.
- Fallback 2: engine-frame fallback when ABS speed is stale or unavailable.
Detailed sequence (haldex receive loop)
- Receive frame from Haldex bus.
- Cache frame for CAN view.
- Optionally decode mapped telemetry if mapping targets Haldex bus signals.
- Extract generation-specific engagement and state bits for diagnostics.
- Update AWD status model.
- Forward Haldex traffic to chassis bus when bridge/broadcast is enabled.
UI visibility versus control reality
- Truth: control loop runs fully in firmware independent of browser.
- Truth: UI reflects and mutates state through API endpoints.
- Do not assume: UI refresh intervals define control update rates.
- Do not assume: localStorage values are canonical after reconnects.
Try the OpenHaldex Firmware Demo
Preview the real OpenHaldex firmware UI in your browser with simulated live CAN traffic and interactive pages for tuning, diagnostics, logs, setup, and OTA workflows.
Open firmware demo