mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Smoother Iterm Ignore transition
This commit is contained in:
parent
754982f480
commit
23b0e79eff
2 changed files with 3 additions and 4 deletions
|
@ -184,8 +184,8 @@ static void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
|
|
||||||
pidProfile->yaw_p_limit = YAW_P_LIMIT_MAX;
|
pidProfile->yaw_p_limit = YAW_P_LIMIT_MAX;
|
||||||
pidProfile->yaw_lpf_hz = 80;
|
pidProfile->yaw_lpf_hz = 80;
|
||||||
pidProfile->rollPitchItermIgnoreRate = 900;
|
pidProfile->rollPitchItermIgnoreRate = 200;
|
||||||
pidProfile->yawItermIgnoreRate = 35;
|
pidProfile->yawItermIgnoreRate = 45;
|
||||||
pidProfile->dterm_lpf_hz = 110; // filtering ON by default
|
pidProfile->dterm_lpf_hz = 110; // filtering ON by default
|
||||||
pidProfile->dynamic_pid = 1;
|
pidProfile->dynamic_pid = 1;
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,7 @@ uint16_t getDynamicKi(int axis, const pidProfile_t *pidProfile) {
|
||||||
|
|
||||||
resetRate = (axis == YAW) ? pidProfile->yawItermIgnoreRate : pidProfile->rollPitchItermIgnoreRate;
|
resetRate = (axis == YAW) ? pidProfile->yawItermIgnoreRate : pidProfile->rollPitchItermIgnoreRate;
|
||||||
|
|
||||||
uint32_t dynamicFactor = (1 << 8) - constrain((ABS(gyroADC[axis]) << 6) / resetRate, 0, 1 << 8);
|
uint32_t dynamicFactor = ((resetRate << 16) / (resetRate + ABS(gyroADC[axis]))) >> 8;
|
||||||
|
|
||||||
dynamicKi = (pidProfile->I8[axis] * dynamicFactor) >> 8;
|
dynamicKi = (pidProfile->I8[axis] * dynamicFactor) >> 8;
|
||||||
|
|
||||||
return dynamicKi;
|
return dynamicKi;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue