1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-20 23:05:15 +03:00

Fix D values when Dmin disabled

This commit is contained in:
Asizon 2020-04-03 12:56:47 +02:00
parent 1bb4a16bd3
commit a9c2184976

View file

@ -49,7 +49,7 @@ TuningSliders.setDMinFeatureEnabled = function(dMinFeatureEnabled) {
if (this.dMinFeatureEnabled) {
this.defaultPDRatio = this.PID_DEFAULT[0] / this.PID_DEFAULT[2];
} else {
this.defaultPDRatio = this.PID_DEFAULT[0] / this.PID_DEFAULT[3];
this.defaultPDRatio = this.PID_DEFAULT[0] / (this.PID_DEFAULT[2] * 0.85);
}
};
@ -88,7 +88,7 @@ TuningSliders.initPidSlidersPosition = function() {
if (this.dMinFeatureEnabled) {
this.PDGainSliderValue = Math.round(ADVANCED_TUNING.dMinRoll / this.MasterSliderValue / this.PID_DEFAULT[3] * 10) / 10;
} else {
this.PDGainSliderValue = Math.round(PIDs[0][2] / this.MasterSliderValue / this.PID_DEFAULT[3] * 10) / 10;
this.PDGainSliderValue = Math.round(PIDs[0][2] / this.MasterSliderValue / (this.PID_DEFAULT[2] * 0.85) * 10) / 10;
}
this.ResponseSliderValue = Math.round(ADVANCED_TUNING.feedforwardRoll / this.MasterSliderValue / this.PID_DEFAULT[4] * 10) / 10;
@ -258,8 +258,8 @@ TuningSliders.calculateNewPids = function() {
} else {
ADVANCED_TUNING.dMinRoll = 0;
ADVANCED_TUNING.dMinPitch = 0;
PIDs[0][2] = Math.round(this.PID_DEFAULT[3] * this.PDGainSliderValue);
PIDs[1][2] = Math.round(this.PID_DEFAULT[8] * this.PDGainSliderValue);
PIDs[0][2] = Math.round((this.PID_DEFAULT[2] * 0.85) * this.PDGainSliderValue);
PIDs[1][2] = Math.round((this.PID_DEFAULT[7] * 0.85) * this.PDGainSliderValue);
}
PIDs[2][0] = Math.round(this.PID_DEFAULT[10] * this.PDGainSliderValue);