Fix Curve formula

10.3.x-maintenance
U-DESKTOP-12PPI61\boris.bozic 2016-09-06 01:17:30 +02:00
parent 1da5219bf2
commit 25954b3d14
1 changed files with 7 additions and 1 deletions

View File

@ -71,8 +71,14 @@ RateCurve.prototype.rcCommandRawToDegreesPerSecond = function (rcData, rate, rcR
var maxRc = 500 * rcRate;
if (rcExpo > 0) {
var expoPower;
var absRc = Math.abs(inputValue) / maxRc;
inputValue = inputValue * ((rcExpo * absRc * absRc * absRc) + absRc * (1-rcExpo)); // absRc should be wrapped in function using expo power
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) { // Configurable in the future
expoPower = 3;
} else {
expoPower = 2;
}
inputValue = inputValue * Math.pow(absRc, expoPower) * rcExpo + inputValue * (1-rcExpo);
}
var rcInput = inputValue / maxRc;