mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-20 14:55:15 +03:00
Merge pull request #1949 from Asizon/fixDValues
Fix D values when Dmin disabled and autoadjust, coordination with new Dmin values
This commit is contained in:
commit
a74701aafe
2 changed files with 13 additions and 4 deletions
|
@ -26,6 +26,10 @@ var TuningSliders = {
|
||||||
|
|
||||||
TuningSliders.initialize = function() {
|
TuningSliders.initialize = function() {
|
||||||
this.PID_DEFAULT = FC.getPidDefaults();
|
this.PID_DEFAULT = FC.getPidDefaults();
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
|
||||||
|
this.PID_DEFAULT[3] = 23;
|
||||||
|
this.PID_DEFAULT[8] = 25;
|
||||||
|
}
|
||||||
this.FILTER_DEFAULT = FC.getFilterDefaults();
|
this.FILTER_DEFAULT = FC.getFilterDefaults();
|
||||||
|
|
||||||
this.setDMinFeatureEnabled($('#dMinSwitch').is(':checked'));
|
this.setDMinFeatureEnabled($('#dMinSwitch').is(':checked'));
|
||||||
|
@ -49,7 +53,7 @@ TuningSliders.setDMinFeatureEnabled = function(dMinFeatureEnabled) {
|
||||||
if (this.dMinFeatureEnabled) {
|
if (this.dMinFeatureEnabled) {
|
||||||
this.defaultPDRatio = this.PID_DEFAULT[0] / this.PID_DEFAULT[2];
|
this.defaultPDRatio = this.PID_DEFAULT[0] / this.PID_DEFAULT[2];
|
||||||
} else {
|
} 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 +92,7 @@ TuningSliders.initPidSlidersPosition = function() {
|
||||||
if (this.dMinFeatureEnabled) {
|
if (this.dMinFeatureEnabled) {
|
||||||
this.PDGainSliderValue = Math.round(ADVANCED_TUNING.dMinRoll / this.MasterSliderValue / this.PID_DEFAULT[3] * 10) / 10;
|
this.PDGainSliderValue = Math.round(ADVANCED_TUNING.dMinRoll / this.MasterSliderValue / this.PID_DEFAULT[3] * 10) / 10;
|
||||||
} else {
|
} 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;
|
this.ResponseSliderValue = Math.round(ADVANCED_TUNING.feedforwardRoll / this.MasterSliderValue / this.PID_DEFAULT[4] * 10) / 10;
|
||||||
|
|
||||||
|
@ -258,8 +262,8 @@ TuningSliders.calculateNewPids = function() {
|
||||||
} else {
|
} else {
|
||||||
ADVANCED_TUNING.dMinRoll = 0;
|
ADVANCED_TUNING.dMinRoll = 0;
|
||||||
ADVANCED_TUNING.dMinPitch = 0;
|
ADVANCED_TUNING.dMinPitch = 0;
|
||||||
PIDs[0][2] = Math.round(this.PID_DEFAULT[3] * this.PDGainSliderValue);
|
PIDs[0][2] = Math.round((this.PID_DEFAULT[2] * 0.85) * this.PDGainSliderValue);
|
||||||
PIDs[1][2] = Math.round(this.PID_DEFAULT[8] * 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);
|
PIDs[2][0] = Math.round(this.PID_DEFAULT[10] * this.PDGainSliderValue);
|
||||||
|
|
||||||
|
|
|
@ -479,6 +479,11 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$('.pid_tuning input[name="dMinRoll"]').val(Math.min(Math.round($('.pid_tuning .ROLL input[name="d"]').val() * 0.57), 100));
|
$('.pid_tuning input[name="dMinRoll"]').val(Math.min(Math.round($('.pid_tuning .ROLL input[name="d"]').val() * 0.57), 100));
|
||||||
$('.pid_tuning input[name="dMinPitch"]').val(Math.min(Math.round($('.pid_tuning .PITCH input[name="d"]').val() * 0.57), 100));
|
$('.pid_tuning input[name="dMinPitch"]').val(Math.min(Math.round($('.pid_tuning .PITCH input[name="d"]').val() * 0.57), 100));
|
||||||
$('.pid_tuning input[name="dMinYaw"]').val(Math.min(Math.round($('.pid_tuning .YAW input[name="d"]').val() * 0.57), 100));
|
$('.pid_tuning input[name="dMinYaw"]').val(Math.min(Math.round($('.pid_tuning .YAW input[name="d"]').val() * 0.57), 100));
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.43.0")) {
|
||||||
|
$('.pid_tuning input[name="dMinRoll"]').val(Math.min(Math.round($('.pid_tuning .ROLL input[name="d"]').val() * 0.65), 100));
|
||||||
|
$('.pid_tuning input[name="dMinPitch"]').val(Math.min(Math.round($('.pid_tuning .PITCH input[name="d"]').val() * 0.65), 100));
|
||||||
|
$('.pid_tuning input[name="dMinYaw"]').val(Math.min(Math.round($('.pid_tuning .YAW input[name="d"]').val() * 0.65), 100));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('.pid_tuning input[name="dMinRoll"]').val(ADVANCED_TUNING.dMinRoll);
|
$('.pid_tuning input[name="dMinRoll"]').val(ADVANCED_TUNING.dMinRoll);
|
||||||
$('.pid_tuning input[name="dMinPitch"]').val(ADVANCED_TUNING.dMinPitch);
|
$('.pid_tuning input[name="dMinPitch"]').val(ADVANCED_TUNING.dMinPitch);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue