@@ -570,12 +570,10 @@ static void applySelectAdjustment(uint8_t adjustmentFunction, uint8_t position)
570
570
571
571
#define RESET_FREQUENCY_2HZ (1000 / 2)
572
572
573
- void processRcAdjustments (controlRateConfig_t * controlRateConfig )
573
+ void processRcAdjustments (controlRateConfig_t * controlRateConfig , bool canUseRxData )
574
574
{
575
575
const uint32_t now = millis ();
576
576
577
- const bool canUseRxData = rxIsReceivingSignal ();
578
-
579
577
for (int adjustmentIndex = 0 ; adjustmentIndex < MAX_SIMULTANEOUS_ADJUSTMENT_COUNT ; adjustmentIndex ++ ) {
580
578
adjustmentState_t * const adjustmentState = & adjustmentStates [adjustmentIndex ];
581
579
@@ -636,23 +634,26 @@ void resetAdjustmentStates(void)
636
634
memset (adjustmentStates , 0 , sizeof (adjustmentStates ));
637
635
}
638
636
639
- void updateAdjustmentStates (void )
637
+ void updateAdjustmentStates (bool canUseRxData )
640
638
{
641
639
for (int index = 0 ; index < MAX_ADJUSTMENT_RANGE_COUNT ; index ++ ) {
642
640
const adjustmentRange_t * const adjustmentRange = adjustmentRanges (index );
641
+ const adjustmentConfig_t * adjustmentConfig = & defaultAdjustmentConfigs [adjustmentRange -> adjustmentFunction - ADJUSTMENT_FUNCTION_CONFIG_INDEX_OFFSET ];
643
642
644
- if (isRangeActive (adjustmentRange -> auxChannelIndex , & adjustmentRange -> range )) {
645
-
646
- const adjustmentConfig_t * adjustmentConfig = & defaultAdjustmentConfigs [adjustmentRange -> adjustmentFunction - ADJUSTMENT_FUNCTION_CONFIG_INDEX_OFFSET ];
647
-
643
+ if (canUseRxData && isRangeActive (adjustmentRange -> auxChannelIndex , & adjustmentRange -> range )) {
648
644
configureAdjustment (adjustmentRange -> adjustmentIndex , adjustmentRange -> auxSwitchChannelIndex , adjustmentConfig );
645
+ } else {
646
+ adjustmentState_t * const adjustmentState = & adjustmentStates [index ];
647
+ if (adjustmentState -> config == adjustmentConfig ) {
648
+ adjustmentState -> config = NULL ;
649
+ }
649
650
}
650
651
}
651
652
}
652
653
653
654
bool isAdjustmentFunctionSelected (uint8_t adjustmentFunction ) {
654
655
for (uint8_t index = 0 ; index < MAX_SIMULTANEOUS_ADJUSTMENT_COUNT ; ++ index ) {
655
- if (adjustmentStates [index ].config -> adjustmentFunction == adjustmentFunction ) {
656
+ if (adjustmentStates [index ].config && adjustmentStates [ index ]. config -> adjustmentFunction == adjustmentFunction ) {
656
657
return true;
657
658
}
658
659
}
0 commit comments