Rename variables
Renamed inputValue/absRc to rcCommandf/rcCommandfAbs to be consistent with betaflight code. Moved scaling of inputValue. Removed rcInput.10.5.x-maintenance
parent
96af69ae45
commit
76be4006a4
|
@ -87,11 +87,12 @@ RateCurve.prototype.rcCommandRawToDegreesPerSecond = function (rcData, rate, rcR
|
||||||
rcRate = rcRate + (rcRate - 2) * 14.54;
|
rcRate = rcRate + (rcRate - 2) * 14.54;
|
||||||
}
|
}
|
||||||
|
|
||||||
var inputValue = this.rcCommand(rcData, rcRate, deadband);
|
|
||||||
var maxRc = 500 * rcRate;
|
var maxRc = 500 * rcRate;
|
||||||
var absRc = Math.abs(inputValue) / maxRc;
|
var rcCommandf = this.rcCommand(rcData, rcRate, deadband) / maxRc;
|
||||||
|
var rcCommandfAbs = Math.abs(rcCommandf);
|
||||||
var expoPower;
|
var expoPower;
|
||||||
var rcRateConstant;
|
var rcRateConstant;
|
||||||
|
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||||
expoPower = 3;
|
expoPower = 3;
|
||||||
rcRateConstant = 200;
|
rcRateConstant = 200;
|
||||||
|
@ -101,17 +102,15 @@ RateCurve.prototype.rcCommandRawToDegreesPerSecond = function (rcData, rate, rcR
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcExpo > 0) {
|
if (rcExpo > 0) {
|
||||||
inputValue = inputValue * Math.pow(absRc, expoPower) * rcExpo + inputValue * (1-rcExpo);
|
rcCommandf = rcCommandf * Math.pow(rcCommandfAbs, expoPower) * rcExpo + rcCommandf * (1-rcExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
var rcInput = inputValue / maxRc;
|
|
||||||
|
|
||||||
if (superExpoActive) {
|
if (superExpoActive) {
|
||||||
var rcFactor = 1 / this.constrain(1 - absRc * rate, 0.01, 1);
|
var rcFactor = 1 / this.constrain(1 - rcCommandfAbs * rate, 0.01, 1);
|
||||||
angleRate = rcRateConstant * rcRate * rcInput; // 200 should be variable checked on version (older versions it's 205,9)
|
angleRate = rcRateConstant * rcRate * rcCommandf; // 200 should be variable checked on version (older versions it's 205,9)
|
||||||
angleRate = angleRate * rcFactor;
|
angleRate = angleRate * rcFactor;
|
||||||
} else {
|
} else {
|
||||||
angleRate = (((rate * 100) + 27) * inputValue / 16) / 4.1; // Only applies to old versions ?
|
angleRate = (((rate * 100) + 27) * rcCommandf / 16) / 4.1; // Only applies to old versions ?
|
||||||
}
|
}
|
||||||
|
|
||||||
angleRate = this.constrain(angleRate, -1998, 1998); // Rate limit protection
|
angleRate = this.constrain(angleRate, -1998, 1998); // Rate limit protection
|
||||||
|
|
Loading…
Reference in New Issue