Fix erratic behaviour when disabled dterm_cut_hz

This commit is contained in:
borisbstyle 2015-12-20 14:01:38 +01:00
parent 360141ef22
commit 6a64c196b9
1 changed files with 2 additions and 2 deletions

View File

@ -193,7 +193,7 @@ static void pidLuxFloat(pidProfile_t *pidProfile, controlRateConfig_t *controlRa
// would be scaled by different dt each time. Division by dT fixes that.
delta *= (1.0f / dT);
if (!pidProfile->gyro_soft_lpf) {
if (!pidProfile->dterm_cut_hz) {
// add moving average here to reduce noise
deltaSum = (delta1[axis] + delta2[axis] + delta) / 3;
delta2[axis] = delta1[axis];
@ -336,7 +336,7 @@ static void pidRewrite(pidProfile_t *pidProfile, controlRateConfig_t *controlRat
// would be scaled by different dt each time. Division by dT fixes that.
delta = (delta * ((uint16_t) 0xFFFF / ((uint16_t)targetLooptime >> 4))) >> 6;
if (!pidProfile->gyro_soft_lpf) {
if (!pidProfile->dterm_cut_hz) {
// add moving average here to reduce noise
deltaSum = delta1[axis] + delta2[axis] + delta;
delta2[axis] = delta1[axis];