From dc1da3389a81114544682bca1b777cf6873aca1d Mon Sep 17 00:00:00 2001 From: pazzernick Date: Thu, 21 Nov 2024 13:20:13 +0000 Subject: [PATCH 1/7] Add Quinetic Switches and Sensors --- README.md | 1 + conf/quinetic_switch.conf | 29 ++++++++ conf/rtl_433.example.conf | 1 + include/rtl_433_devices.h | 1 + src/CMakeLists.txt | 1 + src/devices/quinetic.c | 137 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 170 insertions(+) create mode 100644 conf/quinetic_switch.conf create mode 100644 src/devices/quinetic.c diff --git a/README.md b/README.md index 915ebb257..f133168d4 100644 --- a/README.md +++ b/README.md @@ -353,6 +353,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md). [265] Rosstech Digital Control Unit DCU-706/Sundance/Jacuzzi [266] Risco 2 Way Agility protocol, Risco PIR/PET Sensor RWX95P [267] ThermoPro Meat Thermometers, TP828B 2 probes with Temp, BBQ Target LO and HI + [268] Quinetic Switches and Sensors * Disabled by default, use -R n or a conf file to enable diff --git a/conf/quinetic_switch.conf b/conf/quinetic_switch.conf new file mode 100644 index 000000000..6788e13be --- /dev/null +++ b/conf/quinetic_switch.conf @@ -0,0 +1,29 @@ +# +# Quinetic Switches and Sensors +# +# Basic Usage: +# rtl_433 /etc/rtl_433/quinetic_switch.conf +# +# Recommended approach: +# Copy this file to a new location then customise it (e.g. custom output like MQTT). +# See 'rtl_433.example.conf' for configuration options. +# +# Quinetic Tuning: +# For accurate capture of Quinetic RF packets, use sample_rate of 1024k or higher. +# Device center frequency: 433.3Mhz +/-50Khz +# + +# FREQ TUNING +frequency 433.4M +sample_rate 1024k +pulse_detect minmax + +# ADAPTER TUNING (RTL Chip) +gain 37 + +# SELECTION OF PROTOCOL(S) (268=QUINETIC) +protocol 268 + +# DEBUG +#report_meta level +#report_meta noise diff --git a/conf/rtl_433.example.conf b/conf/rtl_433.example.conf index 115d59c5a..99b0fd09f 100644 --- a/conf/rtl_433.example.conf +++ b/conf/rtl_433.example.conf @@ -494,6 +494,7 @@ convert si protocol 265 # Rosstech Digital Control Unit DCU-706/Sundance/Jacuzzi protocol 266 # Risco 2 Way Agility protocol, Risco PIR/PET Sensor RWX95P protocol 267 # ThermoPro Meat Thermometers, TP828B 2 probes with Temp, BBQ Target LO and HI + protocol 268 # Quinetic Switches and Sensors ## Flex devices (command line option "-X") diff --git a/include/rtl_433_devices.h b/include/rtl_433_devices.h index 875719fb3..bc175f6ab 100644 --- a/include/rtl_433_devices.h +++ b/include/rtl_433_devices.h @@ -275,6 +275,7 @@ DECL(rosstech_dcu706) \ DECL(risco_agility) \ DECL(thermopro_tp828b) \ + DECL(quinetic) \ /* Add new decoders here. */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2d15403e2..f7a03227e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -198,6 +198,7 @@ add_library(r_433 STATIC devices/prologue.c devices/proove.c devices/quhwa.c + devices/quinetic.c devices/radiohead_ask.c devices/rainpoint.c devices/regency_fan.c diff --git a/src/devices/quinetic.c b/src/devices/quinetic.c new file mode 100644 index 000000000..7698c49d2 --- /dev/null +++ b/src/devices/quinetic.c @@ -0,0 +1,137 @@ +/** @file + Quinetic Switches and Sensors + + Copyright (C) 2024 Nick Parrott + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +*/ + +/** +################################ +Frame Layout + +...PPPP SS IISCC + +P: 48-bits+ of Preamble +S: 16-bits of Sync-Word (0xA4, 0x23) +I: 16-bits of Device ID +S: 8-bits of Device Action +C: 16-bits of In-Packet Checksum (CRC-16 AUG-CCITT) + +################################ +CRC Checksum Method + + In-Packet Checksum: CC + 24-bits of data to CRC-check: IIS + +################################ +Signal Summary + +Frequency: 433.3 Mhz, +/- 50Khz +Nominal pulse width: 10us +Modulation: FSK_PCM +Checksum: CRC-16/AUG-CCITT + +################################ +Device Characteristics + +A switch emits 3-4 pulses when button is pressed. +A switch emits 3-4 pulses when button is released. +This duplication of packets is expected. + +Device ID is preserved as 16-bit Hex. +It is printed on device rear-label (some models). +*/ + +#include "decoder.h" + +static int quinetic_switch_decode(r_device *decoder, bitbuffer_t *bitbuffer) +{ + + if (bitbuffer->bits_per_row[0] < 110 || bitbuffer->bits_per_row[0] > 140) { + return DECODE_ABORT_LENGTH; + } + + const uint8_t packet_syncword[] = {0xA4, 0x23}; + unsigned syncword_bitindex; + + syncword_bitindex = bitbuffer_search(bitbuffer, 0, 0, packet_syncword, 16); + if (syncword_bitindex >= bitbuffer->bits_per_row[0]) { + decoder_logf(decoder, 1, __func__, "Sync-Word not found"); + return DECODE_ABORT_EARLY; + } + + // DEBUG + // decoder_logf(decoder, 1, __func__, "Sync-Word Index: %d", syncword_bitindex); + // decoder_logf(decoder, 1, __func__, "Bits in Row: %d", bitbuffer->bits_per_row[0]); + + uint8_t payload[5]; + bitbuffer_extract_bytes(bitbuffer, 0, syncword_bitindex + 16, payload, sizeof(payload) * 8); + + char checksum_data_str[24]; + snprintf(checksum_data_str, sizeof(checksum_data_str), "%02x%02x%02x", payload[0], payload[1], payload[2]); + + char checksum_str[16]; + snprintf(checksum_str, sizeof(checksum_str), "%02x%02x", payload[3], payload[4]); + + uint16_t crc; + uint8_t checksum_data[] = {payload[0], payload[1], payload[2]}; + crc = crc16(checksum_data, 3, 0x1021, 0x1D0F); + + char checksum_crc[16]; + snprintf(checksum_crc, sizeof(checksum_crc), "%x", crc); + if ( strcmp(checksum_crc, checksum_str) != 0 ) { + decoder_logf(decoder, 1, __func__, "Checksum failed. Expected: %s, Calculated: %s.", checksum_str, checksum_crc); + return DECODE_FAIL_MIC; + } + + char id_hex[16]; + snprintf(id_hex, sizeof(id_hex), "%02X%02X", payload[0], payload[1]); + // uint16_t id_int = (payload[0] << 8 | payload[1]); + + char action_str[] = "release"; + if ((payload[2] >> 7) == 0) { + strcpy(action_str, "press"); + } + + /* clang-format off */ + data_t *data = data_make( + "model", "Model", DATA_STRING, "Quinetic", + "id", "ID", DATA_STRING, id_hex, + "action", "Action", DATA_STRING, action_str, + "action_int", "Action Integer", DATA_INT, payload[2], + "checksum", "In-Pkt Checksum", DATA_STRING, checksum_str, + "checksumdata", "Checksum Data", DATA_STRING, checksum_data_str, + "mic", "Integrity", DATA_STRING, "CRC", + NULL); + /* clang-format on */ + + decoder_output_data(decoder, data); + return 1; +} + +static char const *const output_fields[] = { + "model", + "id", + "action", + "action_int", + "checksum", + "checksumdata", + "mic", + NULL, +}; + +r_device const quinetic = { + .name = "Quinetic", + .modulation = FSK_PULSE_PCM, + .short_width = 10, + .long_width = 10, + .reset_limit = 120, + .tolerance = 1, + .decode_fn = &quinetic_switch_decode, + .fields = output_fields, + .disabled = 1, // disabled by default, due to required settings: frequency 433.4, sample_rate 1024k +}; From 4b004a674e4b4fffde1c03c4251d85a452c70861 Mon Sep 17 00:00:00 2001 From: pazzernick Date: Thu, 21 Nov 2024 13:22:08 +0000 Subject: [PATCH 2/7] Update README.md for Quinetic Switches and Sensors --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f133168d4..1c88741d4 100644 --- a/README.md +++ b/README.md @@ -353,7 +353,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md). [265] Rosstech Digital Control Unit DCU-706/Sundance/Jacuzzi [266] Risco 2 Way Agility protocol, Risco PIR/PET Sensor RWX95P [267] ThermoPro Meat Thermometers, TP828B 2 probes with Temp, BBQ Target LO and HI - [268] Quinetic Switches and Sensors + [268]* Quinetic Switches and Sensors * Disabled by default, use -R n or a conf file to enable From a6562e12ba0e2819798cb032a8df5a7c4ccba20d Mon Sep 17 00:00:00 2001 From: pazzernick Date: Thu, 21 Nov 2024 15:18:23 +0000 Subject: [PATCH 3/7] Fixing comments and optimising Quinetic Switches and Sensors --- conf/rtl_433.example.conf | 2 +- src/devices/quinetic.c | 94 ++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 51 deletions(-) diff --git a/conf/rtl_433.example.conf b/conf/rtl_433.example.conf index 99b0fd09f..0b50637b5 100644 --- a/conf/rtl_433.example.conf +++ b/conf/rtl_433.example.conf @@ -494,7 +494,7 @@ convert si protocol 265 # Rosstech Digital Control Unit DCU-706/Sundance/Jacuzzi protocol 266 # Risco 2 Way Agility protocol, Risco PIR/PET Sensor RWX95P protocol 267 # ThermoPro Meat Thermometers, TP828B 2 probes with Temp, BBQ Target LO and HI - protocol 268 # Quinetic Switches and Sensors +# protocol 268 # Quinetic Switches and Sensors ## Flex devices (command line option "-X") diff --git a/src/devices/quinetic.c b/src/devices/quinetic.c index 7698c49d2..622db862a 100644 --- a/src/devices/quinetic.c +++ b/src/devices/quinetic.c @@ -1,5 +1,5 @@ /** @file - Quinetic Switches and Sensors + Quinetic Switches and Sensors. Copyright (C) 2024 Nick Parrott @@ -10,40 +10,37 @@ */ /** -################################ -Frame Layout +Quinetic Switches and Sensors. -...PPPP SS IISCC +## Frame Layout -P: 48-bits+ of Preamble -S: 16-bits of Sync-Word (0xA4, 0x23) -I: 16-bits of Device ID -S: 8-bits of Device Action -C: 16-bits of In-Packet Checksum (CRC-16 AUG-CCITT) + ...PPPP SS IISCC -################################ -CRC Checksum Method +- P: 48-bits+ of Preamble +- S: 16-bits of Sync-Word (0xA4, 0x23) +- I: 16-bits of Device ID +- S: 8-bits of Device Action +- C: 16-bits of In-Packet Checksum (CRC-16 AUG-CCITT) - In-Packet Checksum: CC - 24-bits of data to CRC-check: IIS +## CRC Checksum Method -################################ -Signal Summary +- In-Packet Checksum: CC +- 24-bits of data to CRC-check: IIS -Frequency: 433.3 Mhz, +/- 50Khz -Nominal pulse width: 10us -Modulation: FSK_PCM -Checksum: CRC-16/AUG-CCITT +## Signal Summary -################################ -Device Characteristics +- Frequency: 433.3 Mhz, +/- 50Khz +- Nominal pulse width: 10us +- Modulation: FSK_PCM +- Checksum: CRC-16/AUG-CCITT -A switch emits 3-4 pulses when button is pressed. -A switch emits 3-4 pulses when button is released. -This duplication of packets is expected. +## Device Characteristics -Device ID is preserved as 16-bit Hex. -It is printed on device rear-label (some models). +- A switch emits 3-4 pulses when button is pressed. +- A switch emits 3-4 pulses when button is released. +- This duplication of packets is expected. +- Device ID is preserved as 16-bit Hex. +- It is printed on device rear-label (some models). */ #include "decoder.h" @@ -68,44 +65,43 @@ static int quinetic_switch_decode(r_device *decoder, bitbuffer_t *bitbuffer) // decoder_logf(decoder, 1, __func__, "Sync-Word Index: %d", syncword_bitindex); // decoder_logf(decoder, 1, __func__, "Bits in Row: %d", bitbuffer->bits_per_row[0]); - uint8_t payload[5]; - bitbuffer_extract_bytes(bitbuffer, 0, syncword_bitindex + 16, payload, sizeof(payload) * 8); + uint8_t b[5]; + bitbuffer_extract_bytes(bitbuffer, 0, syncword_bitindex + 16, b, sizeof(b) * 8); char checksum_data_str[24]; - snprintf(checksum_data_str, sizeof(checksum_data_str), "%02x%02x%02x", payload[0], payload[1], payload[2]); + snprintf(checksum_data_str, sizeof(checksum_data_str), "%02x%02x%02x", b[0], b[1], b[2]); char checksum_str[16]; - snprintf(checksum_str, sizeof(checksum_str), "%02x%02x", payload[3], payload[4]); + snprintf(checksum_str, sizeof(checksum_str), "%02x%02x", b[3], b[4]); uint16_t crc; - uint8_t checksum_data[] = {payload[0], payload[1], payload[2]}; + uint8_t checksum_data[] = {b[0], b[1], b[2]}; crc = crc16(checksum_data, 3, 0x1021, 0x1D0F); char checksum_crc[16]; snprintf(checksum_crc, sizeof(checksum_crc), "%x", crc); - if ( strcmp(checksum_crc, checksum_str) != 0 ) { + if (strcmp(checksum_crc, checksum_str) != 0) { decoder_logf(decoder, 1, __func__, "Checksum failed. Expected: %s, Calculated: %s.", checksum_str, checksum_crc); return DECODE_FAIL_MIC; } - char id_hex[16]; - snprintf(id_hex, sizeof(id_hex), "%02X%02X", payload[0], payload[1]); - // uint16_t id_int = (payload[0] << 8 | payload[1]); - - char action_str[] = "release"; - if ((payload[2] >> 7) == 0) { - strcpy(action_str, "press"); + int id = (b[0] << 8 | b[1]); + + // handle button_code value + // 128=release, 1=press B1, 2=press B2, 3=press B3, 4=press B4 + int button_code = b[2]; + char *button_action = "release"; + if (button_code < 192) { + button_action = "press"; } /* clang-format off */ data_t *data = data_make( - "model", "Model", DATA_STRING, "Quinetic", - "id", "ID", DATA_STRING, id_hex, - "action", "Action", DATA_STRING, action_str, - "action_int", "Action Integer", DATA_INT, payload[2], - "checksum", "In-Pkt Checksum", DATA_STRING, checksum_str, - "checksumdata", "Checksum Data", DATA_STRING, checksum_data_str, - "mic", "Integrity", DATA_STRING, "CRC", + "model", "Model", DATA_STRING, "Quinetic", + "id", "ID", DATA_FORMAT, "%04x", DATA_INT, id, + "button_action", "Button Action", DATA_STRING, button_action, + "button_code", "Button Code", DATA_INT, button_code, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ @@ -116,10 +112,8 @@ static int quinetic_switch_decode(r_device *decoder, bitbuffer_t *bitbuffer) static char const *const output_fields[] = { "model", "id", - "action", - "action_int", - "checksum", - "checksumdata", + "button_action", + "button_code", "mic", NULL, }; From 998a204da10e615797eee9f779137ac6429f91d2 Mon Sep 17 00:00:00 2001 From: pazzernick Date: Thu, 21 Nov 2024 15:23:07 +0000 Subject: [PATCH 4/7] Update README and man-page for Quinetic Switches and Sensors --- README.md | 4 ++-- conf/rtl_433.example.conf | 2 +- man/man1/rtl_433.1 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c88741d4..2c5a0b6a2 100644 --- a/README.md +++ b/README.md @@ -353,7 +353,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md). [265] Rosstech Digital Control Unit DCU-706/Sundance/Jacuzzi [266] Risco 2 Way Agility protocol, Risco PIR/PET Sensor RWX95P [267] ThermoPro Meat Thermometers, TP828B 2 probes with Temp, BBQ Target LO and HI - [268]* Quinetic Switches and Sensors + [268]* Quinetic * Disabled by default, use -R n or a conf file to enable @@ -363,7 +363,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md). [-d ] (default: 0) [-d :] To set gain for RTL-SDR use -g to set an overall gain in dB. - SoapySDR device driver is available. + SoapySDR device driver is not available. [-d ""] Open default SoapySDR device [-d driver=rtlsdr] Open e.g. specific SoapySDR device To set gain for SoapySDR use -g ELEM=val,ELEM=val,... e.g. -g LNA=20,TIA=8,PGA=2 (for LimeSDR). diff --git a/conf/rtl_433.example.conf b/conf/rtl_433.example.conf index 0b50637b5..a5a059e6c 100644 --- a/conf/rtl_433.example.conf +++ b/conf/rtl_433.example.conf @@ -494,7 +494,7 @@ convert si protocol 265 # Rosstech Digital Control Unit DCU-706/Sundance/Jacuzzi protocol 266 # Risco 2 Way Agility protocol, Risco PIR/PET Sensor RWX95P protocol 267 # ThermoPro Meat Thermometers, TP828B 2 probes with Temp, BBQ Target LO and HI -# protocol 268 # Quinetic Switches and Sensors +# protocol 268 # Quinetic ## Flex devices (command line option "-X") diff --git a/man/man1/rtl_433.1 b/man/man1/rtl_433.1 index 2636143a8..ddf53eaeb 100644 --- a/man/man1/rtl_433.1 +++ b/man/man1/rtl_433.1 @@ -168,7 +168,7 @@ RTL\-SDR device driver is available. To set gain for RTL\-SDR use \-g to set an overall gain in dB. .RE .RS -SoapySDR device driver is available. +SoapySDR device driver is not available. .RE .TP [ \fB\-d\fI ""\fP ] From f724b12a919c4f9a9ef63a36c4b69937aef9f0ce Mon Sep 17 00:00:00 2001 From: pazzernick Date: Thu, 21 Nov 2024 15:42:04 +0000 Subject: [PATCH 5/7] Reverting README and man page with correct 'SoapySDR' after Quinetic updates --- README.md | 2 +- man/man1/rtl_433.1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c5a0b6a2..390df2bcf 100644 --- a/README.md +++ b/README.md @@ -363,7 +363,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md). [-d ] (default: 0) [-d :] To set gain for RTL-SDR use -g to set an overall gain in dB. - SoapySDR device driver is not available. + SoapySDR device driver is available. [-d ""] Open default SoapySDR device [-d driver=rtlsdr] Open e.g. specific SoapySDR device To set gain for SoapySDR use -g ELEM=val,ELEM=val,... e.g. -g LNA=20,TIA=8,PGA=2 (for LimeSDR). diff --git a/man/man1/rtl_433.1 b/man/man1/rtl_433.1 index ddf53eaeb..2636143a8 100644 --- a/man/man1/rtl_433.1 +++ b/man/man1/rtl_433.1 @@ -168,7 +168,7 @@ RTL\-SDR device driver is available. To set gain for RTL\-SDR use \-g to set an overall gain in dB. .RE .RS -SoapySDR device driver is not available. +SoapySDR device driver is available. .RE .TP [ \fB\-d\fI ""\fP ] From 5ba9c02d0031bb7236da8d065456ad7b2bf28a4a Mon Sep 17 00:00:00 2001 From: pazzernick Date: Thu, 21 Nov 2024 22:57:17 +0000 Subject: [PATCH 6/7] CRC simplification, channel data value for stable button isolation in Quinetic --- src/devices/quinetic.c | 51 +++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/devices/quinetic.c b/src/devices/quinetic.c index 622db862a..dc62bcf89 100644 --- a/src/devices/quinetic.c +++ b/src/devices/quinetic.c @@ -61,46 +61,38 @@ static int quinetic_switch_decode(r_device *decoder, bitbuffer_t *bitbuffer) return DECODE_ABORT_EARLY; } - // DEBUG - // decoder_logf(decoder, 1, __func__, "Sync-Word Index: %d", syncword_bitindex); - // decoder_logf(decoder, 1, __func__, "Bits in Row: %d", bitbuffer->bits_per_row[0]); - uint8_t b[5]; bitbuffer_extract_bytes(bitbuffer, 0, syncword_bitindex + 16, b, sizeof(b) * 8); - char checksum_data_str[24]; - snprintf(checksum_data_str, sizeof(checksum_data_str), "%02x%02x%02x", b[0], b[1], b[2]); - - char checksum_str[16]; - snprintf(checksum_str, sizeof(checksum_str), "%02x%02x", b[3], b[4]); - - uint16_t crc; - uint8_t checksum_data[] = {b[0], b[1], b[2]}; - crc = crc16(checksum_data, 3, 0x1021, 0x1D0F); - - char checksum_crc[16]; - snprintf(checksum_crc, sizeof(checksum_crc), "%x", crc); - if (strcmp(checksum_crc, checksum_str) != 0) { - decoder_logf(decoder, 1, __func__, "Checksum failed. Expected: %s, Calculated: %s.", checksum_str, checksum_crc); + int crc = crc16(b, 5, 0x1021, 0x1D0F); + if (crc != 0) { + decoder_logf(decoder, 1, __func__, "CRC failure"); return DECODE_FAIL_MIC; } - int id = (b[0] << 8 | b[1]); - - // handle button_code value - // 128=release, 1=press B1, 2=press B2, 3=press B3, 4=press B4 - int button_code = b[2]; - char *button_action = "release"; - if (button_code < 192) { - button_action = "press"; + // Process Switch-Channel (Button) nibble: b[2] + // + // Determine button number in switch (B1/B2/B3) when pressed. + // Typical Int Values: + // + // 192 = generic release + // 01 = press ( B1 ) + // 02 = press ( B2 ) + // 03 = press ( B3 ) + int switch_channel = b[2]; + if (switch_channel == 192) { + // Ignore "button release": button number unknown. + return DECODE_ABORT_EARLY; } + // Process Switch-ID nibbles: b[0] and b[1] + int id = (b[0] << 8) | (b[1]); + /* clang-format off */ data_t *data = data_make( "model", "Model", DATA_STRING, "Quinetic", "id", "ID", DATA_FORMAT, "%04x", DATA_INT, id, - "button_action", "Button Action", DATA_STRING, button_action, - "button_code", "Button Code", DATA_INT, button_code, + "channel", "Channel", DATA_INT, switch_channel, "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ @@ -112,8 +104,7 @@ static int quinetic_switch_decode(r_device *decoder, bitbuffer_t *bitbuffer) static char const *const output_fields[] = { "model", "id", - "button_action", - "button_code", + "channnel", "mic", NULL, }; From 2f05038f0d0bb7d73355f974c0423953922ce407 Mon Sep 17 00:00:00 2001 From: pazzernick Date: Thu, 21 Nov 2024 23:42:28 +0000 Subject: [PATCH 7/7] fixing trailing linespace in quinetic.c --- src/devices/quinetic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/quinetic.c b/src/devices/quinetic.c index dc62bcf89..e8b705882 100644 --- a/src/devices/quinetic.c +++ b/src/devices/quinetic.c @@ -63,7 +63,7 @@ static int quinetic_switch_decode(r_device *decoder, bitbuffer_t *bitbuffer) uint8_t b[5]; bitbuffer_extract_bytes(bitbuffer, 0, syncword_bitindex + 16, b, sizeof(b) * 8); - + int crc = crc16(b, 5, 0x1021, 0x1D0F); if (crc != 0) { decoder_logf(decoder, 1, __func__, "CRC failure");