1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 05:45:31 +03:00

Merge pull request #5055 from mikeller/fix_rf_rate_calculation

Fixed RaceFlight rates calculation.
This commit is contained in:
Michael Keller 2018-01-30 00:58:45 +13:00 committed by GitHub
commit e3cbff148e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,13 +108,11 @@ float applyBetaflightRates(const int axis, float rcCommandf, const float rcComma
float applyRaceFlightRates(const int axis, float rcCommandf, const float rcCommandfAbs)
{
UNUSED(rcCommandfAbs);
// -1.0 to 1.0 ranged and curved
rcCommandf = ((1.0f + 0.01f * currentControlRateProfile->rcExpo[axis] * (rcCommandf * rcCommandf - 1.0f)) * rcCommandf);
// convert to -2000 to 2000 range using acro+ modifier
float angleRate = 10.0f * currentControlRateProfile->rcRates[axis] * rcCommandf;
angleRate = angleRate * (1 + (float)currentControlRateProfile->rates[axis] * 0.01f);
angleRate = angleRate * (1 + rcCommandfAbs * (float)currentControlRateProfile->rates[axis] * 0.01f);
return angleRate;
}