Fix rate curve calculation

Use absRc in rcFactor calculation instead of Math.abs(rcInput)
10.5.x-maintenance
Hans Christian Olaussen 2018-11-20 21:07:43 +01:00 committed by GitHub
parent 27cf3a356b
commit 96af69ae45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -89,7 +89,7 @@ RateCurve.prototype.rcCommandRawToDegreesPerSecond = function (rcData, rate, rcR
var inputValue = this.rcCommand(rcData, rcRate, deadband);
var maxRc = 500 * rcRate;
var absRc = Math.abs(inputValue) / maxRc;
var expoPower;
var rcRateConstant;
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
@ -101,14 +101,13 @@ RateCurve.prototype.rcCommandRawToDegreesPerSecond = function (rcData, rate, rcR
}
if (rcExpo > 0) {
var absRc = Math.abs(inputValue) / maxRc;
inputValue = inputValue * Math.pow(absRc, expoPower) * rcExpo + inputValue * (1-rcExpo);
}
var rcInput = inputValue / maxRc;
if (superExpoActive) {
var rcFactor = 1 / this.constrain(1 - Math.abs(rcInput) * rate, 0.01, 1);
var rcFactor = 1 / this.constrain(1 - absRc * rate, 0.01, 1);
angleRate = rcRateConstant * rcRate * rcInput; // 200 should be variable checked on version (older versions it's 205,9)
angleRate = angleRate * rcFactor;
} else {