feat: Add support for latest FrSky receivers (#4077)

Co-authored-by: Bertrand Songis <bsongis@gmail.com>
Co-authored-by: raphaelcoeffic <raphael.coeffic@frafos.com>
This commit is contained in:
3djc
2023-10-09 19:22:57 +10:00
committed by GitHub
co-authored by Bertrand Songis raphaelcoeffic
parent d684930cc9
commit 5fd22612aa
12 changed files with 410 additions and 151 deletions
+87 -34
View File
@@ -39,8 +39,8 @@ static const char * const PXX2ModulesNames[] = {
"ISRM-PRO",
"ISRM-S",
"R9M",
"R9MLite",
"R9MLite-PRO",
"R9M Lite",
"R9M Lite Pro",
"ISRM-N",
"ISRM-S-X9",
"ISRM-S-X10E",
@@ -58,37 +58,87 @@ const char * getPXX2ModuleName(uint8_t modelId)
}
static const char * const PXX2ReceiversNames[] = {
"---",
"X8R",
"RX8R",
"RX8R-PRO",
"RX6R",
"RX4R",
"G-RX8",
"G-RX6",
"X6R",
"X4R",
"X4R-SB",
"XSR",
"XSR-M",
"RXSR",
"S6R",
"S8R",
"XM",
"XM+",
"XMR",
"R9",
"R9-SLIM",
"R9-SLIM+",
"R9-MINI",
"R9-MM",
"R9-STAB", // R9-STAB has OTA
"R9-MINI-OTA", // this one has OTA (different bootloader)
"R9-MM-OTA", // this one has OTA (different bootloader)
"R9-SLIM+-OTA", // this one has OTA (different bootloader)
"Archer-X", // this one has OTA (internal module)
"R9MX", // this one has OTA
"R9SX", // this one has OTA
"---",
"X8R",
"RX8R",
"RX8R Pro",
"RX6R",
"RX4R",
"G-RX8",
"G-RX6",
"X6R",
"X4R",
"X4R SB",
"XSR",
"XSR M",
"RXSR",
"S6R",
"S8R",
"XM",
"XM+",
"XMR",
"R9",
"R9 SLIM",
"R9 SLIM+",
"R9 MINI",
"R9 MM",
"R9 Stab",
"R9 Mini OTA",
"R9 MM OTA",
"R9 SLIM+ OTA",
"Archer X",
"R9MX",
"R9SX",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"---",
"SR10 Plus", // 0x40
"R10 Plus",
"GR8 Plus",
"R8 Plus",
"SR8 Plus",
"GR6 Plus",
"R6 Plus",
"R6M (ESC DC)",
"Rs Plus",
"RS Mini",
"R6FB",
"GR6FB",
"SR12 Plus",
"R12 Plus",
"R6 Mini ESC",
"SR6 Mini",
"SR6 Mini ESC", // 0x50
};
const char * getPXX2ReceiverName(uint8_t modelId)
@@ -120,7 +170,7 @@ static void processGetHardwareInfoFrame(uint8_t module, const uint8_t * frame)
POPUP_WARNING(STR_MODULE_UPGRADE_ALERT);
}
}
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE && modelId < DIM(PXX2ReceiversNames)) {
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE) {
memcpy(&destination->receivers[index].information, &frame[4], length);
destination->receivers[index].timestamp = get_tmr10ms();
if (destination->receivers[index].information.capabilities & ~((1 << RECEIVER_CAPABILITY_COUNT) - 1))
@@ -174,6 +224,9 @@ static void processReceiverSettingsFrame(uint8_t module, const uint8_t * frame)
if (frame[4] & PXX2_RX_SETTINGS_FLAG1_FPORT2)
destination->fport2 = 1;
if (frame[4] & PXX2_RX_SETTINGS_FLAG1_SBUS24)
destination->sbus24 = 1;
uint8_t outputsCount = min<uint8_t>(16, frame[0] - 4);
destination->outputsCount = outputsCount;
for (uint8_t pin = 0; pin < outputsCount; pin++) {