1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Calculate maxThrottleDifference before use.

* Easier to understand.
* Reduces code size by 32 bytes.
This commit is contained in:
Dominic Clifton 2015-06-10 12:15:21 +01:00
parent 4e6a268eb5
commit 78b52c53d5

View file

@ -731,11 +731,14 @@ void mixTable(void)
}
}
int16_t maxThrottleDifference = 0;
if (maxMotor > escAndServoConfig->maxthrottle) {
maxThrottleDifference = maxMotor - escAndServoConfig->maxthrottle;
}
for (i = 0; i < motorCount; i++) {
if (maxMotor > escAndServoConfig->maxthrottle) {
// this is a way to still have good gyro corrections if at least one motor reaches its max.
motor[i] -= maxMotor - escAndServoConfig->maxthrottle;
}
// this is a way to still have good gyro corrections if at least one motor reaches its max.
motor[i] -= maxThrottleDifference;
if (feature(FEATURE_3D)) {
if ((rcData[THROTTLE]) > rxConfig->midrc) {