Skip to content

Commit

Permalink
Check checksum in Schrader TPMS.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Jan 12, 2023
1 parent 715661c commit 86ca7ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions protocols/schrader_tpms.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView

if (decoded < 64) return false; /* Require the full 8 bytes. */

raw[0] |= 0xf0; // Fix the preamble nibble for checksum computation.
uint8_t cksum = crc8(raw,sizeof(raw)-1,0xf0,0x7);
if (cksum != raw[7]) {
FURI_LOG_E(TAG, "Schrader TPMS checksum mismatch");
return false;
}

float kpa = (float)raw[5]*2.5;
int temp = raw[6]-50;

Expand Down

0 comments on commit 86ca7ff

Please sign in to comment.