Skip to content

Commit

Permalink
Fix rx spi processing required (betaflight#13454)
Browse files Browse the repository at this point in the history
* fix RX_SPI_PROCESSING_REQUIRED

- fix typo
- remove unreachable 'return false;' in rxSpiProcessFrame

* Simplify auxiliaryProcessingRequired

rxRuntimeState.rcProcessFrameFn never returns false

* fixup! fix RX_SPI_PROCESSING_REQUIRED

---------

Co-authored-by: Petr Ledvina <[email protected]>
  • Loading branch information
ledvinap and Petr Ledvina authored Mar 15, 2024
1 parent d22ea47 commit 3aabaf3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/rx/cc2500_frsky_x.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ rx_spi_received_e frSkyXHandlePacket(uint8_t * const packet, uint8_t * const pro

#if defined(USE_TELEMETRY_SMARTPORT)
if (telemetryEnabled) {
ret |= RX_SPI_ROCESSING_REQUIRED;
ret |= RX_SPI_PROCESSING_REQUIRED;
}
#endif
*protocolState = STATE_RESUME;
Expand Down
3 changes: 2 additions & 1 deletion src/main/rx/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,8 @@ void detectAndApplySignalLossBehaviour(void)
bool calculateRxChannelsAndUpdateFailsafe(timeUs_t currentTimeUs)
{
if (auxiliaryProcessingRequired) {
auxiliaryProcessingRequired = !rxRuntimeState.rcProcessFrameFn(&rxRuntimeState);
rxRuntimeState.rcProcessFrameFn(&rxRuntimeState);
auxiliaryProcessingRequired = false;
}

if (!rxDataProcessingRequired) {
Expand Down
6 changes: 1 addition & 5 deletions src/main/rx/rx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static uint8_t rxSpiFrameStatus(rxRuntimeState_t *rxRuntimeState)
status = RX_FRAME_COMPLETE;
}

if (result & RX_SPI_ROCESSING_REQUIRED) {
if (result & RX_SPI_PROCESSING_REQUIRED) {
status |= RX_FRAME_PROCESSING_REQUIRED;
}

Expand All @@ -236,10 +236,6 @@ static bool rxSpiProcessFrame(const rxRuntimeState_t *rxRuntimeState)
if (result & RX_SPI_RECEIVED_DATA) {
rxSpiNewPacketAvailable = true;
}

if (result & RX_SPI_ROCESSING_REQUIRED) {
return false;
}
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/rx/rx_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef enum {
RX_SPI_RECEIVED_NONE = 0,
RX_SPI_RECEIVED_BIND = (1 << 0),
RX_SPI_RECEIVED_DATA = (1 << 1),
RX_SPI_ROCESSING_REQUIRED = (1 << 2),
RX_SPI_PROCESSING_REQUIRED = (1 << 2),
} rx_spi_received_e;

// RC channels in AETR order
Expand Down

0 comments on commit 3aabaf3

Please sign in to comment.