From 57ca2bc20dfaaabd568ed720d4551c0e096a1e44 Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Fri, 31 Dec 2021 01:24:42 +0100 Subject: [PATCH] Fix filter Slider Display Fix display when all lowpasses are disabled Fix filter selector Fix PID display fix pid display --- locales/en/messages.json | 2 +- src/js/TuningSliders.js | 133 +++++++++++++++++++++++--------------- src/js/tabs/pid_tuning.js | 67 +++++++++---------- 3 files changed, 114 insertions(+), 88 deletions(-) diff --git a/locales/en/messages.json b/locales/en/messages.json index 34ba1797..fe9ac8d3 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -3771,7 +3771,7 @@ "description": "Firmware filter sliders restricted message" }, "pidTuningSlidersExpertSettingsDetectedNote": { - "message": "CAUTION: expert settings detected while in non-expert mode. Please enable Expert Mode to be able to make affected sliders accessible again.", + "message": "Note: Slider(s) are disabled because current values are outside the Basic Mode adjustment range. Switch to Expert Mode to make changes", "desciption": "Slider expert settings detected while in non-expert mode" }, "pidTuningSliderLow": { diff --git a/src/js/TuningSliders.js b/src/js/TuningSliders.js index 74337e4b..0e28dff5 100644 --- a/src/js/TuningSliders.js +++ b/src/js/TuningSliders.js @@ -32,6 +32,13 @@ const TuningSliders = { FILTER_DEFAULT: {}, SLIDER_DEFAULT: {}, + NON_EXPERT_SLIDER_MIN: 70, + NON_EXPERT_SLIDER_MAX: 140, + NON_EXPERT_SLIDER_MIN_GYRO: 50, + NON_EXPERT_SLIDER_MAX_GYRO: 150, + NON_EXPERT_SLIDER_MIN_DTERM: 80, + NON_EXPERT_SLIDER_MAX_DTERM: 120, + cachedPidSliderValues: false, cachedGyroSliderValues: false, cachedDTermSliderValues: false, @@ -105,58 +112,73 @@ TuningSliders.initialize = function() { } }; -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; +TuningSliders.updateExpertModePidSlidersDisplay = function() { + const dGain = FC.TUNING_SLIDERS.slider_d_gain < this.NON_EXPERT_SLIDER_MIN || FC.TUNING_SLIDERS.slider_d_gain > this.NON_EXPERT_SLIDER_MAX; + const piGain = FC.TUNING_SLIDERS.slider_pi_gain < this.NON_EXPERT_SLIDER_MIN || FC.TUNING_SLIDERS.slider_pi_gain > this.NON_EXPERT_SLIDER_MAX; + const ffGain = FC.TUNING_SLIDERS.slider_feedforward_gain < this.NON_EXPERT_SLIDER_MIN || FC.TUNING_SLIDERS.slider_feedforward_gain > this.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 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); - - $('.sliderGyroFilter').prop('disabled', gyro && !this.expertMode); - $('.sliderDTermFilter').prop('disabled', dterm && !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); + // disable sliders + $('.baseSliderDGain').toggleClass('disabledSliders', !this.sliderPidsMode || (dGain && !this.expertMode)); + $('.baseSliderPIGain').toggleClass('disabledSliders', !this.sliderPidsMode || (piGain && !this.expertMode)); + $('.baseSliderFeedforwardGain').toggleClass('disabledSliders', !this.sliderPidsMode || (ffGain && !this.expertMode)); $('.advancedSlider').toggleClass('disabledSliders', !this.sliderPidsMode || !this.expertMode); + // hide advanced sliders if expert mode disabled $('.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); + // disable input + $('#sliderDGain').prop('disabled', !this.sliderPidsMode || (dGain && !this.expertMode)); + $('#sliderPIGain').prop('disabled', !this.sliderPidsMode || (piGain && !this.expertMode)); + $('#sliderFeedforwardGain').prop('disabled', !this.sliderPidsMode || (ffGain && !this.expertMode)); + + $('#sliderDMaxGain').prop('disabled', !this.sliderPidsMode || (dMaxGain && !this.expertMode)); + $('#sliderIGain').prop('disabled', !this.sliderPidsMode || (iGain && !this.expertMode)); + $('#sliderRollPitchRatio').prop('disabled', !this.sliderPidsMode || (rpRatio && !this.expertMode)); + $('#sliderPitchPIGain').prop('disabled', !this.sliderPidsMode || (rpIGain && !this.expertMode)); + $('#sliderMasterMultiplier').prop('disabled', !this.sliderPidsMode || (master && !this.expertMode)); + + $('.subtab-pid .expertSettingsDetectedNote').toggle(!this.sliderPidsMode || ((basic || advanced) && !this.expertMode)); +}; + +TuningSliders.updateExpertModeFilterSlidersDisplay = function() { + const gyroOutsideExpertMode = (FC.TUNING_SLIDERS.slider_gyro_filter_multiplier < this.NON_EXPERT_SLIDER_MIN_GYRO || FC.TUNING_SLIDERS.slider_gyro_filter_multiplier > this.NON_EXPERT_SLIDER_MAX_GYRO) && !this.expertMode; + const dtermOutsideExpertMode = (FC.TUNING_SLIDERS.slider_dterm_filter_multiplier < this.NON_EXPERT_SLIDER_MIN_DTERM || FC.TUNING_SLIDERS.slider_dterm_filter_multiplier > this.NON_EXPERT_SLIDER_MAX_DTERM) && !this.expertMode; + + const gyroLowpassDynMinFrequency = $('.pid_filter input[name="gyroLowpassDynMinFrequency"]'); + const gyroLowpassFrequency = $('.pid_filter input[name="gyroLowpassFrequency"]'); + const gyroLowpass2Frequency = $('.pid_filter input[name="gyroLowpass2Frequency"]'); + + const dtermLowpassDynMinFrequency = $('.pid_filter input[name="dtermLowpassDynMinFrequency"]'); + const dtermLowpassFrequency = $('.pid_filter input[name="dtermLowpassFrequency"]'); + const dtermLowpass2Frequency = $('.pid_filter input[name="dtermLowpass2Frequency"]'); + + const gyroLowPassDisabled = parseInt(gyroLowpassDynMinFrequency.val()) === 0 && parseInt(gyroLowpassFrequency.val()) === 0 && parseInt(gyroLowpass2Frequency.val()) === 0; + const dtermLowPassDisabled = parseInt(dtermLowpassDynMinFrequency.val()) === 0 && parseInt(dtermLowpassFrequency.val()) === 0 && parseInt(dtermLowpass2Frequency.val()) === 0; + + const disableGyroSlider = !this.sliderGyroFilter || gyroOutsideExpertMode || gyroLowPassDisabled; + const disableDTermSlider = !this.sliderDTermFilter || dtermOutsideExpertMode || dtermLowPassDisabled; + + $('.sliderGyroFilter').toggleClass('disabledSliders', disableGyroSlider); + $('.sliderDTermFilter').toggleClass('disabledSliders', disableDTermSlider); + + $('#sliderGyroFilterMultiplier').prop('disabled', disableGyroSlider); + $('#sliderDTermFilterMultiplier').prop('disabled', disableDTermSlider); + + $('.subtab-filter .expertSettingsDetectedNote').toggle(gyroOutsideExpertMode || dtermOutsideExpertMode); }; TuningSliders.setExpertMode = function(expertModeEnabled) { @@ -164,7 +186,8 @@ TuningSliders.setExpertMode = function(expertModeEnabled) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { - this.updateExpertModeSlidersDisplay(); + this.updateExpertModePidSlidersDisplay(); + this.updateExpertModeFilterSlidersDisplay(); $('.tab-pid_tuning .legacySlider').hide(); $('.legacyNonExpertModeSlidersNote').hide(); @@ -329,12 +352,14 @@ TuningSliders.updateFilterSlidersWarning = function() { let WARNING_FILTER_GYRO_HIGH_GAIN = 1.4; let WARNING_FILTER_DTERM_LOW_GAIN = 0.7; let WARNING_FILTER_DTERM_HIGH_GAIN = 1.4; + if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { WARNING_FILTER_GYRO_LOW_GAIN = 0.45; WARNING_FILTER_GYRO_HIGH_GAIN = 1.55; WARNING_FILTER_DTERM_LOW_GAIN = 0.75; WARNING_FILTER_DTERM_HIGH_GAIN = 1.25; } + $('.subtab-filter .slidersWarning').toggle((this.sliderGyroFilterMultiplier >= WARNING_FILTER_GYRO_HIGH_GAIN || this.sliderGyroFilterMultiplier <= WARNING_FILTER_GYRO_LOW_GAIN) || (this.sliderDTermFilterMultiplier >= WARNING_FILTER_DTERM_HIGH_GAIN || this.sliderDTermFilterMultiplier <= WARNING_FILTER_DTERM_LOW_GAIN)); @@ -347,17 +372,7 @@ TuningSliders.updatePidSlidersDisplay = function() { $('#pid_main .ROLL .pid_data input, #pid_main .PITCH .pid_data input').each((_, el) => $(el).prop('disabled', this.sliderPidsMode > 0)); $('#pid_main .YAW .pid_data input').each((_, el) => $(el).prop('disabled', this.sliderPidsMode === 2)); - $('.baseSlider').toggleClass('disabledSliders', !this.sliderPidsMode); - $('.advancedSlider').toggleClass('disabledSliders', !this.sliderPidsMode || !this.expertMode); - - $('#sliderDGain').prop('disabled', !this.sliderPidsMode); - $('#sliderPIGain').prop('disabled', !this.sliderPidsMode); - $('#sliderFeedforwardGain').prop('disabled', !this.sliderPidsMode); - $('#sliderDMaxGain').prop('disabled', !this.sliderPidsMode); - $('#sliderIGain').prop('disabled', !this.sliderPidsMode); - $('#sliderRollPitchRatio').prop('disabled', !this.sliderPidsMode); - $('#sliderPitchPIGain').prop('disabled', !this.sliderPidsMode); - $('#sliderMasterMultiplier').prop('disabled', !this.sliderPidsMode); + this.updateExpertModePidSlidersDisplay(); $('#sliderPidsModeSelect').val(this.sliderPidsMode); } else { @@ -421,6 +436,8 @@ TuningSliders.updateGyroFilterSliderDisplay = function() { const gyroLowpassFrequency = $('.pid_filter input[name="gyroLowpassFrequency"]'); const gyroLowpass2Frequency = $('.pid_filter input[name="gyroLowpass2Frequency"]'); + const outsideExpertMode = (FC.TUNING_SLIDERS.slider_gyro_filter_multiplier < this.NON_EXPERT_SLIDER_MIN_GYRO || FC.TUNING_SLIDERS.slider_gyro_filter_multiplier > this.NON_EXPERT_SLIDER_MAX_GYRO) && !this.expertMode; + if (FC.TUNING_SLIDERS.slider_gyro_filter === 0) { this.GyroSliderUnavailable = true; this.sliderGyroFilter = 0; @@ -430,6 +447,7 @@ TuningSliders.updateGyroFilterSliderDisplay = function() { this.cachedGyroSliderValues = true; } + // set lowpass values gyroLowpassDynMinFrequency.val(FC.FILTER_CONFIG.gyro_lowpass_dyn_min_hz).prop('disabled', this.sliderGyroFilter); gyroLowpassDynMaxFrequency.val(FC.FILTER_CONFIG.gyro_lowpass_dyn_max_hz).prop('disabled', this.sliderGyroFilter); gyroLowpassFrequency.val(FC.FILTER_CONFIG.gyro_lowpass_hz).prop('disabled', this.sliderGyroFilter); @@ -437,10 +455,15 @@ TuningSliders.updateGyroFilterSliderDisplay = function() { $('output[name="sliderGyroFilterMultiplier-number"]').val(this.sliderGyroFilterMultiplier); + const gyroLowPassDisabled = FC.FILTER_CONFIG.gyro_lowpass_dyn_min_hz === 0 && FC.FILTER_CONFIG.gyro_lowpass_hz === 0 && FC.FILTER_CONFIG.gyro_lowpass2_hz === 0; + const disableSlider = gyroLowPassDisabled || outsideExpertMode || this.GyroSliderUnavailable; + // update Gyro mode and slider $('select[id="sliderGyroFilterModeSelect"]').val(this.sliderGyroFilter); - $('.sliderGyroFilter').toggleClass('disabledSliders', this.GyroSliderUnavailable); - $('input[id="sliderGyroFilterMultiplier"]').prop('disabled', this.GyroSliderUnavailable); + $('.sliderGyroFilter').toggleClass('disabledSliders', disableSlider); + $('input[id="sliderGyroFilterMultiplier"]').prop('disabled', disableSlider); + + this.updateFilterSlidersWarning(); }; TuningSliders.updateDTermFilterSliderDisplay = function() { @@ -450,6 +473,8 @@ TuningSliders.updateDTermFilterSliderDisplay = function() { const dtermLowpassFrequency = $('.pid_filter input[name="dtermLowpassFrequency"]'); const dtermLowpass2Frequency = $('.pid_filter input[name="dtermLowpass2Frequency"]'); + const outsideExpertMode = (FC.TUNING_SLIDERS.slider_dterm_filter_multiplier < this.NON_EXPERT_SLIDER_MIN_DTERM || FC.TUNING_SLIDERS.slider_dterm_filter_multiplier > this.NON_EXPERT_SLIDER_MAX_DTERM) && !this.expertMode; + if (FC.TUNING_SLIDERS.slider_dterm_filter === 0) { this.DTermSliderUnavailable = true; this.sliderDTermFilter = 0; @@ -459,17 +484,23 @@ TuningSliders.updateDTermFilterSliderDisplay = function() { this.cachedDTermSliderValues = true; } + // set lowpass values dtermLowpassDynMinFrequency.val(FC.FILTER_CONFIG.dterm_lowpass_dyn_min_hz).prop('disabled', this.sliderDTermFilter); dtermLowpassDynMaxFrequency.val(FC.FILTER_CONFIG.dterm_lowpass_dyn_max_hz).prop('disabled', this.sliderDTermFilter); dtermLowpassFrequency.val(FC.FILTER_CONFIG.dterm_lowpass_hz).prop('disabled', this.sliderDTermFilter); dtermLowpass2Frequency.val(FC.FILTER_CONFIG.dterm_lowpass2_hz).prop('disabled', this.sliderDTermFilter); + const dtermLowPassDisabled = FC.FILTER_CONFIG.dterm_lowpass_dyn_min_hz === 0 && FC.FILTER_CONFIG.dterm_lowpass_hz === 0 && FC.FILTER_CONFIG.dterm_lowpass2_hz === 0; + const disableSlider = dtermLowPassDisabled || outsideExpertMode || this.DTermSliderUnavailable; + $('output[name="sliderDTermFilterMultiplier-number"]').val(this.sliderDTermFilterMultiplier); // update DTerm mode and slider $('select[id="sliderDTermFilterModeSelect"]').val(this.sliderDTermFilter); - $('.sliderDTermFilter').toggleClass('disabledSliders', this.DTermSliderUnavailable); - $('input[id="sliderDTermFilterMultiplier"]').prop('disabled', this.DTermSliderUnavailable); + $('.sliderDTermFilter').toggleClass('disabledSliders', disableSlider); + $('input[id="sliderDTermFilterMultiplier"]').prop('disabled', disableSlider); + + this.updateFilterSlidersWarning(); }; TuningSliders.updateFilterSlidersDisplay = function() { @@ -480,10 +511,10 @@ TuningSliders.updateFilterSlidersDisplay = function() { this.updateDTermFilterSliderDisplay(); } else { this.legacyUpdateFilterSlidersDisplay(); + this.updateFilterSlidersWarning(); } $('.subtab-filter .nonExpertModeSlidersNote').toggle((!this.GyroSliderUnavailable || !this.DTermSliderUnavailable) && !this.expertMode); - this.updateFilterSlidersWarning(this.GyroSliderUnavailable, this.DTermSliderUnavailable); }; TuningSliders.updateFormPids = function(updateSlidersOnly = false) { diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index b490bf4b..ed706afb 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -895,24 +895,23 @@ TABS.pid_tuning.initialize = function (callback) { gyroLowpassEnabled.change(function() { const checked = $(this).is(':checked'); - if (FC.FILTER_CONFIG.gyro_lowpass_dyn_min_hz > 0 || FC.FILTER_CONFIG.gyro_lowpass_hz > 0) { + if (checked) { + if (FC.FILTER_CONFIG.gyro_lowpass_dyn_min_hz > 0 || FC.FILTER_CONFIG.gyro_lowpass_hz > 0) { // lowpass1 is enabled, set the master switch on, show the label, mode selector and type fields - - if (checked) { gyroLowpassFilterMode.val(FC.FILTER_CONFIG.gyro_lowpass_dyn_min_hz > 0 ? 1 : 0).change(); } else { - // the user is disabling Lowpass 1 so set everything to zero - gyroLowpassDynMinFrequency.val(0); - gyroLowpassDynMaxFrequency.val(0); - gyroLowpassFrequency.val(0); - } - } else { - // lowpass 1 is disabled, set the master switch off, only show label - if (checked) { + // lowpass 1 is disabled, set the master switch off, only show label // user is trying to enable the lowpass filter, but it was off (both cutoffs are zero) // initialise in dynamic mode with values at sliders, or use defaults gyroLowpassFilterMode.val(1).change(); } + } else { + // the user is disabling Lowpass 1 so set everything to zero + gyroLowpassDynMinFrequency.val(0); + gyroLowpassDynMaxFrequency.val(0); + gyroLowpassFrequency.val(0); + + self.calculateNewGyroFilters(); } gyroLowpassOption.toggle(checked); @@ -931,9 +930,7 @@ TABS.pid_tuning.initialize = function (callback) { gyroLowpassDynMinFrequency.val(dynMode ? cutoffMin : 0); gyroLowpassDynMaxFrequency.val(dynMode ? cutoffMax : 0); - if (TuningSliders.sliderGyroFilter) { - self.calculateNewGyroFilters(); - } + self.calculateNewGyroFilters(); gyroLowpassOptionStatic.toggle(!dynMode); gyroLowpassOptionDynamic.toggle(!!dynMode); @@ -946,9 +943,7 @@ TABS.pid_tuning.initialize = function (callback) { gyroLowpass2Frequency.val(checked ? cutoff : 0).attr('disabled', !checked); - if (checked && TuningSliders.sliderGyroFilter) { - self.calculateNewGyroFilters(); - } + self.calculateNewGyroFilters(); gyroLowpass2Option.toggle(checked); self.updateFilterWarning(); @@ -957,23 +952,23 @@ TABS.pid_tuning.initialize = function (callback) { dtermLowpassEnabled.change(function() { const checked = $(this).is(':checked'); - if (FC.FILTER_CONFIG.dterm_lowpass_dyn_min_hz > 0 || FC.FILTER_CONFIG.dterm_lowpass_hz > 0) { - // lowpass1 is enabled, set the master switch on, show the label, mode selector and type fields - if (checked) { + if (checked) { + if (FC.FILTER_CONFIG.dterm_lowpass_dyn_min_hz > 0 || FC.FILTER_CONFIG.dterm_lowpass_hz > 0) { + // lowpass1 is enabled, set the master switch on, show the label, mode selector and type fields dtermLowpassFilterMode.val(FC.FILTER_CONFIG.dterm_lowpass_dyn_min_hz > 0 ? 1 : 0).change(); } else { - // the user is disabling Lowpass 1 so set everything to zero - dtermLowpassDynMinFrequency.val(0); - dtermLowpassDynMaxFrequency.val(0); - dtermLowpassFrequency.val(0); - } - } else { - // lowpass 1 is disabled, set the master switch off, only show label - if (checked) { + // lowpass 1 is disabled, set the master switch off, only show label // user is trying to enable the lowpass filter, but it was off (both cutoffs are zero) // initialise in dynamic mode with values at sliders, or use defaults dtermLowpassFilterMode.val(1).change(); } + } else { + // the user is disabling Lowpass 1 so set everything to zero + dtermLowpassDynMinFrequency.val(0); + dtermLowpassDynMaxFrequency.val(0); + dtermLowpassFrequency.val(0); + + self.calculateNewDTermFilters(); } dtermLowpassOption.toggle(checked); @@ -992,9 +987,7 @@ TABS.pid_tuning.initialize = function (callback) { dtermLowpassDynMinFrequency.val(dynMode ? cutoffMin : 0); dtermLowpassDynMaxFrequency.val(dynMode ? cutoffMax : 0); - if (TuningSliders.sliderDTermFilter) { - self.calculateNewDTermFilters(); - } + self.calculateNewDTermFilters(); dtermLowpassOptionStatic.toggle(!dynMode); dtermLowpassOptionDynamic.toggle(!!dynMode); @@ -1006,9 +999,7 @@ TABS.pid_tuning.initialize = function (callback) { dtermLowpass2Frequency.val(checked ? cutoff : 0).attr('disabled', !checked); - if (checked && TuningSliders.sliderDTermFilter) { - self.calculateNewDTermFilters(); - } + self.calculateNewDTermFilters(); dtermLowpass2Option.toggle(checked); self.updateFilterWarning(); @@ -2945,13 +2936,17 @@ TABS.pid_tuning.calculateNewPids = function() { TABS.pid_tuning.calculateNewGyroFilters = function() { if (!TABS.pid_tuning.isHtmlProcessing) { - TuningSliders.calculateNewGyroFilters(); + if (TuningSliders.sliderGyroFilter) { + TuningSliders.calculateNewGyroFilters(); + } } }; TABS.pid_tuning.calculateNewDTermFilters = function() { if (!TABS.pid_tuning.isHtmlProcessing) { - TuningSliders.calculateNewDTermFilters(); + if (TuningSliders.sliderDTermFilter) { + TuningSliders.calculateNewDTermFilters(); + } } };