diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 8c848a2a..a43f9e5f 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1949,14 +1949,20 @@ "pidTuningGyroLowpassFrequencyHelp": { "message": "Gyro Soft Lowpass Frequency [Hz]" }, + "pidTuningGyroNotch1Enable": { + "message": "Enable Gyro Notch Filter 1" + }, "pidTuningGyroNotch1Frequency": { "message": "Gyro Notch Filter 1 Frequency [Hz]" }, + "pidTuningGyroNotch2Enable": { + "message": "Enable Gyro Notch Filter 2" + }, "pidTuningGyroNotch2Frequency": { "message": "Gyro Notch Filter 2 Frequency [Hz]" }, "pidTuningGyroNotchFrequencyHelp": { - "message": "Gyro Notch Filter Frequency in Hz (0 means disabled)" + "message": "Gyro Notch Filter Frequency in Hz" }, "pidTuningGyroNotch1Cutoff": { "message": "Gyro Notch Filter Cutoff 1 Frequency [Hz]" @@ -1970,18 +1976,15 @@ "pidTuningFilterSettings": { "message": "Filter Settings" }, - "pidTuningDTermLowpassType": { - "message": "D-Term Lowpass Filter" - }, - "pidTuningDTermLowpassTypeTip": { - "message": "Select D-Term lowpass filter type to use. Default is BIQUAD" - }, "pidTuningDTermLowpassFrequency": { "message": "D Term Lowpass Frequency [Hz]" }, "pidTuningDTermLowpassFrequencyHelp": { "message": "D Term Lowpass Frequency [Hz] (0 means disabled)" }, + "pidTuningDTermNotchEnable": { + "message": "Enable D Term Notch Filter" + }, "pidTuningDTermNotchFrequency": { "message": "D Term Notch Filter Frequency [Hz]" }, diff --git a/js/fc.js b/js/fc.js index 2c304ba0..00b42ce1 100644 --- a/js/fc.js +++ b/js/fc.js @@ -56,6 +56,7 @@ var FILTER_CONFIG; var ADVANCED_TUNING; var SENSOR_CONFIG; var COPY_PROFILE; +var DEFAULT; var FC = { resetState: function() { @@ -337,7 +338,7 @@ var FC = { dterm_notch_cutoff: 0, gyro_soft_notch_hz_2: 0, gyro_soft_notch_cutoff_2: 0, - dterm_filter_type: 0, + dterm_filter_type: 0, }; ADVANCED_TUNING = { @@ -392,5 +393,14 @@ var FC = { }; RXFAIL_CONFIG = []; + + DEFAULT = { + gyro_soft_notch_cutoff_1: 300, + gyro_soft_notch_hz_1: 400, + gyro_soft_notch_cutoff_2: 200, + gyro_soft_notch_hz_2: 300, + dterm_notch_cutoff: 160, + dterm_notch_hz: 260, + }; } }; diff --git a/tabs/pid_tuning.css b/tabs/pid_tuning.css index 1a163673..0f678219 100644 --- a/tabs/pid_tuning.css +++ b/tabs/pid_tuning.css @@ -326,7 +326,8 @@ .tab-pid_tuning table tr td { text-align: left; - padding-left: 0px; + padding-left: 5px; + padding-right: 5px; } .tab-pid_tuning table input { @@ -636,7 +637,7 @@ .tab-pid_tuning .controller { - width: 150px; + width: 150px; } .tab-pid_tuning .controller select { @@ -646,7 +647,7 @@ } .tab-pid_tuning .delta { - width: 150px; + width: 150px; } .tab-pid_tuning .delta select { diff --git a/tabs/pid_tuning.html b/tabs/pid_tuning.html index e4ff2ee7..1d949bdb 100755 --- a/tabs/pid_tuning.html +++ b/tabs/pid_tuning.html @@ -451,6 +451,9 @@ + + + + + + + + +
+ +
+ + @@ -568,6 +595,18 @@ + + + + + +
+ +
+ + diff --git a/tabs/pid_tuning.js b/tabs/pid_tuning.js index d1a38a7e..25f114e6 100755 --- a/tabs/pid_tuning.js +++ b/tabs/pid_tuning.js @@ -267,6 +267,34 @@ TABS.pid_tuning.initialize = function (callback) { $('.dtermfiltertype').hide(); $('.antigravity').hide(); } + + $('input[id="gyroNotch1Enabled"]').change(function() { + var checked = $(this).is(':checked'); + $('.pid_filter input[name="gyroNotch1Frequency"]').val(checked ? DEFAULT.gyro_soft_notch_hz_1 : 0) + .attr('disabled', !checked); + $('.pid_filter input[name="gyroNotch1Cutoff"]').val($(this).is(':checked') ? DEFAULT.gyro_soft_notch_cutoff_1 : 0) + .attr('disabled', !checked); + }); + + $('input[id="gyroNotch2Enabled"]').change(function() { + var checked = $(this).is(':checked'); + $('.pid_filter input[name="gyroNotch2Frequency"]').val(checked ? DEFAULT.gyro_soft_notch_hz_2 : 0) + .attr('disabled', !checked); + $('.pid_filter input[name="gyroNotch2Cutoff"]').val(checked ? DEFAULT.gyro_soft_notch_cutoff_2 : 0) + .attr('disabled', !checked); + }); + + $('input[id="dtermNotchEnabled"]').change(function() { + var checked = $(this).is(':checked'); + $('.pid_filter input[name="dTermNotchFrequency"]').val(checked ? DEFAULT.dterm_notch_hz : 0) + .attr('disabled', !checked); + $('.pid_filter input[name="dTermNotchCutoff"]').val(checked ? DEFAULT.dterm_notch_cutoff : 0) + .attr('disabled', !checked); + }); + + $('input[id="gyroNotch1Enabled"]').prop('checked', FILTER_CONFIG.gyro_soft_notch_cutoff_1 != 0).change(); + $('input[id="gyroNotch2Enabled"]').prop('checked', FILTER_CONFIG.gyro_soft_notch_cutoff_2 != 0).change(); + $('input[id="dtermNotchEnabled"]').prop('checked', FILTER_CONFIG.dterm_notch_cutoff != 0).change(); } function form_to_pid_and_rc() {