Dynamic Notch Filter Update
Improves performance of the dynamic notch filter, increasing peak accuracy over a wider band of frequencies, and generally using a narrower, higher notch.
Details:
- FFT now operates on gyro data *after* gyro notches and lowpasses
- FFT bandpass Q changed from 0.707 to 0.05, to 'open up' the FFT to a greater range of incoming frequencies
- FFT centre output now ranges from about 130 to 666Hz.
- ignore the lowest couple of FFT bins going into centre frequency calculation
- analyse FFT bins from low to high, keep ignoring bins until a bin is found that exceeds its previous bin by a factor of 2; then start examining bins from the bin before that (stops the FFT from being biased low, or going to the lowest value if there is no notch at all).
- if no bin exceeds previous by more than 2 times, ie no obvious peak, smoothly go to maximum allowed notch frequency to avoid delay (might be better to bypass filter altogether?)
- dominant bin emphasised by cubing bin height before calculating mean
- maximum cutoff frequency is half the highest allowable centre frequency
- default notch width is +/-25% of centre, narrower than before most of the time
- code tidied up
- thanks to rav, Flint, UAV Tech, icr4sh, diehertz and everyone else who helped with this.