Protocol Flysky AFHDS2A receiver (#275)

* Add skeleton for AFHDS2A receiver protocol

* Bind & data Ok

* Send channels to TX via telemetry

* Add RSSI

* Fix AVR compilation

* Fix channel number
This commit is contained in:
goebish
2019-10-01 20:44:26 +02:00
committed by pascallanger
parent e8b5f071fe
commit f3d2ab61e4
8 changed files with 245 additions and 11 deletions

View File

@@ -184,16 +184,21 @@ static void multi_send_status()
}
#endif
#ifdef FRSKYX_RX_TELEMETRY
void frskyx_rx_channels_frame()
#if defined (FRSKYX_RX_TELEMETRY) || defined (AFHDS2A_RX_TELEMETRY)
void receiver_channels_frame()
{
uint16_t len = pkt[3] * 11; // 11 bit per channel
if (len % 8 == 0)
len = 4 + (len / 8);
else
len = 5 + (len / 8);
#if defined MULTI_TELEMETRY
multi_send_header(MULTI_TELEMETRY_RX_CHANNELS, 26);
multi_send_header(MULTI_TELEMETRY_RX_CHANNELS, len);
#else
Serial_write(0xAA); // Telemetry packet
#endif
for (uint8_t i = 0; i < 26; i++)
Serial_write(pkt[i]); // pps, rssi, ch start, ch count, 16x ch data
for (uint8_t i = 0; i < len; i++)
Serial_write(pkt[i]); // pps, rssi, ch start, ch count, packed ch data
}
#endif
@@ -1032,10 +1037,10 @@ void TelemetryUpdate()
}
#endif
#if defined FRSKYX_RX_TELEMETRY
if (telemetry_link && protocol == PROTO_FRSKYX_RX)
#if defined (FRSKYX_RX_TELEMETRY) || defined(AFHDS2A_RX_TELEMETRY)
if (telemetry_link && (protocol == PROTO_FRSKYX_RX || protocol == PROTO_AFHDS2A_RX))
{
frskyx_rx_channels_frame();
receiver_channels_frame();
telemetry_link = 0;
return;
}