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:
parent
771feb8fde
commit
cc7ea13e66
8 changed files with 22 additions and 14 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue