@@ -64,7 +64,6 @@ float rcCommandDelta[XYZ_AXIS_COUNT];
64
64
#endif
65
65
static float rawSetpoint [XYZ_AXIS_COUNT ];
66
66
static float setpointRate [3 ], rcDeflection [3 ], rcDeflectionAbs [3 ];
67
- static float rcDeflectionSmoothed [3 ];
68
67
static bool reverseMotors = false;
69
68
static applyRatesFn * applyRates ;
70
69
static uint16_t currentRxRefreshRate ;
@@ -90,13 +89,15 @@ enum {
90
89
#define RC_SMOOTHING_FILTER_TRAINING_DELAY_MS 1000 // Additional time to wait after receiving first valid rx frame before initial training starts
91
90
#define RC_SMOOTHING_FILTER_RETRAINING_DELAY_MS 2000 // Guard time to wait after retraining to prevent retraining again too quickly
92
91
#define RC_SMOOTHING_RX_RATE_CHANGE_PERCENT 20 // Look for samples varying this much from the current detected frame rate to initiate retraining
93
- #define RC_SMOOTHING_RX_RATE_MIN_US 950 // 0.950ms to fit 1kHz without an issue
94
- #define RC_SMOOTHING_RX_RATE_MAX_US 65500 // 65.5ms or 15.26hz
95
92
#define RC_SMOOTHING_FEEDFORWARD_INITIAL_HZ 100 // The value to use for "auto" when interpolated feedforward is enabled
96
93
97
94
static FAST_DATA_ZERO_INIT rcSmoothingFilter_t rcSmoothingData ;
95
+ static float rcDeflectionSmoothed [3 ];
98
96
#endif // USE_RC_SMOOTHING_FILTER
99
97
98
+ #define RC_RX_RATE_MIN_US 950 // 0.950ms to fit 1kHz without an issue
99
+ #define RC_RX_RATE_MAX_US 65500 // 65.5ms or 15.26hz
100
+
100
101
bool getShouldUpdateFeedforward ()
101
102
// only used in pid.c, when feedforward is enabled, to initiate a new FF value
102
103
{
@@ -302,8 +303,8 @@ void updateRcRefreshRate(timeUs_t currentTimeUs)
302
303
refreshRateUs = cmpTimeUs (currentTimeUs , lastRxTimeUs ); // calculate a delta here if not supplied by the protocol
303
304
}
304
305
lastRxTimeUs = currentTimeUs ;
305
- isRxRateValid = (refreshRateUs >= RC_SMOOTHING_RX_RATE_MIN_US && refreshRateUs <= RC_SMOOTHING_RX_RATE_MAX_US );
306
- currentRxRefreshRate = constrain (refreshRateUs , RC_SMOOTHING_RX_RATE_MIN_US , RC_SMOOTHING_RX_RATE_MAX_US );
306
+ isRxRateValid = (refreshRateUs >= RC_RX_RATE_MIN_US && refreshRateUs <= RC_RX_RATE_MAX_US );
307
+ currentRxRefreshRate = constrain (refreshRateUs , RC_RX_RATE_MIN_US , RC_RX_RATE_MAX_US );
307
308
}
308
309
309
310
uint16_t getCurrentRxRefreshRate (void )
0 commit comments