From 4e906757b9998ba5523597bd0f548b8fccc8caaf Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Sat, 24 Aug 2019 22:39:27 +0200 Subject: [PATCH] XN297Dump fix enhanced unscramble mode --- Multiprotocol/Multiprotocol.h | 2 +- Multiprotocol/XN297Dump_nrf24l01.ino | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index 14d65ca..3305fa7 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -19,7 +19,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_REVISION 1 -#define VERSION_PATCH_LEVEL 73 +#define VERSION_PATCH_LEVEL 74 //****************** // Protocols diff --git a/Multiprotocol/XN297Dump_nrf24l01.ino b/Multiprotocol/XN297Dump_nrf24l01.ino index 4032bd7..2ff6033 100644 --- a/Multiprotocol/XN297Dump_nrf24l01.ino +++ b/Multiprotocol/XN297Dump_nrf24l01.ino @@ -124,23 +124,24 @@ static boolean __attribute__((unused)) XN297Dump_process_packet(void) crc_enh = crc16_update(crc, packet[i+1] & 0xC0, 2); crcxored=(packet[i+1]<<10)|(packet[i+2]<<2)|(packet[i+3]>>6) ; if((crc_enh ^ pgm_read_word(&xn297_crc_xorout_scrambled_enhanced[i - 3])) == crcxored) - { + { // Found a valid CRC for the enhanced payload mode packet_length=i; + scramble=true; i++; packet_sc[i]=packet[i]^xn297_scramble[i]; memcpy(packet_un,packet_sc,packet_length+2); // unscramble packet - scramble=true; break; } if((crc_enh ^ pgm_read_word(&xn297_crc_xorout_enhanced[i - 3])) == crcxored) - { - scramble=false; + { // Found a valid CRC for the enhanced payload mode packet_length=i; + scramble=false; + memcpy(packet_un,packet,packet_length+2); // packet is unscrambled break; } } if(packet_length!=0) - { + { // Found a valid CRC for the enhanced payload mode debug("Enhanced "); //check selected address length if((packet_un[address_length]>>1)!=packet_length-address_length)