Fix PWM rx 100% CPU load (#5598)

Previous logic changes were causing the RX task to run every loop for PWM rx leading to 100% CPU load. Reverted PWM processing to be based on a time interval rather than whether new data is available. With PWM we can't differentiate when new data is available as it's a continuous stream.
This commit is contained in:
etracer65 2018-04-01 18:35:26 -04:00 committed by Michael Keller
parent 1243b3ad50
commit c091fa8e48
1 changed files with 4 additions and 1 deletions

View File

@ -392,6 +392,8 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
UNUSED(currentDeltaTime); UNUSED(currentDeltaTime);
bool signalReceived = false; bool signalReceived = false;
bool useDataDrivenProcessing = true;
#if defined(USE_PWM) || defined(USE_PPM) #if defined(USE_PWM) || defined(USE_PPM)
if (feature(FEATURE_RX_PPM)) { if (feature(FEATURE_RX_PPM)) {
if (isPPMDataBeingReceived()) { if (isPPMDataBeingReceived()) {
@ -405,6 +407,7 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
signalReceived = true; signalReceived = true;
rxIsInFailsafeMode = false; rxIsInFailsafeMode = false;
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs; needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
useDataDrivenProcessing = false;
} }
} else } else
#endif #endif
@ -438,7 +441,7 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
rxSignalReceived = false; rxSignalReceived = false;
} }
if (signalReceived || cmpTimeUs(currentTimeUs, rxNextUpdateAtUs) > 0) { if ((signalReceived && useDataDrivenProcessing) || cmpTimeUs(currentTimeUs, rxNextUpdateAtUs) > 0) {
rxDataProcessingRequired = true; rxDataProcessingRequired = true;
} }