diff --git a/TODO b/TODO index 8a5f5ebd92f..bc8c0b069e0 100644 --- a/TODO +++ b/TODO @@ -7,5 +7,3 @@ Core improvements sub files with modified signal and so forth. - Optimize memory usage storing raw samples in a bitfield: 15 bits duration, 1 bit level. -- Implement checksum for all TPMS protocols. They have very weak - preamble/sync discrimination. diff --git a/proto.c b/data_feed.c similarity index 100% rename from proto.c rename to data_feed.c diff --git a/protocols/renault_tpms.c b/protocols/renault_tpms.c index 6c2cfb1e256..1f8ea0711b8 100644 --- a/protocols/renault_tpms.c +++ b/protocols/renault_tpms.c @@ -45,6 +45,7 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView FURI_LOG_E(TAG, "Renault TPMS decoded bits: %lu", decoded); if (decoded < 8*9) return false; /* Require the full 9 bytes. */ + if (crc8(raw,8,0,7) != raw[8]) return false; /* Require sane CRC. */ float kpa = 0.75 *((uint32_t)((raw[0]&3)<<8) | raw[1]); int temp = raw[2]-30; diff --git a/protocols/toyota_tpms.c b/protocols/toyota_tpms.c index c142769be33..b870c2f3329 100644 --- a/protocols/toyota_tpms.c +++ b/protocols/toyota_tpms.c @@ -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]); - uint8_t raw[8]; + uint8_t raw[9]; uint32_t decoded = convert_from_diff_manchester(raw,sizeof(raw),bits,numbytes,off,true); 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; int temp = ((raw[5]&0x7f)<<1 | raw[6]>>7) - 40;