diff --git a/Multiprotocol/FrSkyD_cc2500.ino b/Multiprotocol/FrSkyD_cc2500.ino index 4bd5e75..9ecfd9d 100644 --- a/Multiprotocol/FrSkyD_cc2500.ino +++ b/Multiprotocol/FrSkyD_cc2500.ino @@ -181,7 +181,7 @@ uint16_t ReadFrSky_2way() if(packet_in[len-1] & 0x80) {//with valid crc packet_count=0; - frsky_check_telemetry(packet_in,len); //check if valid telemetry packets and buffer them. + frsky_process_telemetry(packet_in,len); //check if valid telemetry packets and buffer them. } #endif } diff --git a/Multiprotocol/FrSkyR9_sx1276.ino b/Multiprotocol/FrSkyR9_sx1276.ino index d6ab9ce..864b604 100644 --- a/Multiprotocol/FrSkyR9_sx1276.ino +++ b/Multiprotocol/FrSkyR9_sx1276.ino @@ -192,7 +192,7 @@ uint16_t FrSkyR9_callback() TX_RSSI=SX1276_ReadReg(SX1276_1A_PACKETRSSI)-157; for(uint8_t i=0;i<9;i++) packet[4+i]=packet_in[i]; //Adjust buffer to match FrSkyX - frsky_check_telemetry(packet,len); //Check and parse telemetry packets + frsky_process_telemetry(packet,len); //Check and parse telemetry packets } } } diff --git a/Multiprotocol/FrSkyX_cc2500.ino b/Multiprotocol/FrSkyX_cc2500.ino index 4e13ff5..6975c94 100644 --- a/Multiprotocol/FrSkyX_cc2500.ino +++ b/Multiprotocol/FrSkyX_cc2500.ino @@ -280,15 +280,15 @@ uint16_t ReadFrSkyX() if (len && len <= 17) //Telemetry frame is 17 bytes { //debug("Telem:"); - packet_count=0; CC2500_ReadData(packet_in, len); //Read what has been received so far if(len<17) {//not all bytes were received uint8_t last_len=CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F; if(last_len==17) //All bytes received + { CC2500_ReadData(packet_in+len, last_len-len); //Finish to read - else - len=0; //Discard frame + len=17; + } } #if defined TELEMETRY if(len==17 && (protocol==PROTO_FRSKYX || (protocol==PROTO_FRSKYX2 && (packet_in[len-1] & 0x80))) ) @@ -296,7 +296,10 @@ uint16_t ReadFrSkyX() //Debug //for(uint8_t i=0;i=128) @@ -417,7 +417,7 @@ void frsky_check_telemetry(uint8_t *buffer,uint8_t len) //len=17 -> len-7=10 -> 3..12 uint16_t lcrc = FrSkyX_crc(&buffer[3], len-7 ) ; if ( ( (lcrc >> 8) != buffer[len-4]) || ( (lcrc & 0x00FF ) != buffer[len-3]) ) - return; // Bad CRC + return false; // Bad CRC if(buffer[4] & 0x80) RX_RSSI=buffer[4] & 0x7F ; @@ -425,7 +425,7 @@ void frsky_check_telemetry(uint8_t *buffer,uint8_t len) v_lipo1 = (buffer[4]<<1) + 1 ; #if defined(TELEMETRY_FRSKYX_TO_FRSKYD) && defined(ENABLE_PPM) if(mode_select != MODE_SERIAL) - return; + return true; #endif } if (protocol==PROTO_FRSKYX||protocol==PROTO_FRSKYX2||protocol==PROTO_FRSKY_R9) @@ -503,6 +503,7 @@ void frsky_check_telemetry(uint8_t *buffer,uint8_t len) } } #endif + return true; } void init_frskyd_link_telemetry()