From 21e8bed52b0925f6617435d350e69f5b70a0ddc0 Mon Sep 17 00:00:00 2001 From: Pascal Langer Date: Tue, 19 Jan 2021 12:15:23 +0100 Subject: [PATCH] E016HV2: fixed a left over from protocol reverse engineering --- Multiprotocol/E016HV2_cc2500.ino | 24 +++++++++--------------- Multiprotocol/NRF250K_EMU.ino | 1 + Protocols_Details.md | 4 +--- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Multiprotocol/E016HV2_cc2500.ino b/Multiprotocol/E016HV2_cc2500.ino index ea29319..f4ef862 100644 --- a/Multiprotocol/E016HV2_cc2500.ino +++ b/Multiprotocol/E016HV2_cc2500.ino @@ -27,10 +27,13 @@ Multiprotocol is distributed in the hope that it will be useful, static void __attribute__((unused)) E016HV2_send_packet() { - //payload length (after this byte)?? + if(option==0) + option=1; // Select the CC2500 + + //payload length (after this byte) packet[0 ] = 0x0A; - //bind indicator?? + //bind indicator if(IS_BIND_IN_PROGRESS) { packet[1 ] = 0x02; @@ -39,18 +42,11 @@ static void __attribute__((unused)) E016HV2_send_packet() else { BIND_DONE; - XN297L_RFChannel(rf_ch_num); // Set main channel + XN297L_RFChannel(rf_ch_num); // Set main channel } } else - { packet[1 ] = 0x20; - if(prev_option!=option) - { - XN297L_RFChannel(option); // Set main channel - prev_option=option; - } - } //ID packet[2 ] = rx_tx_addr[2]; @@ -85,8 +81,6 @@ static void __attribute__((unused)) E016HV2_send_packet() packet[10] = GET_FLAG(CH5_SW, 0x01) // 0x01=TakeOff/Land (momentary switch) | GET_FLAG(CH6_SW, 0x04); // 0x04=Emergeny Stop (momentary switch) - if(option==0) - option=1; // Select the CC2500 XN297L_SetPower(); // Set tx_power XN297L_SetFreqOffset(); // Set frequency offset @@ -109,11 +103,11 @@ static void __attribute__((unused)) E016HV2_send_packet() pid++; // payload - debug("P:") + //debug("P:") for (uint8_t i = 0; i < E016HV2_PAYLOAD_SIZE; ++i) { uint8_t byte = (bit_reverse(packet[i])<<1) | (packet[i+1]&0x01); - debug(" %02X",byte) + //debug(" %02X",byte) CC2500_WriteReg(CC2500_3F_TXFIFO,byte); crc16_update(byte, 8); } @@ -121,7 +115,7 @@ static void __attribute__((unused)) E016HV2_send_packet() // crc CC2500_WriteReg(CC2500_3F_TXFIFO,crc >> 8); CC2500_WriteReg(CC2500_3F_TXFIFO,crc); - debugln(" %04X",crc) + //debugln(" %04X",crc) // transmit CC2500_Strobe(CC2500_STX); diff --git a/Multiprotocol/NRF250K_EMU.ino b/Multiprotocol/NRF250K_EMU.ino index 03d30db..26028e0 100644 --- a/Multiprotocol/NRF250K_EMU.ino +++ b/Multiprotocol/NRF250K_EMU.ino @@ -17,6 +17,7 @@ static void __attribute__((unused)) XN297L_Init() { + prev_option = option; #ifdef CC2500_INSTALLED if(option==0) #endif diff --git a/Protocols_Details.md b/Protocols_Details.md index 96cc409..795f319 100644 --- a/Protocols_Details.md +++ b/Protocols_Details.md @@ -391,13 +391,11 @@ Models: E016H v2 Option for this protocol corresponds to fine frequency tuning. This value is different for each Module and **must** be accurate otherwise the link will not be stable or bind won't even work. Check the [Frequency Tuning page](/docs/Frequency_Tuning.md) to determine it. -**Again make sure to set the RF frequency right to be able to bind**. FYI, on my module I needed +80. - CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10 ---|---|---|---|---|---|---|---|---|---- A|E|T|R|TAKE_OFF/LANDING|EMERGENCY|FLIP|CALIB|HEADLESS|RTH -TAKE_OFF/LANDING: this is a momentary switch to arm the motors or land the quad. This switch is not really needed as you can start the quad with throttle low then increase throttle until the motor arms and continue to increase to lift off; To land just bring throttle all the way down, the quad will just stops when touching the ground. +TAKE_OFF/LANDING: this is a momentary switch to arm the motors or land the quad. This switch is not really needed as you can start the quad with throttle low then increase throttle until the motor arms, move throttle to mid-stick and then increase it quickly to lift off; To land just bring throttle all the way down, the quad will just stops when touching the ground. EMERGENCY: Can be used along with the throttle cut switch: Throttle cut=set throttle at -100% and set EMERGENCY to 100%