From bf091779167849d2b12c2b375f94df47b3f4da2a Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Mon, 6 Aug 2018 18:32:39 +0200 Subject: [PATCH] Hitec improvement Added 3rd byte of TX ID Reproduce the F5 frames from original TX --- Multiprotocol/Hitec_cc2500.ino | 41 +++++++++++++++++++--------------- Multiprotocol/Multiprotocol.h | 2 +- Multiprotocol/_Config.h | 3 +-- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Multiprotocol/Hitec_cc2500.ino b/Multiprotocol/Hitec_cc2500.ino index 1a6484e..ee802fc 100644 --- a/Multiprotocol/Hitec_cc2500.ino +++ b/Multiprotocol/Hitec_cc2500.ino @@ -120,12 +120,13 @@ static void __attribute__((unused)) HITEC_change_chan_fast() static void __attribute__((unused)) HITEC_build_packet() { - static boolean F5_packet=false; + static boolean F5_frame=false; + static uint8_t F5_counter=0; uint8_t offset; - packet[1] = 0x00; // unknown always 0x00 in the dumps. TODO: test if part of ID. - packet[2] = rx_tx_addr[3]; - packet[3] = rx_tx_addr[2]; + packet[1] = rx_tx_addr[1]; + packet[2] = rx_tx_addr[2]; + packet[3] = rx_tx_addr[3]; packet[22] = 0xEE; // unknown always 0xEE if(IS_BIND_IN_PROGRESS) { @@ -173,20 +174,23 @@ static void __attribute__((unused)) HITEC_build_packet() packet[26] = 0x00; // unknown always 0 and the RX doesn't seem to care about the value? } - //packet[offset] starts with 0x00 and after some time alternate between 0x00 and 0xF5 - //packet[offset+1] equals to 0x00 if [offset]=0x00 but if [offset]=0xF5 then the values are between 0xDB and 0xE0 - //TODO: test if it could be RSSI, time, ... related? - if(F5_packet) - { - packet[offset] = 0xF5; - packet[offset+1] = 0xE0; //value in the dumps between 0xDB and 0xE0 - F5_packet=false; + if(F5_frame) + {// No idea what it is but Minima RXs are expecting these frames to work to work + packet[offset] = 0xF5; + packet[offset+1] = 0xDF; + if((F5_counter%9)==0) + packet[offset+1] -= 0x04; // every 8 packets send 0xDB + F5_counter++; + F5_counter%=59; // every 6 0xDB packets wait only 4 to resend instead of 8 + F5_frame=false; // alternate + if(IS_BIND_IN_PROGRESS) + packet[offset+1]++; // when binding the values are 0xE0 and 0xDC } else { packet[offset] = 0x00; packet[offset+1] = 0x00; - F5_packet=true; + F5_frame=true; // alternate } /* debug("P:"); for(uint8_t i=0;i