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:
parent
1243b3ad50
commit
c091fa8e48
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue