From cc3824a7c5010038f5a608e964b11cc62af73de9 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Tue, 9 Feb 2021 01:17:58 +0100 Subject: [PATCH] Fix compiler warning --- src/main/rx/cc2500_frsky_x.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/main/rx/cc2500_frsky_x.c b/src/main/rx/cc2500_frsky_x.c index 8e2981aae..8ea861629 100644 --- a/src/main/rx/cc2500_frsky_x.c +++ b/src/main/rx/cc2500_frsky_x.c @@ -177,15 +177,11 @@ static void buildTelemetryFrame(uint8_t *packet) frame[0] = 0x0E;//length frame[1] = rxCc2500SpiConfig()->bindTxId[0]; frame[2] = rxCc2500SpiConfig()->bindTxId[1]; - switch(spiProtocol) { - case RX_SPI_FRSKY_X: - case RX_SPI_FRSKY_X_LBT: - frame[3] = packet[3]; - break; - case RX_SPI_FRSKY_X_V2: - case RX_SPI_FRSKY_X_LBT_V2: + + if (spiProtocol == RX_SPI_FRSKY_X_V2 || spiProtocol == RX_SPI_FRSKY_X_LBT_V2) { frame[3] = rxCc2500SpiConfig()->bindTxId[2]; - break; + } else { + frame[3] = packet[3]; } if (evenRun) { @@ -300,23 +296,16 @@ void frSkyXSetRcData(uint16_t *rcData, const uint8_t *packet) bool isValidPacket(const uint8_t *packet) { + bool useBindTxId2 = false; + if (spiProtocol == RX_SPI_FRSKY_X_V2 || spiProtocol == RX_SPI_FRSKY_X_LBT_V2) { + useBindTxId2 = true; if (!(packet[packetLength - 1] & 0x80)) { return false; } } - uint16_t lcrc = calculateCrc(&packet[3], (packetLength - 7)); - bool useBindTxId2; - switch(spiProtocol) { - case RX_SPI_FRSKY_X: - case RX_SPI_FRSKY_X_LBT: - useBindTxId2 = false; - break; - case RX_SPI_FRSKY_X_V2: - case RX_SPI_FRSKY_X_LBT_V2: - useBindTxId2 = true; - break; - } + + uint16_t lcrc = calculateCrc(&packet[3], (packetLength - 7)); if ((lcrc >> 8) == packet[packetLength - 4] && (lcrc & 0x00FF) == packet[packetLength - 3] && (packet[0] == packetLength - 3) &&