mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
improve code efficiency
This commit is contained in:
parent
891b47e11e
commit
5112b66a0f
1 changed files with 2 additions and 2 deletions
|
@ -106,7 +106,7 @@ FAST_CODE_NOINLINE float applyFfLimit(int axis, float value, float Kp, float cur
|
|||
DEBUG_SET(DEBUG_FF_LIMIT, 1, value);
|
||||
}
|
||||
|
||||
if (ffMaxRateLimit[axis] && (axis < FD_YAW)) {
|
||||
if (ffMaxRateLimit[axis]) {
|
||||
if (fabsf(currentPidSetpoint) <= ffMaxRateLimit[axis]) {
|
||||
value = constrainf(value, (-ffMaxRateLimit[axis] - currentPidSetpoint) * Kp, (ffMaxRateLimit[axis] - currentPidSetpoint) * Kp);
|
||||
} else {
|
||||
|
@ -121,7 +121,7 @@ FAST_CODE_NOINLINE float applyFfLimit(int axis, float value, float Kp, float cur
|
|||
|
||||
bool shouldApplyFfLimits(int axis)
|
||||
{
|
||||
return ffMaxRateLimit[axis] != 0.0f;
|
||||
return ffMaxRateLimit[axis] != 0.0f && axis < FD_YAW;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue