mirror of
https://github.com/merbanan/rtl_433.git
synced 2026-04-23 02:57:07 -04:00
Add false positive checks to Interlogix
This commit is contained in:
@@ -131,10 +131,26 @@ static int interlogix_callback(bitbuffer_t *bitbuffer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bitbuffer->bits_per_row[row] - bit_offset > INTERLOGIX_MSG_BIT_LEN + 7) {
|
||||
if (debug_output)
|
||||
fprintf(stderr, "Found valid preamble but message size (%d) too long, exiting! \n", bitbuffer->bits_per_row[row] - bit_offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t message[(INTERLOGIX_MSG_BIT_LEN + 7) / 8];
|
||||
|
||||
bitbuffer_extract_bytes(bitbuffer, row, bit_offset, message, INTERLOGIX_MSG_BIT_LEN);
|
||||
|
||||
// reduce false positives, abort if id or code looks wrong
|
||||
if (message[0] == 0x00 && message[1] == 0x00 && message[2] == 0x00)
|
||||
return 0;
|
||||
if (message[0] == 0xff && message[1] == 0xff && message[2] == 0xff)
|
||||
return 0;
|
||||
if (message[3] == 0x00 && message[4] == 0x00 && message[5] == 0x00)
|
||||
return 0;
|
||||
if (message[3] == 0xff && message[4] == 0xff && message[5] == 0xff)
|
||||
return 0;
|
||||
|
||||
// parity check: even data bits from message[0 .. 40] and odd data bits from message[1 .. 41]
|
||||
// i.e. 5 bytes and two (top-most) bits.
|
||||
int parity = message[0] ^ message[1] ^ message[2] ^ message[3] ^ message[4]; // parity as byte
|
||||
|
||||
Reference in New Issue
Block a user