mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Cleanup // Fix some filter inits // More space Naze target
This commit is contained in:
parent
b168b33448
commit
505502e798
6 changed files with 45 additions and 40 deletions
|
@ -109,10 +109,11 @@ static pt1Filter_t yawFilter;
|
|||
static biquadFilter_t dtermFilterLpf[3];
|
||||
static biquadFilter_t dtermFilterNotch[3];
|
||||
static denoisingState_t dtermDenoisingState[3];
|
||||
static bool dtermNotchInitialised, dtermLpfInitialised;
|
||||
static bool dtermNotchInitialised;
|
||||
|
||||
void initFilters(const pidProfile_t *pidProfile) {
|
||||
int axis;
|
||||
static uint8_t lowpassFilterType;
|
||||
|
||||
if (pidProfile->dterm_notch_hz && !dtermNotchInitialised) {
|
||||
float notchQ = filterGetNotchQ(pidProfile->dterm_notch_hz, pidProfile->dterm_notch_cutoff);
|
||||
|
@ -120,18 +121,15 @@ void initFilters(const pidProfile_t *pidProfile) {
|
|||
dtermNotchInitialised = true;
|
||||
}
|
||||
|
||||
if (pidProfile->dterm_filter_type == FILTER_BIQUAD) {
|
||||
if (pidProfile->dterm_lpf_hz && !dtermLpfInitialised) {
|
||||
if ((pidProfile->dterm_filter_type != lowpassFilterType) && pidProfile->dterm_lpf_hz) {
|
||||
if (pidProfile->dterm_filter_type == FILTER_BIQUAD) {
|
||||
for (axis = 0; axis < 3; axis++) biquadFilterInitLPF(&dtermFilterLpf[axis], pidProfile->dterm_lpf_hz, targetPidLooptime);
|
||||
dtermLpfInitialised = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pidProfile->dterm_filter_type == FILTER_DENOISE) {
|
||||
if (pidProfile->dterm_lpf_hz && !dtermLpfInitialised) {
|
||||
if (pidProfile->dterm_filter_type == FILTER_DENOISE) {
|
||||
for (axis = 0; axis < 3; axis++) initDenoisingFilter(&dtermDenoisingState[axis], pidProfile->dterm_lpf_hz, targetPidLooptime);
|
||||
dtermLpfInitialised = true;
|
||||
}
|
||||
lowpassFilterType = pidProfile->dterm_filter_type;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue