Fix PXX2 telemetry

This commit is contained in:
Raphael Coeffic
2022-08-11 12:15:46 +02:00
committed by Raphael Coeffic
parent df0d115a72
commit e31e3bb8be
2 changed files with 7 additions and 10 deletions
+6 -2
View File
@@ -752,9 +752,13 @@ static void pxx2ProcessData(void* context, uint8_t data, uint8_t* buffer, uint8_
*len = 0;
}
// no size yet
if (*len < 2) return;
uint8_t frame_len = buffer[1];
/* 1 byte start + 2 bytes header + 2 bytes CRC = 5 */
if (*len < unsigned(frame_len + 5)) {
/* 1 byte start + 1 byte len + 2 bytes CRC = 4 */
if (*len < unsigned(frame_len + 4)) {
return;
}
+1 -8
View File
@@ -131,9 +131,6 @@ static void processRegisterFrame(uint8_t module, const uint8_t * frame)
memcpy(mod.registerRxName, (const char *)&frame[4], PXX2_LEN_RX_NAME);
mod.registerLoopIndex = frame[12];
mod.registerStep = REGISTER_RX_NAME_RECEIVED;
#if defined(COLORLCD)
pushEvent(EVT_REFRESH);
#endif
}
break;
@@ -279,7 +276,7 @@ static void processAuthenticationFrame(uint8_t module, const uint8_t * frame,
}
#else
#define processAuthenticationFrame(module, frame)
#define processAuthenticationFrame(module, frame, drv, ctx)
#endif
static void processSpectrumAnalyserFrame(uint8_t module, const uint8_t * frame)
@@ -401,10 +398,6 @@ static void processToolsFrame(uint8_t module, const uint8_t * frame)
void processPXX2Frame(uint8_t module, const uint8_t * frame,
const etx_serial_driver_t* drv, void* ctx)
{
LOG_TELEMETRY_WRITE_START();
for (uint8_t i = 0; i < 1 + frame[0]; i++) {
LOG_TELEMETRY_WRITE_BYTE(frame[i]);
}
switch (frame[1]) {
case PXX2_TYPE_C_MODULE: