1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Convert Notch Q to BW

This commit is contained in:
borisbstyle 2016-08-03 20:56:37 +02:00
parent 771feb8fde
commit cc7ea13e66
8 changed files with 22 additions and 14 deletions

View file

@ -114,7 +114,10 @@ void initFilters(const pidProfile_t *pidProfile) {
int axis;
if (pidProfile->dterm_notch_hz && !dtermNotchInitialised) {
for (axis = 0; axis < 3; axis++) biquadFilterInit(&dtermFilterNotch[axis], pidProfile->dterm_notch_hz, gyro.targetLooptime, ((float) pidProfile->dterm_notch_q) / 10, FILTER_NOTCH);
float octaves = log2f(((float) pidProfile->dterm_notch_hz + pidProfile->dterm_notch_bw / 2) / ((float) pidProfile->dterm_notch_hz - pidProfile->dterm_notch_bw / 2));
float dtermNotchQ = sqrtf(powf(2, octaves)) / (powf(2, octaves) - 1);
for (axis = 0; axis < 3; axis++) biquadFilterInit(&dtermFilterNotch[axis], pidProfile->dterm_notch_hz, gyro.targetLooptime, dtermNotchQ, FILTER_NOTCH);
}
if (pidProfile->dterm_filter_type == FILTER_BIQUAD) {