1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

Merge pull request #8926 from ctzsnooze/exclude-yaw-from-ff_max_rate_limit_PR

exclude yaw from ff_max_rate_limit
This commit is contained in:
Michael Keller 2019-09-23 19:38:56 +12:00 committed by GitHub
commit 564db329b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,31 +98,32 @@ FAST_CODE_NOINLINE float interpolatedSpApply(int axis, bool newRcFrame, ffInterp
}
FAST_CODE_NOINLINE float applyFfLimit(int axis, float value, float Kp, float currentPidSetpoint) {
if (axis == FD_ROLL) {
switch (axis) {
case FD_ROLL:
DEBUG_SET(DEBUG_FF_LIMIT, 0, value);
}
if (axis == FD_ROLL) {
break;
case FD_PITCH:
DEBUG_SET(DEBUG_FF_LIMIT, 1, value);
break;
}
if (ffMaxRateLimit[axis]) {
if (fabsf(currentPidSetpoint) <= ffMaxRateLimit[axis]) {
value = constrainf(value, (-ffMaxRateLimit[axis] - currentPidSetpoint) * Kp, (ffMaxRateLimit[axis] - currentPidSetpoint) * Kp);
} else {
value = 0;
}
}
if (axis == FD_ROLL) {
DEBUG_SET(DEBUG_FF_LIMIT, 2, value);
}
return value;
}
bool shouldApplyFfLimits(int axis)
{
return ffMaxRateLimit[axis] != 0.0f;
return ffMaxRateLimit[axis] != 0.0f && axis < FD_YAW;
}
#endif