mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-12-16 04:43:15 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user