|
@@ -50,12 +50,13 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView
|
|
|
|
|
|
|
|
FURI_LOG_E(TAG, "Toyota TPMS sync[%s] found", sync[j]);
|
|
FURI_LOG_E(TAG, "Toyota TPMS sync[%s] found", sync[j]);
|
|
|
|
|
|
|
|
- uint8_t raw[8];
|
|
|
|
|
|
|
+ uint8_t raw[9];
|
|
|
uint32_t decoded =
|
|
uint32_t decoded =
|
|
|
convert_from_diff_manchester(raw,sizeof(raw),bits,numbytes,off,true);
|
|
convert_from_diff_manchester(raw,sizeof(raw),bits,numbytes,off,true);
|
|
|
FURI_LOG_E(TAG, "Toyota TPMS decoded bits: %lu", decoded);
|
|
FURI_LOG_E(TAG, "Toyota TPMS decoded bits: %lu", decoded);
|
|
|
|
|
|
|
|
- if (decoded < 64) return false; /* Require the full 8 bytes. */
|
|
|
|
|
|
|
+ if (decoded < 8*9) return false; /* Require the full 8 bytes. */
|
|
|
|
|
+ if (crc8(raw,8,0x80,7) != raw[8]) return false; /* Require sane CRC. */
|
|
|
|
|
|
|
|
float kpa = (float)((raw[4]&0x7f)<<1 | raw[5]>>7) * 0.25 - 7;
|
|
float kpa = (float)((raw[4]&0x7f)<<1 | raw[5]>>7) * 0.25 - 7;
|
|
|
int temp = ((raw[5]&0x7f)<<1 | raw[6]>>7) - 40;
|
|
int temp = ((raw[5]&0x7f)<<1 | raw[6]>>7) - 40;
|