AFHDS2A extended telemetry forward

This commit is contained in:
Pascal Langer 2019-05-10 18:17:09 +02:00
parent 1916eb3095
commit 1a8f9c5a12
2 changed files with 53 additions and 53 deletions

View File

@ -87,16 +87,22 @@ static void AFHDS2A_update_telemetry()
// max 7 sensors per packet // max 7 sensors per packet
#ifdef AFHDS2A_FW_TELEMETRY #ifdef AFHDS2A_FW_TELEMETRY
if (option & 0x80) if (option & 0x80)
{ {// forward 0xAA and 0xAC telemetry to TX, skip rx and tx id to save space
// forward telemetry to TX, skip rx and tx id to save space
pkt[0]= TX_RSSI; pkt[0]= TX_RSSI;
debug("T=");
for(int i=9;i < AFHDS2A_RXPACKET_SIZE; i++) for(int i=9;i < AFHDS2A_RXPACKET_SIZE; i++)
{
pkt[i-8]=packet[i]; pkt[i-8]=packet[i];
debug(" %02X",packet[i]);
}
telemetry_link=2; telemetry_link=2;
debugln("");
return; return;
} }
#endif #endif
#ifdef AFHDS2A_HUB_TELEMETRY #ifdef AFHDS2A_HUB_TELEMETRY
if(packet[0]==0xAA)
{ // 0xAA Normal telemetry, 0xAC Extended telemetry not decoded here
for(uint8_t sensor=0; sensor<7; sensor++) for(uint8_t sensor=0; sensor<7; sensor++)
{ {
// Send FrSkyD telemetry to TX // Send FrSkyD telemetry to TX
@ -118,13 +124,14 @@ static void AFHDS2A_update_telemetry()
case AFHDS2A_SENSOR_RX_RSSI: case AFHDS2A_SENSOR_RX_RSSI:
RX_RSSI = -packet[index+2]; RX_RSSI = -packet[index+2];
break; break;
case 0xff: case 0xff: // end of data
return; return;
/*default: /*default:
// unknown sensor ID // unknown sensor ID
break;*/ break;*/
} }
} }
}
#endif #endif
} }
#endif #endif
@ -323,20 +330,13 @@ uint16_t ReadAFHDS2A()
if(!(A7105_ReadReg(A7105_00_MODE) & (1<<5 | 1<<6)) && data_rx==1) if(!(A7105_ReadReg(A7105_00_MODE) & (1<<5 | 1<<6)) && data_rx==1)
{ // RX+FECF+CRCF Ok { // RX+FECF+CRCF Ok
A7105_ReadData(AFHDS2A_RXPACKET_SIZE); A7105_ReadData(AFHDS2A_RXPACKET_SIZE);
#ifdef DEBUG_SERIAL if(packet[0] == 0xAA && packet[9] == 0xFC)
debug("T=");
for(uint8_t i=0;i < AFHDS2A_RXPACKET_SIZE; i++)
{
debug(" %02X",packet[i]);
}
debugln("");
#endif
if(packet[0] == 0xaa)
{
if(packet[9] == 0xfc)
packet_type=AFHDS2A_PACKET_SETTINGS; // RX is asking for settings packet_type=AFHDS2A_PACKET_SETTINGS; // RX is asking for settings
else else
if(packet[0] == 0xAA || packet[0] == 0xAC)
{ {
if(memcmp(&packet[1], rx_tx_addr, 4))
{ // Validate TX address
#ifdef AFHDS2A_LQI_CH #ifdef AFHDS2A_LQI_CH
for(uint8_t sensor=0; sensor<7; sensor++) for(uint8_t sensor=0; sensor<7; sensor++)
{//read LQI value for RX output {//read LQI value for RX output

View File

@ -19,7 +19,7 @@
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_REVISION 1 #define VERSION_REVISION 1
#define VERSION_PATCH_LEVEL 43 #define VERSION_PATCH_LEVEL 44
//****************** //******************
// Protocols // Protocols