Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix simple Dterm diferentiator #4538

Merged
merged 4 commits into from
Mar 27, 2019
Merged

Conversation

DzikuVx
Copy link
Member

@DzikuVx DzikuVx commented Mar 24, 2019

FIR has to be inited and buffer initialized in case user changes FIR from OFF to ON. Other option is to have dummy function pointers or listeners in MSP and CLI to init it before PID loop is executed. Let's assume this is fine for now

@DzikuVx DzikuVx changed the title Fix FIR init Fix simple Dterm diferentiator Mar 24, 2019
src/main/flight/pid.c Outdated Show resolved Hide resolved
dtermCoeffs[3] = 0.0f;
dtermCoeffs[4] = 0.0f;
}

for (int axis = 0; axis < 3; ++ axis) {
firFilterInit(&pidState[axis].gyroRateFilter, pidState[axis].gyroRateBuf, PID_GYRO_RATE_BUF_LENGTH, dtermCoeffs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of !use_dterm_fir_filter we can use length of 2 instead of PID_GYRO_RATE_BUF_LENGTH

@DzikuVx
Copy link
Member Author

DzikuVx commented Mar 27, 2019

OK, I'm merging as it is. Those 3 floats could be saved but overhead of managing buffer length at runtime in CLI and MSP seems like an overkill

@DzikuVx DzikuVx added this to the 2.2 milestone Mar 27, 2019
@DzikuVx DzikuVx merged commit 3ce7879 into development Mar 27, 2019
@DzikuVx DzikuVx deleted the dzikuvx-fix-dterm-fir-init branch March 27, 2019 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants