1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00

Dynamic Filter Update

Improves on earlier 3.5RC1 dynamic filter with:
- better FFT tracking performance overall, even with a narrower default notch width
- can reach 850Hz for high kV 2.5-3" and 6S quads
- works better with 32k gyros
- can be applied pre- (location 1) and post- (location 2) static filters. Pre-static filter location works best, but post-static may work well in 32k modes or with PT1 option
- option to use a PT1 filter rather than the classical notch filter, perhaps useful for quads with a lot of noise above their peak.
- ability to totally bypass the pre-FFT bandpass filter, by setting Q=0, maximising the range of responsiveness
- "ignore" value, absolute FFT bin amplitude below which the bin will be excluded from consideration. May be tweaked to optimise peak detection; primarily for advanced tuners. If too high, only the very peaks will be included, if too low, noise may clutter peak detection.
- "threshold" value for peak detection, which, when divided by 10, is the multiple by which one bin must exceed the previous one for peak detection to commence. If too low, FFT detection becomes more random, if too high, no peaks are detected.
This commit is contained in:
ctzsnooze 2018-08-05 17:51:28 +10:00
parent 40a4ab77fe
commit 1e960c95eb
7 changed files with 179 additions and 65 deletions

View file

@ -58,6 +58,11 @@ typedef enum {
GYRO_OVERFLOW_CHECK_ALL_AXES
} gyroOverflowCheck_e;
enum {
DYN_FILTER_BEFORE_STATIC_FILTERS = 0,
DYN_FILTER_AFTER_STATIC_FILTERS
} ;
#define GYRO_CONFIG_USE_GYRO_1 0
#define GYRO_CONFIG_USE_GYRO_2 1
#define GYRO_CONFIG_USE_GYRO_BOTH 2
@ -96,8 +101,12 @@ typedef struct gyroConfig_s {
int16_t yaw_spin_threshold;
uint16_t gyroCalibrationDuration; // Gyro calibration duration in 1/100 second
uint8_t dyn_filter_type;
uint8_t dyn_filter_width_percent;
uint8_t dyn_notch_quality; // bandpass quality factor, 100 for steep sided bandpass
uint8_t dyn_notch_width_percent;
uint8_t dyn_filter_location; // before or after static filters
uint8_t dyn_filter_threshold; // divided by 10 then difference needed to detect peak
uint8_t dyn_filter_ignore; // ignore any FFT bin below this threshold
} gyroConfig_t;
PG_DECLARE(gyroConfig_t, gyroConfig);