mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 17:55:28 +03:00
Merge pull request #3482 from iNavFlight/de_rcdata_ignore_failsafe
Ignore RC channel values sent by receiver in failsafe
This commit is contained in:
commit
3e670db83c
3 changed files with 16 additions and 4 deletions
|
@ -486,7 +486,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
||||||
|
|
||||||
case MSP_RC:
|
case MSP_RC:
|
||||||
for (int i = 0; i < rxRuntimeConfig.channelCount; i++) {
|
for (int i = 0; i < rxRuntimeConfig.channelCount; i++) {
|
||||||
sbufWriteU16(dst, rcData[i]);
|
sbufWriteU16(dst, rcRaw[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -470,6 +470,7 @@ bool calculateRxChannelsAndUpdateFailsafe(timeUs_t currentTimeUs)
|
||||||
{
|
{
|
||||||
UNUSED(currentTimeUs);
|
UNUSED(currentTimeUs);
|
||||||
|
|
||||||
|
int16_t rcStaging[MAX_SUPPORTED_RC_CHANNEL_COUNT];
|
||||||
const timeMs_t currentTimeMs = millis();
|
const timeMs_t currentTimeMs = millis();
|
||||||
|
|
||||||
if (auxiliaryProcessingRequired) {
|
if (auxiliaryProcessingRequired) {
|
||||||
|
@ -520,11 +521,21 @@ bool calculateRxChannelsAndUpdateFailsafe(timeUs_t currentTimeUs)
|
||||||
rcInvalidPulsPeriod[channel] = currentTimeMs + MAX_INVALID_PULS_TIME;
|
rcInvalidPulsPeriod[channel] = currentTimeMs + MAX_INVALID_PULS_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update rcData channel value
|
// Save channel value
|
||||||
|
rcStaging[channel] = sample;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update rcData channel value if receiver is not in failsafe mode
|
||||||
|
// If receiver is in failsafe (not receiving signal or sending invalid channel values) - last good rcData values are retained
|
||||||
|
if (rxFlightChannelsValid && rxSignalReceived) {
|
||||||
if (rxRuntimeConfig.requireFiltering) {
|
if (rxRuntimeConfig.requireFiltering) {
|
||||||
rcData[channel] = applyChannelFiltering(channel, sample);
|
for (int channel = 0; channel < rxRuntimeConfig.channelCount; channel++) {
|
||||||
|
rcData[channel] = applyChannelFiltering(channel, rcStaging[channel]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rcData[channel] = sample;
|
for (int channel = 0; channel < rxRuntimeConfig.channelCount; channel++) {
|
||||||
|
rcData[channel] = rcStaging[channel];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ typedef enum {
|
||||||
|
|
||||||
extern const char rcChannelLetters[];
|
extern const char rcChannelLetters[];
|
||||||
|
|
||||||
|
extern int16_t rcRaw[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000]
|
||||||
extern int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000]
|
extern int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000]
|
||||||
|
|
||||||
#define MAX_MAPPABLE_RX_INPUTS 4
|
#define MAX_MAPPABLE_RX_INPUTS 4
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue