Merge pull request #6688 from mikeller/dont_skip_serial_frames
Remove skipping of frames after suspension for serial RX.
This commit is contained in:
commit
0c265773dd
|
@ -512,7 +512,7 @@ void validateAndFixGyroConfig(void)
|
||||||
|
|
||||||
bool readEEPROM(void)
|
bool readEEPROM(void)
|
||||||
{
|
{
|
||||||
suspendRxSignal();
|
suspendRxPwmPpmSignal();
|
||||||
|
|
||||||
// Sanity check, read flash
|
// Sanity check, read flash
|
||||||
bool success = loadEEPROM();
|
bool success = loadEEPROM();
|
||||||
|
@ -521,7 +521,7 @@ bool readEEPROM(void)
|
||||||
|
|
||||||
activateConfig();
|
activateConfig();
|
||||||
|
|
||||||
resumeRxSignal();
|
resumeRxPwmPpmSignal();
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
@ -530,11 +530,11 @@ void writeEEPROM(void)
|
||||||
{
|
{
|
||||||
validateAndFixConfig();
|
validateAndFixConfig();
|
||||||
|
|
||||||
suspendRxSignal();
|
suspendRxPwmPpmSignal();
|
||||||
|
|
||||||
writeConfigToEEPROM();
|
writeConfigToEEPROM();
|
||||||
|
|
||||||
resumeRxSignal();
|
resumeRxPwmPpmSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeEEPROMWithFeatures(uint32_t features)
|
void writeEEPROMWithFeatures(uint32_t features)
|
||||||
|
|
|
@ -295,7 +295,7 @@ void rxInit(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_PWM) || defined(USE_PPM)
|
#if defined(USE_PWM) || defined(USE_PPM)
|
||||||
if (featureIsEnabled(FEATURE_RX_PPM) || featureIsEnabled(FEATURE_RX_PARALLEL_PWM)) {
|
if (featureIsEnabled(FEATURE_RX_PPM | FEATURE_RX_PARALLEL_PWM)) {
|
||||||
rxPwmInit(rxConfig(), &rxRuntimeConfig);
|
rxPwmInit(rxConfig(), &rxRuntimeConfig);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -322,18 +322,26 @@ bool rxAreFlightChannelsValid(void)
|
||||||
return rxFlightChannelsValid;
|
return rxFlightChannelsValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void suspendRxSignal(void)
|
void suspendRxPwmPpmSignal(void)
|
||||||
{
|
{
|
||||||
|
#if defined(USE_PWM) || defined(USE_PPM)
|
||||||
|
if (featureIsEnabled(FEATURE_RX_PARALLEL_PWM | FEATURE_RX_PPM)) {
|
||||||
suspendRxSignalUntil = micros() + SKIP_RC_ON_SUSPEND_PERIOD;
|
suspendRxSignalUntil = micros() + SKIP_RC_ON_SUSPEND_PERIOD;
|
||||||
skipRxSamples = SKIP_RC_SAMPLES_ON_RESUME;
|
skipRxSamples = SKIP_RC_SAMPLES_ON_RESUME;
|
||||||
failsafeOnRxSuspend(SKIP_RC_ON_SUSPEND_PERIOD);
|
failsafeOnRxSuspend(SKIP_RC_ON_SUSPEND_PERIOD);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void resumeRxSignal(void)
|
void resumeRxPwmPpmSignal(void)
|
||||||
{
|
{
|
||||||
|
#if defined(USE_PWM) || defined(USE_PPM)
|
||||||
|
if (featureIsEnabled(FEATURE_RX_PARALLEL_PWM | FEATURE_RX_PPM)) {
|
||||||
suspendRxSignalUntil = micros();
|
suspendRxSignalUntil = micros();
|
||||||
skipRxSamples = SKIP_RC_SAMPLES_ON_RESUME;
|
skipRxSamples = SKIP_RC_SAMPLES_ON_RESUME;
|
||||||
failsafeOnRxResume();
|
failsafeOnRxResume();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
||||||
|
@ -397,6 +405,7 @@ bool rxUpdateCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTime)
|
||||||
return rxDataProcessingRequired || auxiliaryProcessingRequired; // data driven or 50Hz
|
return rxDataProcessingRequired || auxiliaryProcessingRequired; // data driven or 50Hz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(USE_PWM) || defined(USE_PPM)
|
||||||
static uint16_t calculateChannelMovingAverage(uint8_t chan, uint16_t sample)
|
static uint16_t calculateChannelMovingAverage(uint8_t chan, uint16_t sample)
|
||||||
{
|
{
|
||||||
static int16_t rcSamples[MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT][PPM_AND_PWM_SAMPLE_COUNT];
|
static int16_t rcSamples[MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT][PPM_AND_PWM_SAMPLE_COUNT];
|
||||||
|
@ -422,6 +431,7 @@ static uint16_t calculateChannelMovingAverage(uint8_t chan, uint16_t sample)
|
||||||
}
|
}
|
||||||
return rcDataMean[chan] / PPM_AND_PWM_SAMPLE_COUNT;
|
return rcDataMean[chan] / PPM_AND_PWM_SAMPLE_COUNT;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint16_t getRxfailValue(uint8_t channel)
|
static uint16_t getRxfailValue(uint8_t channel)
|
||||||
{
|
{
|
||||||
|
@ -510,10 +520,13 @@ static void detectAndApplySignalLossBehaviour(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if defined(USE_PWM) || defined(USE_PPM)
|
||||||
if (featureIsEnabled(FEATURE_RX_PARALLEL_PWM | FEATURE_RX_PPM)) {
|
if (featureIsEnabled(FEATURE_RX_PARALLEL_PWM | FEATURE_RX_PPM)) {
|
||||||
// smooth output for PWM and PPM
|
// smooth output for PWM and PPM
|
||||||
rcData[channel] = calculateChannelMovingAverage(channel, sample);
|
rcData[channel] = calculateChannelMovingAverage(channel, sample);
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
rcData[channel] = sample;
|
rcData[channel] = sample;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,7 +557,7 @@ bool calculateRxChannelsAndUpdateFailsafe(timeUs_t currentTimeUs)
|
||||||
rxNextUpdateAtUs = currentTimeUs + DELAY_33_HZ;
|
rxNextUpdateAtUs = currentTimeUs + DELAY_33_HZ;
|
||||||
|
|
||||||
// only proceed when no more samples to skip and suspend period is over
|
// only proceed when no more samples to skip and suspend period is over
|
||||||
if (skipRxSamples) {
|
if (skipRxSamples || currentTimeUs <= suspendRxSignalUntil) {
|
||||||
if (currentTimeUs > suspendRxSignalUntil) {
|
if (currentTimeUs > suspendRxSignalUntil) {
|
||||||
skipRxSamples--;
|
skipRxSamples--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ uint8_t getRssiPercent(void);
|
||||||
|
|
||||||
void resetAllRxChannelRangeConfigurations(rxChannelRangeConfig_t *rxChannelRangeConfig);
|
void resetAllRxChannelRangeConfigurations(rxChannelRangeConfig_t *rxChannelRangeConfig);
|
||||||
|
|
||||||
void suspendRxSignal(void);
|
void suspendRxPwmPpmSignal(void);
|
||||||
void resumeRxSignal(void);
|
void resumeRxPwmPpmSignal(void);
|
||||||
|
|
||||||
uint16_t rxGetRefreshRate(void);
|
uint16_t rxGetRefreshRate(void);
|
||||||
|
|
Loading…
Reference in New Issue