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

Simplify and improve Dynamic Notch

Remove prevCenterFreq[axis]
Simpler peak detection:
- cubes, not squares
- only look one bin either side
More accurate frequency determination
Updated annotations and explanations
Whitespace fixes
fftStartBin can't be less than 1
Dynamic PT1 smoothing
biquad filter on centerFreq removed
centerFreq's now floats

Limits and better min max logic

constrain within nyquist limits

If gyro rate was 2khz and dynamic notch range max, this will keep the notch max to 960hz.

Simple fixes

Get lowest min above and below the peak

First go at setting DN range by a maxHz

increment the PG version in gyro.c

MSP correct size

Resolve comments from Mike and Rav.

Fis msp, deprecating range
This commit is contained in:
ctzsnooze 2019-12-31 12:28:38 +11:00 committed by mikeller
parent 6497830a1b
commit 7b2e075b3a
9 changed files with 165 additions and 161 deletions

View file

@ -157,7 +157,7 @@ static void gyroInitLowpassFilterLpf(int slot, int type, uint16_t lpfHz);
#define GYRO_OVERFLOW_TRIGGER_THRESHOLD 31980 // 97.5% full scale (1950dps for 2000dps gyro)
#define GYRO_OVERFLOW_RESET_THRESHOLD 30340 // 92.5% full scale (1850dps for 2000dps gyro)
PG_REGISTER_WITH_RESET_FN(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 7);
PG_REGISTER_WITH_RESET_FN(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 8);
#ifndef GYRO_CONFIG_USE_GYRO_DEFAULT
#define GYRO_CONFIG_USE_GYRO_DEFAULT GYRO_CONFIG_USE_GYRO_1
@ -193,7 +193,7 @@ void pgResetFn_gyroConfig(gyroConfig_t *gyroConfig)
gyroConfig->yaw_spin_threshold = 1950;
gyroConfig->dyn_lpf_gyro_min_hz = 200;
gyroConfig->dyn_lpf_gyro_max_hz = 500;
gyroConfig->dyn_notch_range = DYN_NOTCH_RANGE_MEDIUM;
gyroConfig->dyn_notch_max_hz = 600;
gyroConfig->dyn_notch_width_percent = 8;
gyroConfig->dyn_notch_q = 120;
gyroConfig->dyn_notch_min_hz = 150;