Simplified code path in fc_rc. (#5536)

This commit is contained in:
Michael Keller 2018-03-25 22:35:30 +13:00 committed by GitHub
parent 9edce2359a
commit 71cd500b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -311,16 +311,14 @@ void updateRcCommands(void)
if (feature(FEATURE_3D)) { if (feature(FEATURE_3D)) {
tmp = constrain(rcData[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX); tmp = constrain(rcData[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX);
tmp = (uint32_t)(tmp - PWM_RANGE_MIN); tmp = (uint32_t)(tmp - PWM_RANGE_MIN);
if (getLowVoltageCutoff()->enabled) {
tmp = tmp * getLowVoltageCutoff()->percentage / 100;
}
} else { } else {
tmp = constrain(rcData[THROTTLE], rxConfig()->mincheck, PWM_RANGE_MAX); tmp = constrain(rcData[THROTTLE], rxConfig()->mincheck, PWM_RANGE_MAX);
tmp = (uint32_t)(tmp - rxConfig()->mincheck) * PWM_RANGE_MIN / (PWM_RANGE_MAX - rxConfig()->mincheck); tmp = (uint32_t)(tmp - rxConfig()->mincheck) * PWM_RANGE_MIN / (PWM_RANGE_MAX - rxConfig()->mincheck);
}
if (getLowVoltageCutoff()->enabled) { if (getLowVoltageCutoff()->enabled) {
tmp = tmp * getLowVoltageCutoff()->percentage / 100; tmp = tmp * getLowVoltageCutoff()->percentage / 100;
} }
}
rcCommand[THROTTLE] = rcLookupThrottle(tmp); rcCommand[THROTTLE] = rcLookupThrottle(tmp);