Added: Bayang telemetry

Changed telemetry configuration and validation for AFHDS2A and HUBSAN
Added default Bayang telemetry from Silverxxx:
- Option=1 to activate telemetry (option=0 -> standard Bayang protocol)
- Value returned to the TX: RX RSSI, TX RSSI, A1=uncompensated battery
voltage, A2=compensated battery voltage
This commit is contained in:
pascallanger
2016-12-06 22:30:48 +01:00
parent 7d7ca11c81
commit dfd8d0fa3d
8 changed files with 179 additions and 57 deletions

View File

@@ -72,7 +72,7 @@ static void AFHDS2A_calc_channels()
}
}
#if defined(TELEMETRY)
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
// telemetry sensors ID
enum{
AFHDS2A_SENSOR_RX_VOLTAGE = 0x00,
@@ -86,8 +86,9 @@ static void AFHDS2A_update_telemetry()
{
// AA | TXID | rx_id | sensor id | sensor # | value 16 bit big endian | sensor id ......
// max 7 sensors per packet
#if defined AFHDS2A_TELEMETRY
if (option & 0x80) {
#ifdef AFHDS2A_FW_TELEMETRY
if (option & 0x80)
{
// forward telemetry to TX, skip rx and tx id to save space
pkt[0]= TX_RSSI;
for(int i=9;i < AFHDS2A_RXPACKET_SIZE; i++)
@@ -96,14 +97,17 @@ static void AFHDS2A_update_telemetry()
telemetry_link=2;
return;
}
#endif
#endif
#ifdef AFHDS2A_HUB_TELEMETRY
for(uint8_t sensor=0; sensor<7; sensor++)
{
// Send FrSkyD telemetry to TX
uint8_t index = 9+(4*sensor);
switch(packet[index])
{
case AFHDS2A_SENSOR_RX_VOLTAGE:
v_lipo = packet[index+3]<<8 | packet[index+2];
//v_lipo1 = packet[index+3]<<8 | packet[index+2];
v_lipo1 = packet[index+2];
telemetry_link=1;
break;
/*case AFHDS2A_SENSOR_RX_ERR_RATE:
@@ -119,6 +123,7 @@ static void AFHDS2A_update_telemetry()
break;*/
}
}
#endif
}
#endif
@@ -298,7 +303,7 @@ uint16_t ReadAFHDS2A()
{
if(packet[9] == 0xfc)
packet_type=AFHDS2A_PACKET_SETTINGS; // RX is asking for settings
#if defined(TELEMETRY)
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
else
{
// Read TX RSSI
@@ -346,6 +351,9 @@ uint16_t initAFHDS2A()
rx_id[i]=eeprom_read_byte((EE_ADDR)(temp+i));
}
hopping_frequency_no = 0;
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
init_hub_telemetry();
#endif
return 50000;
}
#endif