mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Fix CPU bug due toe reinitialising of filters
This commit is contained in:
parent
f933e316c6
commit
107f09d6e1
2 changed files with 3 additions and 1 deletions
|
@ -249,7 +249,7 @@ static void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
pidProfile->dtermSetpointWeight = 120;
|
pidProfile->dtermSetpointWeight = 120;
|
||||||
pidProfile->yawRateAccelLimit = 220;
|
pidProfile->yawRateAccelLimit = 220;
|
||||||
pidProfile->rateAccelLimit = 0;
|
pidProfile->rateAccelLimit = 0;
|
||||||
pidProfile->toleranceBand = 15;
|
pidProfile->toleranceBand = 0;
|
||||||
pidProfile->toleranceBandReduction = 40;
|
pidProfile->toleranceBandReduction = 40;
|
||||||
pidProfile->zeroCrossAllowanceCount = 2;
|
pidProfile->zeroCrossAllowanceCount = 2;
|
||||||
pidProfile->itermThrottleGain = 0;
|
pidProfile->itermThrottleGain = 0;
|
||||||
|
|
|
@ -114,11 +114,13 @@ void initFilters(const pidProfile_t *pidProfile)
|
||||||
if (pidProfile->dterm_notch_hz && !dtermNotchInitialised) {
|
if (pidProfile->dterm_notch_hz && !dtermNotchInitialised) {
|
||||||
float notchQ = filterGetNotchQ(pidProfile->dterm_notch_hz, pidProfile->dterm_notch_cutoff);
|
float notchQ = filterGetNotchQ(pidProfile->dterm_notch_hz, pidProfile->dterm_notch_cutoff);
|
||||||
for (axis = 0; axis < 3; axis++) biquadFilterInit(&dtermFilterNotch[axis], pidProfile->dterm_notch_hz, gyro.targetLooptime, notchQ, FILTER_NOTCH);
|
for (axis = 0; axis < 3; axis++) biquadFilterInit(&dtermFilterNotch[axis], pidProfile->dterm_notch_hz, gyro.targetLooptime, notchQ, FILTER_NOTCH);
|
||||||
|
dtermNotchInitialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pidProfile->dterm_filter_type == FILTER_BIQUAD) {
|
if (pidProfile->dterm_filter_type == FILTER_BIQUAD) {
|
||||||
if (pidProfile->dterm_lpf_hz && !dtermBiquadLpfInitialised) {
|
if (pidProfile->dterm_lpf_hz && !dtermBiquadLpfInitialised) {
|
||||||
for (axis = 0; axis < 3; axis++) biquadFilterInitLPF(&dtermFilterLpf[axis], pidProfile->dterm_lpf_hz, gyro.targetLooptime);
|
for (axis = 0; axis < 3; axis++) biquadFilterInitLPF(&dtermFilterLpf[axis], pidProfile->dterm_lpf_hz, gyro.targetLooptime);
|
||||||
|
dtermBiquadLpfInitialised = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue