mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
Fixed spurious 'bad RX' arming disable detection. (#5541)
This commit is contained in:
parent
9cf0eca620
commit
5a7b1879ee
3 changed files with 22 additions and 21 deletions
|
@ -262,7 +262,7 @@ static uint8_t fportFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)
|
|||
if (frameLength != FPORT_FRAME_PAYLOAD_LENGTH_CONTROL) {
|
||||
reportFrameError(DEBUG_FPORT_ERROR_TYPE_SIZE);
|
||||
} else {
|
||||
result |= sbusChannelsDecode(rxRuntimeConfig, &frame->data.controlData.channels);
|
||||
result = sbusChannelsDecode(rxRuntimeConfig, &frame->data.controlData.channels);
|
||||
|
||||
setRssiUnfiltered(scaleRange(constrain(frame->data.controlData.rssi, 0, 100), 0, 100, 0, 1024), RSSI_SOURCE_RX_PROTOCOL);
|
||||
|
||||
|
@ -314,7 +314,7 @@ static uint8_t fportFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)
|
|||
if ((mspPayload || hasTelemetryRequest) && cmpTimeUs(micros(), lastTelemetryFrameReceivedUs) >= FPORT_MIN_TELEMETRY_RESPONSE_DELAY_US) {
|
||||
hasTelemetryRequest = false;
|
||||
|
||||
result = result | RX_FRAME_PROCESSING_REQUIRED;
|
||||
result = (result & ~RX_FRAME_PENDING) | RX_FRAME_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
if (lastRcFrameReceivedMs && ((millis() - lastRcFrameReceivedMs) > FPORT_MAX_TELEMETRY_AGE_MS)) {
|
||||
|
|
|
@ -391,25 +391,18 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
|||
{
|
||||
UNUSED(currentDeltaTime);
|
||||
|
||||
if (rxSignalReceived) {
|
||||
if (currentTimeUs >= needRxSignalBefore) {
|
||||
rxSignalReceived = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool signalReceived = false;
|
||||
#if defined(USE_PWM) || defined(USE_PPM)
|
||||
if (feature(FEATURE_RX_PPM)) {
|
||||
if (isPPMDataBeingReceived()) {
|
||||
rxDataProcessingRequired = true;
|
||||
rxSignalReceived = true;
|
||||
signalReceived = true;
|
||||
rxIsInFailsafeMode = false;
|
||||
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
||||
resetPPMDataReceivedState();
|
||||
}
|
||||
} else if (feature(FEATURE_RX_PARALLEL_PWM)) {
|
||||
if (isPWMDataBeingReceived()) {
|
||||
rxDataProcessingRequired = true;
|
||||
rxSignalReceived = true;
|
||||
signalReceived = true;
|
||||
rxIsInFailsafeMode = false;
|
||||
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
||||
}
|
||||
|
@ -417,13 +410,15 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
|||
#endif
|
||||
{
|
||||
const uint8_t frameStatus = rxRuntimeConfig.rcFrameStatusFn(&rxRuntimeConfig);
|
||||
if (frameStatus & (RX_FRAME_COMPLETE | RX_FRAME_FAILSAFE | RX_FRAME_DROPPED)) {
|
||||
rxDataProcessingRequired = true;
|
||||
if (frameStatus & RX_FRAME_COMPLETE) {
|
||||
rxIsInFailsafeMode = (frameStatus & RX_FRAME_FAILSAFE) != 0;
|
||||
rxSignalReceived = (frameStatus & RX_FRAME_COMPLETE) != 0;
|
||||
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
||||
bool rxFrameDropped = (frameStatus & RX_FRAME_DROPPED) != 0;
|
||||
signalReceived = !(rxIsInFailsafeMode || rxFrameDropped);
|
||||
if (signalReceived) {
|
||||
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
||||
}
|
||||
|
||||
if (frameStatus & RX_FRAME_DROPPED) {
|
||||
if (frameStatus & (RX_FRAME_FAILSAFE | RX_FRAME_DROPPED)) {
|
||||
// No (0%) signal
|
||||
setRssiUnfiltered(0, RSSI_SOURCE_FRAME_ERRORS);
|
||||
} else {
|
||||
|
@ -437,7 +432,13 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
|||
}
|
||||
}
|
||||
|
||||
if (cmpTimeUs(currentTimeUs, rxNextUpdateAtUs) > 0) {
|
||||
if (signalReceived) {
|
||||
rxSignalReceived = true;
|
||||
} else if (currentTimeUs >= needRxSignalBefore) {
|
||||
rxSignalReceived = false;
|
||||
}
|
||||
|
||||
if (signalReceived || cmpTimeUs(currentTimeUs, rxNextUpdateAtUs) > 0) {
|
||||
rxDataProcessingRequired = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,12 +71,12 @@ uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannel
|
|||
if (channels->flags & SBUS_FLAG_FAILSAFE_ACTIVE) {
|
||||
// internal failsafe enabled and rx failsafe flag set
|
||||
// RX *should* still be sending valid channel data (repeated), so use it.
|
||||
return RX_FRAME_DROPPED | RX_FRAME_FAILSAFE;
|
||||
return RX_FRAME_COMPLETE | RX_FRAME_FAILSAFE;
|
||||
}
|
||||
|
||||
if (channels->flags & SBUS_FLAG_SIGNAL_LOSS) {
|
||||
// The received data is a repeat of the last valid data so can be considered complete.
|
||||
return RX_FRAME_DROPPED;
|
||||
// The received data is a repeat of the last valid data so can be considered complete.
|
||||
return RX_FRAME_COMPLETE | RX_FRAME_DROPPED;
|
||||
}
|
||||
|
||||
return RX_FRAME_COMPLETE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue