fix(crsf): prevent USB CDC / Serial2 blocking and ignore 0x16 echo on GP1

This commit is contained in:
bleackstorm committed 2026-11-16 19:53:24 +01:00
1 parent 14f9218a44
commit 50c1eb05b1
1 file changed
+7 -1
+7 -1
View File
@@ -763,6 +763,8 @@ void traiterTelemetrieCRSF() {
} }
// Relais de la télémétrie CRSF valide vers SteamFrame FPV (OSD via Radxa/USB) // Relais de la télémétrie CRSF valide vers SteamFrame FPV (OSD via Radxa/USB)
// Ne jamais relayer 0x16 (RC_CHANNELS_PACKED) si GP1 reçoit un écho des trames émises
if (frameType != 0x16) {
size_t totalLen = (size_t)paquetLongueurAttendue + 2; size_t totalLen = (size_t)paquetLongueurAttendue + 2;
if (totalLen <= 64) { if (totalLen <= 64) {
char bufCrsf[140]; char bufCrsf[140];
@@ -777,6 +779,7 @@ void traiterTelemetrieCRSF() {
emettreLigneCockpit(bufCrsf); emettreLigneCockpit(bufCrsf);
} }
} }
}
crsfRxIdx = 0; crsfRxIdx = 0;
} }
@@ -807,8 +810,11 @@ void traiterTelemetrieCRSF() {
} }
void emettreLigneCockpit(const char* ligne) { void emettreLigneCockpit(const char* ligne) {
int needed = (int)strlen(ligne) + 2;
if (Serial2.availableForWrite() >= needed) {
Serial2.println(ligne); Serial2.println(ligne);
if (cockpitEchoUSB) { }
if (cockpitEchoUSB && Serial && Serial.availableForWrite() >= needed) {
Serial.println(ligne); Serial.println(ligne);
} }
} }