Fixed RX FIFO buffer flush on frame error.

This commit is contained in:
mikeller 2019-10-10 01:59:07 +13:00
parent bbf09b6027
commit e78f9761bc
2 changed files with 2 additions and 6 deletions

View File

@ -249,7 +249,7 @@ rx_spi_received_e frSkyDHandlePacket(uint8_t * const packet, uint8_t * const pro
}
}
if (!packetOk) {
cc2500Strobe(CC2500_SRX);
cc2500Strobe(CC2500_SFRX);
}
}

View File

@ -369,12 +369,10 @@ rx_spi_received_e frSkyXHandlePacket(uint8_t * const packet, uint8_t * const pro
// here FS code could be
case STATE_DATA:
if (cc2500getGdo() && (frameReceived == false)){
bool packetOk = false;
uint8_t ccLen = cc2500ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
if (ccLen >= packetLength) {
cc2500ReadFifo(packet, packetLength);
if (isValidPacket(packet)) {
packetOk = true;
missingPackets = 0;
timeoutUs = 1;
receiveDelayUs = 0;
@ -450,11 +448,9 @@ rx_spi_received_e frSkyXHandlePacket(uint8_t * const packet, uint8_t * const pro
if (!frameReceived) {
packetErrors++;
DEBUG_SET(DEBUG_RX_FRSKY_SPI, DEBUG_DATA_BAD_FRAME, packetErrors);
cc2500Strobe(CC2500_SFRX);
}
}
if (!packetOk) {
cc2500Strobe(CC2500_SRX);
}
}
if (telemetryReceived) {
if (cmpTimeUs(micros(), packetTimerUs) > receiveDelayUs) { // if received or not received in this time sent telemetry data