Skip to content

TPMS: decode VCSEC_TPMSData (0x219) and expose tyre pressure and temperature in CarState - #270

Merged
wpmed92 merged 1 commit into
softwiredtech:mainfrom
ehoeve786:tpms-decoder
Nov 1, 2026
Merged

wpmed92 merged 1 commit into
softwiredtech:mainfrom
ehoeve786:tpms-decoder

Conversation

@ehoeve786

@ehoeve786 ehoeve786 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Bus 1 DBC (Android and iOS copies): VCSEC_TPMSData (0x219) is 7 bytes with a 3-bit mux. Mux 5 carries all four pressures; muxes 0-3 carry one sensor each (0 RR, 1 RL, 2 FR, 3 FL).
  • TeslaDashKitMapper: pressures from mux 5, temperatures from muxes 0-3. Rejects no-reading (0xFF) values; each wheel keeps its last value. Nothing is written until a 0x219 frame has been seen.
  • CarState: tpmsPressure{FL,FR,RL,RR} (bar, -1 = none) and tpmsTemp{FL,FR,RL,RR} (°C, -100 = none) in slots 39-46 after the VIN; FIELD_COUNT = 47. Android (CarState.kt, CanFrameDecoder.kt) and iOS (bridge struct, CarState.swift) carry them through.

No dashboard displays the values yet. Needs softwiredtech/dashkit-firmware#88, which forwards 0x219.

Testing

  • Host tests pass (tesla_vin_mapper).
  • Mux-to-wheel mapping and scaling checked against four Model Y CAN logs (2026-10-26..28): per-sensor pressures match mux 5 for each wheel, and mux 5 updates right after that wheel's sensor reports. Replaying the logs through the mapper gives steady per-wheel values.
  • Android debug APK builds. iOS app not built.

🤖 Generated with Claude Code

@wpmed92

wpmed92 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@ehoeve786 This CAN message is not forwarded from the DashKit fw, is there firmware counterpart to this?
Also, the PR is reallly verbose. Why does it require can_parser.h changes? In an ideal world it should be only the tesla mapper and the car state and the dbc that has to be updated, but i see a lot of other code parts touched.
Why does it require its own TpmsLatch?

@ehoeve786

Copy link
Copy Markdown
Collaborator Author

Submitted PR for the firmware that seems like I forgot.

Should be cleaned up now. Less files changed. And no TPMSLatch, which was used to drop stale readings after 60 seconds...

@ehoeve786
ehoeve786 marked this pull request as ready for review October 30, 2026 20:32
@ehoeve786
ehoeve786 marked this pull request as draft October 30, 2026 20:32
VCSEC_TPMSData is 7 bytes on the vehicle bus with a 3-bit mux. Mux 5 carries
all four wheel pressures (0.025 bar); muxes 0-3 carry one sensor each
(pressure at 0.05 bar, temperature, sensor battery). Mux 4 is ignored.

- bus_1_tesla_vehicle.dbc (Android and iOS copies): 7-byte layout replacing
  the 5-byte one.
- TeslaDashKitMapper: pressures from mux 5 only, temperatures from muxes
  0-3 (mux 0 RR, 1 RL, 2 FR, 3 FL). The coarser per-sensor pressure is not
  used so the value doesn't alternate with mux 5. "Not available" raw values
  (0xFF) are rejected, fields keep their last value, and nothing is written
  until a 0x219 frame has been seen.
- CarState: tpmsPressure{FL,FR,RL,RR} (bar, -1 = none) and
  tpmsTemp{FL,FR,RL,RR} (degC, -100 = none) in 8 slots after the VIN
  (TPMS_OFFSET = 39, FIELD_COUNT = 47).
- Android: FIELD_COUNT = 47; CanFrameDecoder reads the TPMS slots.
- iOS: BridgeCarState and Swift CarState carry the fields. Dashboard JSON is
  unchanged.
- tesla_vin_mapper_test: the empty-VIN check stops at TPMS_OFFSET.

Mux-to-wheel mapping and scaling verified against four CAN logs
(2026-10-26..28): per-sensor pressures match mux 5 per wheel, and mux 5
updates follow per-sensor readings for the same wheel. Host tests pass and
the Android debug APK builds; iOS app not built.

Requires DashKit firmware that forwards 0x219 (dashkit-firmware
tpms-7byte-layout).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehoeve786
ehoeve786 marked this pull request as ready for review November 1, 2026 01:43
@ehoeve786
ehoeve786 requested a review from wpmed92 November 1, 2026 01:45
@wpmed92
wpmed92 merged commit bfcae89 into softwiredtech:main Nov 1, 2026
2 checks passed
@ehoeve786
ehoeve786 deleted the tpms-decoder branch November 1, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants