mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +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) {
|
if (frameLength != FPORT_FRAME_PAYLOAD_LENGTH_CONTROL) {
|
||||||
reportFrameError(DEBUG_FPORT_ERROR_TYPE_SIZE);
|
reportFrameError(DEBUG_FPORT_ERROR_TYPE_SIZE);
|
||||||
} else {
|
} 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);
|
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) {
|
if ((mspPayload || hasTelemetryRequest) && cmpTimeUs(micros(), lastTelemetryFrameReceivedUs) >= FPORT_MIN_TELEMETRY_RESPONSE_DELAY_US) {
|
||||||
hasTelemetryRequest = false;
|
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)) {
|
if (lastRcFrameReceivedMs && ((millis() - lastRcFrameReceivedMs) > FPORT_MAX_TELEMETRY_AGE_MS)) {
|
||||||
|
|
|
@ -391,25 +391,18 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
||||||
{
|
{
|
||||||
UNUSED(currentDeltaTime);
|
UNUSED(currentDeltaTime);
|
||||||
|
|
||||||
if (rxSignalReceived) {
|
bool signalReceived = false;
|
||||||
if (currentTimeUs >= needRxSignalBefore) {
|
|
||||||
rxSignalReceived = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#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()) {
|
||||||
rxDataProcessingRequired = true;
|
signalReceived = true;
|
||||||
rxSignalReceived = true;
|
|
||||||
rxIsInFailsafeMode = false;
|
rxIsInFailsafeMode = false;
|
||||||
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
||||||
resetPPMDataReceivedState();
|
resetPPMDataReceivedState();
|
||||||
}
|
}
|
||||||
} else if (feature(FEATURE_RX_PARALLEL_PWM)) {
|
} else if (feature(FEATURE_RX_PARALLEL_PWM)) {
|
||||||
if (isPWMDataBeingReceived()) {
|
if (isPWMDataBeingReceived()) {
|
||||||
rxDataProcessingRequired = true;
|
signalReceived = true;
|
||||||
rxSignalReceived = true;
|
|
||||||
rxIsInFailsafeMode = false;
|
rxIsInFailsafeMode = false;
|
||||||
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
||||||
}
|
}
|
||||||
|
@ -417,13 +410,15 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
const uint8_t frameStatus = rxRuntimeConfig.rcFrameStatusFn(&rxRuntimeConfig);
|
const uint8_t frameStatus = rxRuntimeConfig.rcFrameStatusFn(&rxRuntimeConfig);
|
||||||
if (frameStatus & (RX_FRAME_COMPLETE | RX_FRAME_FAILSAFE | RX_FRAME_DROPPED)) {
|
if (frameStatus & RX_FRAME_COMPLETE) {
|
||||||
rxDataProcessingRequired = true;
|
|
||||||
rxIsInFailsafeMode = (frameStatus & RX_FRAME_FAILSAFE) != 0;
|
rxIsInFailsafeMode = (frameStatus & RX_FRAME_FAILSAFE) != 0;
|
||||||
rxSignalReceived = (frameStatus & RX_FRAME_COMPLETE) != 0;
|
bool rxFrameDropped = (frameStatus & RX_FRAME_DROPPED) != 0;
|
||||||
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
signalReceived = !(rxIsInFailsafeMode || rxFrameDropped);
|
||||||
|
if (signalReceived) {
|
||||||
|
needRxSignalBefore = currentTimeUs + needRxSignalMaxDelayUs;
|
||||||
|
}
|
||||||
|
|
||||||
if (frameStatus & RX_FRAME_DROPPED) {
|
if (frameStatus & (RX_FRAME_FAILSAFE | RX_FRAME_DROPPED)) {
|
||||||
// No (0%) signal
|
// No (0%) signal
|
||||||
setRssiUnfiltered(0, RSSI_SOURCE_FRAME_ERRORS);
|
setRssiUnfiltered(0, RSSI_SOURCE_FRAME_ERRORS);
|
||||||
} else {
|
} 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;
|
rxDataProcessingRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,12 +71,12 @@ uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannel
|
||||||
if (channels->flags & SBUS_FLAG_FAILSAFE_ACTIVE) {
|
if (channels->flags & SBUS_FLAG_FAILSAFE_ACTIVE) {
|
||||||
// internal failsafe enabled and rx failsafe flag set
|
// internal failsafe enabled and rx failsafe flag set
|
||||||
// RX *should* still be sending valid channel data (repeated), so use it.
|
// 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) {
|
if (channels->flags & SBUS_FLAG_SIGNAL_LOSS) {
|
||||||
// The received data is a repeat of the last valid data so can be considered complete.
|
// The received data is a repeat of the last valid data so can be considered complete.
|
||||||
return RX_FRAME_DROPPED;
|
return RX_FRAME_COMPLETE | RX_FRAME_DROPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RX_FRAME_COMPLETE;
|
return RX_FRAME_COMPLETE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue