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
+2
View File
@@ -102,6 +102,8 @@
#define ACCY_LAST_ID 0x071F
#define ACCZ_FIRST_ID 0x0720
#define ACCZ_LAST_ID 0x072F
#define ANGLE_FIRST_ID 0x0730
#define ANGLE_LAST_ID 0x073F
#define GPS_LONG_LATI_FIRST_ID 0x0800
#define GPS_LONG_LATI_LAST_ID 0x080F
#define GPS_ALT_FIRST_ID 0x0820
+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++) {
+6
View File
@@ -54,6 +54,8 @@ const FrSkySportSensor sportSensors[] = {
FS( ACCX_FIRST_ID, ACCX_LAST_ID, 0, STR_SENSOR_ACCX, UNIT_G, 3 ),
FS( ACCY_FIRST_ID, ACCY_LAST_ID, 0, STR_SENSOR_ACCY, UNIT_G, 3 ),
FS( ACCZ_FIRST_ID, ACCZ_LAST_ID, 0, STR_SENSOR_ACCZ, UNIT_G, 3 ),
FS( ANGLE_FIRST_ID, ANGLE_LAST_ID, 0, STR_SENSOR_ROLL, UNIT_DEGREE, 2 ),
FS( ANGLE_FIRST_ID, ANGLE_LAST_ID, 1, STR_SENSOR_PITCH, UNIT_DEGREE, 2 ),
FS( CURR_FIRST_ID, CURR_LAST_ID, 0, STR_SENSOR_CURR, UNIT_AMPS, 1 ),
FS( VFAS_FIRST_ID, VFAS_LAST_ID, 0, STR_SENSOR_VFAS, UNIT_VOLTS, 2 ),
FS( AIR_SPEED_FIRST_ID, AIR_SPEED_LAST_ID, 0, STR_SENSOR_ASPD, UNIT_KTS, 1 ),
@@ -417,6 +419,10 @@ void sportProcessTelemetryPacketWithoutCrc(uint8_t module, uint8_t origin, const
servosState = newServosState;
}
}
else if (dataId >= ANGLE_FIRST_ID && dataId <= ANGLE_LAST_ID) {
sportProcessTelemetryPacket(dataId, 0, instance, data & 0xFFFFu);
sportProcessTelemetryPacket(dataId, 1, instance, data >> 16u);
}
else {
sportProcessTelemetryPacket(dataId, 0, instance, data);
}