mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
Handle expert settings
reduce code Add props Allow changing mode without save inbetween Fix affecting touching slider
This commit is contained in:
parent
3feefcb184
commit
348198d9be
5 changed files with 121 additions and 47 deletions
|
@ -2006,7 +2006,7 @@
|
||||||
"description": "Pidtuning slider mode can be OFF, RP or RPY"
|
"description": "Pidtuning slider mode can be OFF, RP or RPY"
|
||||||
},
|
},
|
||||||
"pidTuningSliderModeHelp": {
|
"pidTuningSliderModeHelp": {
|
||||||
"message": "<strong>Pid Tuning Slider Mode</strong><br><br>Pidtuning slider mode can be:<br><br>• OFF - no sliders, enter values manually<br>• RP - sliders control Roll and Pitch only, enter Yaw values manually<br>• RPY - sliders control all PID values<br><br><strong class=\"message-negative\">Important:</strong><br><br>Please save after changing slider mode before changing other settings."
|
"message": "<strong>Pid Tuning Slider Mode</strong><br><br>Pidtuning slider mode can be:<br><br>• OFF - no sliders, enter values manually<br>• RP - sliders control Roll and Pitch only, enter Yaw values manually<br>• RPY - sliders control all PID values<br><br><span class=\"message-negative\"><b>Warning:</b></span>Going from RP to RPY mode will overwrite Yaw settings with firmware settings."
|
||||||
},
|
},
|
||||||
|
|
||||||
"receiverThrottleMid": {
|
"receiverThrottleMid": {
|
||||||
|
@ -3654,6 +3654,10 @@
|
||||||
"message": "<strong>Note:</strong> Sliders range is restricted because you are not in expert mode. This range should be suitable for most builds and beginners.",
|
"message": "<strong>Note:</strong> Sliders range is restricted because you are not in expert mode. This range should be suitable for most builds and beginners.",
|
||||||
"description": "Firmware filter sliders restricted message"
|
"description": "Firmware filter sliders restricted message"
|
||||||
},
|
},
|
||||||
|
"pidTuningSlidersExpertSettingsDetectedNote": {
|
||||||
|
"message": "<span class=\"message-negative\">CAUTION</span>: expert settings detected while in non-expert mode. Please enable Expert Mode to be able to make affected sliders accessible again.",
|
||||||
|
"desciption": "Slider expert settings detected while in non-expert mode"
|
||||||
|
},
|
||||||
"pidTuningSliderLow": {
|
"pidTuningSliderLow": {
|
||||||
"message": "Low",
|
"message": "Low",
|
||||||
"description": "Tuning Slider Low header"
|
"description": "Tuning Slider Low header"
|
||||||
|
|
|
@ -251,6 +251,11 @@
|
||||||
text-align: right;
|
text-align: right;
|
||||||
border: 1px solid var(--subtleAccent);
|
border: 1px solid var(--subtleAccent);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-pid_tuning .subtab-pid table input:disabled {
|
||||||
|
background-color: #dddddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-pid_tuning .subtab-filter table input,
|
.tab-pid_tuning .subtab-filter table input,
|
||||||
|
@ -838,7 +843,8 @@
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-pid_tuning .nonExpertModeSlidersNote {
|
.tab-pid_tuning .nonExpertModeSlidersNote,
|
||||||
|
.tab-pid_tuning .expertSettingsDetectedNote {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
|
|
|
@ -45,7 +45,7 @@ const D_MIN_RATIO = 0.85;
|
||||||
|
|
||||||
TuningSliders.saveInitialSettings = function () {
|
TuningSliders.saveInitialSettings = function () {
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
this.initialSettings.sliderPidsModeSelect = FC.TUNING_SLIDERS.slider_pids_mode;
|
this.initialSettings.sliderPidsMode = FC.TUNING_SLIDERS.slider_pids_mode;
|
||||||
this.initialSettings.sliderDGain = FC.TUNING_SLIDERS.slider_d_gain / 100;
|
this.initialSettings.sliderDGain = FC.TUNING_SLIDERS.slider_d_gain / 100;
|
||||||
this.initialSettings.sliderPIGain = FC.TUNING_SLIDERS.slider_pi_gain / 100;
|
this.initialSettings.sliderPIGain = FC.TUNING_SLIDERS.slider_pi_gain / 100;
|
||||||
this.initialSettings.sliderFeedforwardGain = FC.TUNING_SLIDERS.slider_feedforward_gain / 100;
|
this.initialSettings.sliderFeedforwardGain = FC.TUNING_SLIDERS.slider_feedforward_gain / 100;
|
||||||
|
@ -63,7 +63,7 @@ TuningSliders.saveInitialSettings = function () {
|
||||||
|
|
||||||
TuningSliders.restoreInitialSettings = function () {
|
TuningSliders.restoreInitialSettings = function () {
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
FC.TUNING_SLIDERS.slider_pids_mode = this.initialSettings.sliderPidsModeSelect;
|
FC.TUNING_SLIDERS.slider_pids_mode = this.initialSettings.sliderPidsMode;
|
||||||
|
|
||||||
FC.TUNING_SLIDERS.slider_d_gain = Math.round(this.initialSettings.sliderDGain * 20) * 5;
|
FC.TUNING_SLIDERS.slider_d_gain = Math.round(this.initialSettings.sliderDGain * 20) * 5;
|
||||||
FC.TUNING_SLIDERS.slider_pi_gain = Math.round(this.initialSettings.sliderPIGain * 20) * 5;
|
FC.TUNING_SLIDERS.slider_pi_gain = Math.round(this.initialSettings.sliderPIGain * 20) * 5;
|
||||||
|
@ -126,17 +126,68 @@ TuningSliders.initialize = function() {
|
||||||
this.updateFilterSlidersDisplay();
|
this.updateFilterSlidersDisplay();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TuningSliders.updateExpertModeSlidersDisplay = function() {
|
||||||
|
const NON_EXPERT_SLIDER_MIN = 70;
|
||||||
|
const NON_EXPERT_SLIDER_MAX = 140;
|
||||||
|
const NON_EXPERT_SLIDER_MIN_GYRO = 50;
|
||||||
|
const NON_EXPERT_SLIDER_MAX_GYRO = 150;
|
||||||
|
const NON_EXPERT_SLIDER_MIN_DTERM = 80;
|
||||||
|
const NON_EXPERT_SLIDER_MAX_DTERM = 120;
|
||||||
|
|
||||||
|
const dGain = FC.TUNING_SLIDERS.slider_d_gain < NON_EXPERT_SLIDER_MIN || FC.TUNING_SLIDERS.slider_d_gain > NON_EXPERT_SLIDER_MAX;
|
||||||
|
const piGain = FC.TUNING_SLIDERS.slider_pi_gain < NON_EXPERT_SLIDER_MIN || FC.TUNING_SLIDERS.slider_pi_gain > NON_EXPERT_SLIDER_MAX;
|
||||||
|
const ffGain = FC.TUNING_SLIDERS.slider_feedforward_gain < NON_EXPERT_SLIDER_MIN || FC.TUNING_SLIDERS.slider_feedforward_gain > NON_EXPERT_SLIDER_MAX;
|
||||||
|
|
||||||
|
const dMaxGain = FC.TUNING_SLIDERS.slider_dmax_gain !== FC.DEFAULT_TUNING_SLIDERS.slider_dmax_gain;
|
||||||
|
const iGain = FC.TUNING_SLIDERS.slider_i_gain !== FC.DEFAULT_TUNING_SLIDERS.slider_i_gain;
|
||||||
|
const rpRatio = FC.TUNING_SLIDERS.slider_roll_pitch_ratio !== FC.DEFAULT_TUNING_SLIDERS.slider_roll_pitch_ratio;
|
||||||
|
const rpIGain = FC .TUNING_SLIDERS.slider_pitch_pi_gain !== FC.DEFAULT_TUNING_SLIDERS.slider_pitch_pi_gain;
|
||||||
|
const master = FC.TUNING_SLIDERS.slider_master_multiplier !== FC.DEFAULT_TUNING_SLIDERS.slider_master_multiplier;
|
||||||
|
|
||||||
|
const gyro = FC.TUNING_SLIDERS.slider_gyro_filter_multiplier < NON_EXPERT_SLIDER_MIN_GYRO || FC.TUNING_SLIDERS.slider_gyro_filter_multiplier > NON_EXPERT_SLIDER_MAX_GYRO;
|
||||||
|
const dterm = FC.TUNING_SLIDERS.slider_dterm_filter_multiplier < NON_EXPERT_SLIDER_MIN_DTERM || FC.TUNING_SLIDERS.slider_dterm_filter_multiplier > NON_EXPERT_SLIDER_MAX_DTERM;
|
||||||
|
|
||||||
|
const basic = dGain || piGain || ffGain;
|
||||||
|
const advanced = dMaxGain || iGain || rpRatio || rpIGain || master;
|
||||||
|
|
||||||
|
$('#sliderDGain').prop('disabled', dGain && !this.expertMode);
|
||||||
|
$('#sliderPIGain').prop('disabled', piGain && !this.expertMode);
|
||||||
|
$('#sliderFeedforwardGain').prop('disabled', ffGain && !this.expertMode);
|
||||||
|
|
||||||
|
$('#sliderDMaxGain').prop('disabled', !this.expertMode);
|
||||||
|
$('#sliderIGain').prop('disabled', !this.expertMode);
|
||||||
|
$('#sliderRollPitchRatio').prop('disabled', !this.expertMode);
|
||||||
|
$('#sliderPitchPIGain').prop('disabled', !this.expertMode);
|
||||||
|
$('#sliderMasterMultiplier').prop('disabled', !this.expertMode);
|
||||||
|
|
||||||
|
$('#sliderGyroFilterMultiplier').prop('disabled', gyro && !this.expertMode);
|
||||||
|
$('#sliderDTermFilterMultiplier').prop('disabled', dterm && !this.expertMode);
|
||||||
|
|
||||||
|
$('.baseSliderDGain').toggleClass('disabledSliders', dGain && !this.expertMode);
|
||||||
|
$('.baseSliderPIGain').toggleClass('disabledSliders', piGain && !this.expertMode);
|
||||||
|
$('.baseSliderFeedforwardGain').toggleClass('disabledSliders', ffGain && !this.expertMode);
|
||||||
|
|
||||||
|
$('.advancedSlider').toggleClass('disabledSliders', !this.expertMode);
|
||||||
|
|
||||||
|
$('.sliderGyroFilter').toggleClass('disabledSliders', gyro && !this.expertMode);
|
||||||
|
$('.sliderDtermFilter').toggleClass('disabledSliders', dterm && !this.expertMode);
|
||||||
|
|
||||||
|
$('.advancedSliderDmaxGain').toggle(dMaxGain || this.expertMode);
|
||||||
|
$('.advancedSliderIGain').toggle(iGain || this.expertMode);
|
||||||
|
$('.advancedSliderRollPitchRatio').toggle(rpRatio || this.expertMode);
|
||||||
|
$('.advancedSliderPitchPIGain').toggle(rpIGain || this.expertMode);
|
||||||
|
$('.advancedSliderMaster').toggle(master || this.expertMode);
|
||||||
|
|
||||||
|
$('.expertSettingsDetectedNote').toggle((basic || advanced) && !this.expertMode);
|
||||||
|
};
|
||||||
|
|
||||||
TuningSliders.setExpertMode = function(expertModeEnabled) {
|
TuningSliders.setExpertMode = function(expertModeEnabled) {
|
||||||
this.expertMode = expertModeEnabled;
|
this.expertMode = expertModeEnabled;
|
||||||
|
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
document.getElementById('sliderDMaxGain').disabled = !this.expertMode;
|
|
||||||
document.getElementById('sliderIGain').disabled = !this.expertMode;
|
|
||||||
document.getElementById('sliderRollPitchRatio').disabled = !this.expertMode;
|
|
||||||
document.getElementById('sliderPitchPIGain').disabled = !this.expertMode;
|
|
||||||
document.getElementById('sliderMasterMultiplier').disabled = !this.expertMode;
|
|
||||||
|
|
||||||
$('.advancedSlider').toggleClass('disabledSliders', !this.expertMode);
|
this.updateExpertModeSlidersDisplay();
|
||||||
|
|
||||||
$('.tab-pid_tuning .legacySlider').hide();
|
$('.tab-pid_tuning .legacySlider').hide();
|
||||||
$('.legacyNonExpertModeSlidersNote').hide();
|
$('.legacyNonExpertModeSlidersNote').hide();
|
||||||
$('.subtab-pid .nonExpertModeSlidersNote').toggle(!this.pidSlidersUnavailable && !this.expertMode);
|
$('.subtab-pid .nonExpertModeSlidersNote').toggle(!this.pidSlidersUnavailable && !this.expertMode);
|
||||||
|
@ -146,6 +197,7 @@ TuningSliders.setExpertMode = function(expertModeEnabled) {
|
||||||
$('.tab-pid_tuning .baseSlider').hide();
|
$('.tab-pid_tuning .baseSlider').hide();
|
||||||
$('.tab-pid_tuning .advancedSlider').hide();
|
$('.tab-pid_tuning .advancedSlider').hide();
|
||||||
$('.nonExpertModeSlidersNote').hide();
|
$('.nonExpertModeSlidersNote').hide();
|
||||||
|
$('.expertSettingsDetectedNote').hide();
|
||||||
$('.subtab-pid .legacyNonExpertModeSlidersNote').toggle(!this.pidSlidersUnavailable && !this.expertMode);
|
$('.subtab-pid .legacyNonExpertModeSlidersNote').toggle(!this.pidSlidersUnavailable && !this.expertMode);
|
||||||
$('.subtab-filter .legacyNonExpertModeSlidersNote').toggle((!this.GyroSliderUnavailable || !this.DTermSliderUnavailable) && !this.expertMode);
|
$('.subtab-filter .legacyNonExpertModeSlidersNote').toggle((!this.GyroSliderUnavailable || !this.DTermSliderUnavailable) && !this.expertMode);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +448,7 @@ TuningSliders.updatePidSlidersDisplay = function() {
|
||||||
|
|
||||||
let rows = 3;
|
let rows = 3;
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
rows = FC.TUNING_SLIDERS.slider_pids_mode === 1 ? 2 : 3;
|
rows = this.sliderPidsMode === 1 ? 2 : 3;
|
||||||
} else {
|
} else {
|
||||||
this.calculateNewPids(true);
|
this.calculateNewPids(true);
|
||||||
}
|
}
|
||||||
|
@ -494,10 +546,14 @@ TuningSliders.updateFilterSlidersDisplay = function() {
|
||||||
|
|
||||||
TuningSliders.updateFormPids = function(updateSlidersOnly = false) {
|
TuningSliders.updateFormPids = function(updateSlidersOnly = false) {
|
||||||
if (!updateSlidersOnly) {
|
if (!updateSlidersOnly) {
|
||||||
|
let rows = 3;
|
||||||
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
|
rows = this.sliderPidsMode === 1 ? 2 : 3;
|
||||||
|
}
|
||||||
FC.PID_NAMES.forEach(function (elementPid, indexPid) {
|
FC.PID_NAMES.forEach(function (elementPid, indexPid) {
|
||||||
const pidElements = $(`.pid_tuning .${elementPid} input`);
|
const pidElements = $(`.pid_tuning .${elementPid} input`);
|
||||||
pidElements.each(function (indexInput) {
|
pidElements.each(function (indexInput) {
|
||||||
if (indexPid < 3 && indexInput < 3) {
|
if (indexPid < rows && indexInput < rows) {
|
||||||
$(this).val(FC.PIDS[indexPid][indexInput]);
|
$(this).val(FC.PIDS[indexPid][indexInput]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -591,7 +647,7 @@ TuningSliders.calculateNewPids = function(updateSlidersOnly = false) {
|
||||||
// values get set both into forms and their respective variables
|
// values get set both into forms and their respective variables
|
||||||
|
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
FC.TUNING_SLIDERS.slider_pids_mode = parseInt($('#sliderPidsModeSelect').val());
|
FC.TUNING_SLIDERS.slider_pids_mode = this.sliderPidsMode;
|
||||||
//rounds slider values to nearies multiple of 5 and passes to the FW. Avoid dividing calc by (* x 100)/5 = 20
|
//rounds slider values to nearies multiple of 5 and passes to the FW. Avoid dividing calc by (* x 100)/5 = 20
|
||||||
FC.TUNING_SLIDERS.slider_d_gain = Math.round(this.sliderDGain * 20) * 5;
|
FC.TUNING_SLIDERS.slider_d_gain = Math.round(this.sliderDGain * 20) * 5;
|
||||||
FC.TUNING_SLIDERS.slider_pi_gain = Math.round(this.sliderPIGain * 20) * 5;
|
FC.TUNING_SLIDERS.slider_pi_gain = Math.round(this.sliderPIGain * 20) * 5;
|
||||||
|
|
|
@ -630,7 +630,6 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
$('.dMinGroupCheckbox').addClass('switchery-disabled');
|
$('.dMinGroupCheckbox').addClass('switchery-disabled');
|
||||||
$('.dMinDisabledNote').hide();
|
$('.dMinDisabledNote').hide();
|
||||||
self.updateGuiElements();
|
|
||||||
} else {
|
} else {
|
||||||
dMinSwitch.prop('checked', FC.ADVANCED_TUNING.dMinRoll > 0 || FC.ADVANCED_TUNING.dMinPitch > 0 || FC.ADVANCED_TUNING.dMinYaw > 0);
|
dMinSwitch.prop('checked', FC.ADVANCED_TUNING.dMinRoll > 0 || FC.ADVANCED_TUNING.dMinPitch > 0 || FC.ADVANCED_TUNING.dMinYaw > 0);
|
||||||
|
|
||||||
|
@ -668,8 +667,8 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$('.pid_tuning input[name="dMinYaw"]').val(0);
|
$('.pid_tuning input[name="dMinYaw"]').val(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
dMinSwitch.trigger('change');
|
||||||
}
|
}
|
||||||
dMinSwitch.trigger('change');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('input[id="gyroNotch1Enabled"]').change(function() {
|
$('input[id="gyroNotch1Enabled"]').change(function() {
|
||||||
|
@ -861,7 +860,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
// Assign each value
|
// Assign each value
|
||||||
searchRow.each(function (indexInput) {
|
searchRow.each(function (indexInput) {
|
||||||
if ($(this).val()) {
|
if ($(this).val()) {
|
||||||
FC.PIDS[indexPid][indexInput] = parseFloat($(this).val());
|
FC.PIDS[indexPid][indexInput] = parseInt($(this).val());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1806,7 +1805,6 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
&& $(item).attr('class') !== "nonProfile") {
|
&& $(item).attr('class') !== "nonProfile") {
|
||||||
$(item).change(function () {
|
$(item).change(function () {
|
||||||
self.setDirty(true);
|
self.setDirty(true);
|
||||||
self.sliderRetainConfiguration = true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1903,11 +1901,10 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
|
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
if (self.sliderRetainConfiguration) {
|
if (self.sliderRetainConfiguration) {
|
||||||
self.setDirty(true);
|
self.setDirty(true);
|
||||||
} else {
|
} else {
|
||||||
TuningSliders.saveInitialSettings();
|
TuningSliders.saveInitialSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
sliderPidsModeSelect.val(FC.TUNING_SLIDERS.slider_pids_mode);
|
sliderPidsModeSelect.val(FC.TUNING_SLIDERS.slider_pids_mode);
|
||||||
} else {
|
} else {
|
||||||
$('#dMinSwitch').change(function() {
|
$('#dMinSwitch').change(function() {
|
||||||
|
@ -1934,25 +1931,22 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
// trigger Slider Display update when PID mode is changed
|
// trigger Slider Display update when PID mode is changed
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
$('select[id="sliderPidsModeSelect"]').on('change', function () {
|
$('select[id="sliderPidsModeSelect"]').on('change', function () {
|
||||||
const originalMode = TuningSliders.initialSettings.sliderPidsModeSelect;
|
|
||||||
const setMode = parseInt($(this).val());
|
const setMode = parseInt($(this).val());
|
||||||
|
|
||||||
TuningSliders.sliderPidsMode = setMode;
|
TuningSliders.sliderPidsMode = setMode;
|
||||||
|
TuningSliders.calculateNewPids();
|
||||||
|
TuningSliders.updateFormPids();
|
||||||
TuningSliders.updatePidSlidersDisplay();
|
TuningSliders.updatePidSlidersDisplay();
|
||||||
|
|
||||||
const allowRP = originalMode === 0 && setMode === 0;
|
const allowRP = !!setMode;
|
||||||
const allowRPY = originalMode < 2 && originalMode === setMode;
|
const allowY = setMode !== 1;
|
||||||
|
|
||||||
$('#pid_main .ROLL .pid_data input').each(function() {
|
$('#pid_main .ROLL .pid_data input, #pid_main .PITCH .pid_data input').each(function() {
|
||||||
$(this).prop('disabled', !allowRP);
|
$(this).prop('disabled', allowRP);
|
||||||
});
|
|
||||||
|
|
||||||
$('#pid_main .PITCH .pid_data input').each(function() {
|
|
||||||
$(this).prop('disabled', !allowRP);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#pid_main .YAW .pid_data input').each(function() {
|
$('#pid_main .YAW .pid_data input').each(function() {
|
||||||
$(this).prop('disabled', !allowRPY);
|
$(this).prop('disabled', allowY);
|
||||||
});
|
});
|
||||||
}).trigger('change');
|
}).trigger('change');
|
||||||
}
|
}
|
||||||
|
@ -2029,9 +2023,6 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$('.pid_tuning .PITCH input[name="d"]').change();
|
$('.pid_tuning .PITCH input[name="d"]').change();
|
||||||
$('.pid_tuning .YAW input[name="d"]').change();
|
$('.pid_tuning .YAW input[name="d"]').change();
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
TuningSliders.updatePidSlidersDisplay();
|
|
||||||
TuningSliders.updateSlidersWarning();
|
|
||||||
}
|
}
|
||||||
// reset to middle with double click
|
// reset to middle with double click
|
||||||
allPidTuningSliders.dblclick(function() {
|
allPidTuningSliders.dblclick(function() {
|
||||||
|
@ -2079,14 +2070,13 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
slider.val(value);
|
slider.val(value);
|
||||||
|
|
||||||
TuningSliders.calculateNewPids();
|
TuningSliders.calculateNewPids();
|
||||||
TuningSliders.updatePidSlidersDisplay();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// enable PID sliders button
|
// enable PID sliders button
|
||||||
$('a.buttonPidTuningSliders').click(function() {
|
$('a.buttonPidTuningSliders').click(function() {
|
||||||
// set Slider PID mode to RP(Y) when re-enabling Sliders
|
// set Slider PID mode to RP(Y) when re-enabling Sliders
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
const firmwareMode = TuningSliders.initialSettings.sliderPidsModeSelect;
|
const firmwareMode = TuningSliders.initialSettings.sliderPidsMode;
|
||||||
const workingMode = firmwareMode === 1 ? 1 : 2;
|
const workingMode = firmwareMode === 1 ? 1 : 2;
|
||||||
|
|
||||||
if (firmwareMode !== workingMode) {
|
if (firmwareMode !== workingMode) {
|
||||||
|
@ -2200,11 +2190,18 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
|
|
||||||
// update on pid table inputs
|
// update on pid table inputs
|
||||||
$('#pid_main input').on('input', function() {
|
$('#pid_main input').on('input', function() {
|
||||||
TuningSliders.updatePidSlidersDisplay();
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
self.analyticsChanges['PidTuningSliders'] = "Off";
|
self.sliderRetainConfiguration = true;
|
||||||
|
} else {
|
||||||
|
TuningSliders.updatePidSlidersDisplay();
|
||||||
|
self.analyticsChanges['PidTuningSliders'] = "Off";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// update on filter value or type changes
|
// update on filter value or type changes
|
||||||
$('.pid_filter tr:not(.newFilter) input, .pid_filter tr:not(.newFilter) select').on('input', function() {
|
$('.pid_filter tr:not(.newFilter) input, .pid_filter tr:not(.newFilter) select').on('input', function() {
|
||||||
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
|
self.sliderRetainConfiguration = true;
|
||||||
|
}
|
||||||
TuningSliders.updateFilterSlidersDisplay();
|
TuningSliders.updateFilterSlidersDisplay();
|
||||||
if (TuningSliders.GyroSliderUnavailable) {
|
if (TuningSliders.GyroSliderUnavailable) {
|
||||||
self.analyticsChanges['GyroFilterTuningSlider'] = "Off";
|
self.analyticsChanges['GyroFilterTuningSlider'] = "Off";
|
||||||
|
@ -2729,6 +2726,10 @@ TABS.pid_tuning.updateFilterWarning = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
TABS.pid_tuning.updatePIDColors = function(clear = false) {
|
TABS.pid_tuning.updatePIDColors = function(clear = false) {
|
||||||
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const setTuningElementColor = function(element, mspValue, currentValue) {
|
const setTuningElementColor = function(element, mspValue, currentValue) {
|
||||||
if (clear) {
|
if (clear) {
|
||||||
element.css({ "background-color": "transparent" });
|
element.css({ "background-color": "transparent" });
|
||||||
|
|
|
@ -172,7 +172,7 @@
|
||||||
<div id="slidersPidsBox" class="gui_box grey topspacer tuningPIDSliders">
|
<div id="slidersPidsBox" class="gui_box grey topspacer tuningPIDSliders">
|
||||||
<table class="pid_titlebar">
|
<table class="pid_titlebar">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" class="sm-min">
|
<th scope="col" class="sm-min">Mode
|
||||||
<select id="sliderPidsModeSelect" class="sliderMode">
|
<select id="sliderPidsModeSelect" class="sliderMode">
|
||||||
<option value="0">OFF</option>
|
<option value="0">OFF</option>
|
||||||
<option value="1">RP</option>
|
<option value="1">RP</option>
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr class="baseSlider">
|
<tr class="baseSlider baseSliderDGain">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningDGainSlider"></span>
|
<span i18n="pidTuningDGainSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -261,7 +261,7 @@
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningDGainSliderHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningDGainSliderHelp"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="baseSlider">
|
<tr class="baseSlider baseSliderPIGain">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningPIGainSlider"></span>
|
<span i18n="pidTuningPIGainSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -275,7 +275,7 @@
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningPIGainSliderHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningPIGainSliderHelp"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="baseSlider">
|
<tr class="baseSlider baseSliderFeedforwardGain">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningResponseSlider"></span>
|
<span i18n="pidTuningResponseSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -292,7 +292,7 @@
|
||||||
<tr class="advancedSlider">
|
<tr class="advancedSlider">
|
||||||
<td colspan="6" class="sliderDivider"><hr /></td>
|
<td colspan="6" class="sliderDivider"><hr /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="advancedSlider">
|
<tr class="advancedSlider advancedSliderDmaxGain">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningDMaxGainSlider"></span>
|
<span i18n="pidTuningDMaxGainSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -306,7 +306,7 @@
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningDMaxGainSliderHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningDMaxGainSliderHelp"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="advancedSlider">
|
<tr class="advancedSlider advancedSliderIGain">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningIGainSlider"></span>
|
<span i18n="pidTuningIGainSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -320,7 +320,7 @@
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningIGainSliderHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningIGainSliderHelp"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="advancedSlider">
|
<tr class="advancedSlider advancedSliderRollPitchRatio">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningRollPitchRatioSlider"></span>
|
<span i18n="pidTuningRollPitchRatioSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -334,7 +334,7 @@
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningRollPitchRatioSliderHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningRollPitchRatioSliderHelp"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="advancedSlider">
|
<tr class="advancedSlider advancedSliderPitchPIGain">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningPitchPIGainSlider"></span>
|
<span i18n="pidTuningPitchPIGainSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -348,7 +348,7 @@
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningPitchPIGainSliderHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningPitchPIGainSliderHelp"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="advancedSlider">
|
<tr class="advancedSlider advancedSliderMaster">
|
||||||
<td>
|
<td>
|
||||||
<span i18n="pidTuningMasterSlider"></span>
|
<span i18n="pidTuningMasterSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -369,6 +369,9 @@
|
||||||
<div class="gui_box topspacer nonExpertModeSlidersNote">
|
<div class="gui_box topspacer nonExpertModeSlidersNote">
|
||||||
<p i18n="pidTuningPidSlidersNonExpertMode"></p>
|
<p i18n="pidTuningPidSlidersNonExpertMode"></p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="gui_box topspacer expertSettingsDetectedNote">
|
||||||
|
<p i18n="pidTuningSlidersExpertSettingsDetectedNote"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- BARO, MAG, GPS -->
|
<!-- BARO, MAG, GPS -->
|
||||||
<div id="pid_baro_mag_gps" class="pid_optional needed_by_ALT needed_by_VEL needed_by_MAG needed_by_Pos needed_by_PosR needed_by_NavR gui_box grey topspacer pid_tuning">
|
<div id="pid_baro_mag_gps" class="pid_optional needed_by_ALT needed_by_VEL needed_by_MAG needed_by_Pos needed_by_PosR needed_by_NavR gui_box grey topspacer pid_tuning">
|
||||||
|
@ -1139,7 +1142,7 @@
|
||||||
<span i18n="pidTuningGyroFilterSlider"></span>
|
<span i18n="pidTuningGyroFilterSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="sliderGyroFilter">
|
||||||
<td class="sm-min">
|
<td class="sm-min">
|
||||||
<span i18n="pidTuningGyroFilterSlider"></span>
|
<span i18n="pidTuningGyroFilterSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -1158,7 +1161,7 @@
|
||||||
<span i18n="pidTuningDTermFilterSlider"></span>
|
<span i18n="pidTuningDTermFilterSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr class="sliderDtermFilter">
|
||||||
<td class="sm-min">
|
<td class="sm-min">
|
||||||
<span i18n="pidTuningDTermFilterSlider"></span>
|
<span i18n="pidTuningDTermFilterSlider"></span>
|
||||||
</td>
|
</td>
|
||||||
|
@ -1179,6 +1182,10 @@
|
||||||
<p i18n="pidTuningFilterSlidersNonExpertMode"></p>
|
<p i18n="pidTuningFilterSlidersNonExpertMode"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="gui_box topspacer expertSettingsDetectedNote">
|
||||||
|
<p i18n="pidTuningSlidersExpertSettingsDetectedNote"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="cf_column two_columns">
|
<div class="cf_column two_columns">
|
||||||
<div class="gui_box grey topspacer pid_filter two_columns_first">
|
<div class="gui_box grey topspacer pid_filter two_columns_first">
|
||||||
<table class="pid_titlebar new_rates">
|
<table class="pid_titlebar new_rates">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue