diff --git a/locales/en/messages.json b/locales/en/messages.json index f9113c2e..2acb88ce 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -3732,9 +3732,6 @@ "pidTuningDynamicNotchCount": { "message": "Dynamic Notch Count" }, - "pidTuningDynamicNotchBandwidthHz": { - "message": "Dynamic Notch Bandwidth Frequency [Hz]" - }, "pidTuningDynamicNotchRangeHelp": { "message": "The dynamic notch has three frequency ranges in which it can operate: LOW(80-330hz) for lower revving quads like 6+ inches, MEDIUM(140-550hz) for a normal 5 inch quad, HIGH(230-800hz) for very high revving 2.5-3 inch quads. AUTO option selects the range depending on the value of the Gyro Dynamic Lowpass 1 Filter's max cutoff frequency." }, @@ -3753,9 +3750,6 @@ "pidTuningDynamicNotchCountHelp": { "message": "Sets the number of dynamic notches per axis. With RPM filter enabled a value of 1 or 2 is recommended. Without RPM filter a value of 4 or 5 is recommended. Lower numbers will reduce filter delay, however it may increase motor temperature." }, - "pidTuningDynamicNotchBandwidthHzHelp": { - "message": "Bandwidth in Hz adjusts how narrow or wide every dynamic notch will be. Higher values makes it wider and broader. Lower values makes it narrower and more precise, however it may increase motor temperature. Having a really high value will increase filter delay." - }, "pidTuningRpmFilterGroup": { "message": "Gyro RPM Filter", "description": "Header text for the RPM Filter group" diff --git a/src/js/fc.js b/src/js/fc.js index 21b84fca..a8b5cb0b 100644 --- a/src/js/fc.js +++ b/src/js/fc.js @@ -464,6 +464,7 @@ const FC = { dyn_notch_q: 0, dyn_notch_min_hz: 0, dyn_notch_max_hz: 0, + dyn_notch_count: 0, gyro_rpm_notch_harmonics: 0, gyro_rpm_notch_min_hz: 0, }; @@ -628,7 +629,7 @@ const FC = { dterm_lowpass_hz: 100, dterm_lowpass_dyn_min_hz: 150, dterm_lowpass_dyn_max_hz: 250, - dyn_lpf_curve_expo: 5, + dyn_lpf_curve_expo: 5, dterm_lowpass_type: this.FILTER_TYPE_FLAGS.PT1, dterm_lowpass2_hz: 150, dterm_lowpass2_type: this.FILTER_TYPE_FLAGS.BIQUAD, @@ -637,8 +638,10 @@ const FC = { yaw_lowpass_hz: 100, dyn_notch_q: 120, dyn_notch_width_percent: 8, + dyn_notch_count: 3, dyn_notch_q_rpm: 250, // default with rpm filtering dyn_notch_width_percent_rpm: 0, + dyn_notch_count_rpm: 1, dyn_notch_min_hz: 150, dyn_notch_max_hz: 600, }; @@ -822,6 +825,10 @@ const FC = { versionFilterDefaults.dterm_lowpass2_hz = 150; versionFilterDefaults.dterm_lowpass2_type = this.FILTER_TYPE_FLAGS.PT1; } + if (semver.gte(this.CONFIG.apiVersion, API_VERSION_1_44)) { + versionFilterDefaults.dyn_notch_q_rpm = 500; + versionFilterDefaults.dyn_notch_q = 300; + } } return versionFilterDefaults; }, diff --git a/src/js/msp/MSPHelper.js b/src/js/msp/MSPHelper.js index bd02e05c..a2c46c78 100644 --- a/src/js/msp/MSPHelper.js +++ b/src/js/msp/MSPHelper.js @@ -1101,7 +1101,6 @@ MspHelper.prototype.process_data = function(dataHandler) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { FC.FILTER_CONFIG.dyn_lpf_curve_expo = data.readU8(); FC.FILTER_CONFIG.dyn_notch_count = data.readU8(); - FC.FILTER_CONFIG.dyn_notch_bandwidth_hz = data.readU16(); } } } @@ -2074,8 +2073,7 @@ MspHelper.prototype.crunch = function(code) { } if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { buffer.push8(FC.FILTER_CONFIG.dyn_lpf_curve_expo) - .push8(FC.FILTER_CONFIG.dyn_notch_count) - .push16(FC.FILTER_CONFIG.dyn_notch_bandwidth_hz); + .push8(FC.FILTER_CONFIG.dyn_notch_count); } } break; diff --git a/src/js/tabs/motors.js b/src/js/tabs/motors.js index 82fc1a8a..6427e07d 100644 --- a/src/js/tabs/motors.js +++ b/src/js/tabs/motors.js @@ -4,6 +4,7 @@ TABS.motors = { previousDshotBidir: null, previousFilterDynQ: null, previousFilterDynWidth: null, + previousFilterDynCount: null, analyticsChanges: {}, configHasChanged: false, configChanges: {}, @@ -635,6 +636,7 @@ TABS.motors.initialize = function (callback) { self.previousDshotBidir = FC.MOTOR_CONFIG.use_dshot_telemetry; self.previousFilterDynQ = FC.FILTER_CONFIG.dyn_notch_q; self.previousFilterDynWidth = FC.FILTER_CONFIG.dyn_notch_width_percent; + self.previousFilterDynCount = FC.FILTER_CONFIG.dyn_notch_count; dshotBidirElement.on("change", function () { const value = $(this).prop('checked'); @@ -642,20 +644,26 @@ TABS.motors.initialize = function (callback) { self.analyticsChanges['BidirectionalDshot'] = newValue; FC.MOTOR_CONFIG.use_dshot_telemetry = value; - FC.FILTER_CONFIG.dyn_notch_width_percent = self.previousFilterDynWidth; + FC.FILTER_CONFIG.dyn_notch_count = self.previousFilterDynCount; FC.FILTER_CONFIG.dyn_notch_q = self.previousFilterDynQ; + FC.FILTER_CONFIG.dyn_notch_width_percent = self.previousFilterDynWidth; if (FC.FILTER_CONFIG.gyro_rpm_notch_harmonics !== 0) { // if rpm filter is active if (value && !self.previousDshotBidir) { - FC.FILTER_CONFIG.dyn_notch_width_percent = FILTER_DEFAULT.dyn_notch_width_percent_rpm; + FC.FILTER_CONFIG.dyn_notch_count = FILTER_DEFAULT.dyn_notch_count_rpm; FC.FILTER_CONFIG.dyn_notch_q = FILTER_DEFAULT.dyn_notch_q_rpm; + FC.FILTER_CONFIG.dyn_notch_width_percent = FILTER_DEFAULT.dyn_notch_width_percent_rpm; } else if (!value && self.previousDshotBidir) { - FC.FILTER_CONFIG.dyn_notch_width_percent = FILTER_DEFAULT.dyn_notch_width_percent; + FC.FILTER_CONFIG.dyn_notch_count = FILTER_DEFAULT.dyn_notch_count; FC.FILTER_CONFIG.dyn_notch_q = FILTER_DEFAULT.dyn_notch_q; + FC.FILTER_CONFIG.dyn_notch_width_percent = FILTER_DEFAULT.dyn_notch_width_percent; } } - if (FC.FILTER_CONFIG.dyn_notch_width_percent !== self.previousFilterDynWidth) { + const dynFilterNeedChange = (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) ? (FC.FILTER_CONFIG.dyn_notch_count !== self.previousFilterDynCount) : + (FC.FILTER_CONFIG.dyn_notch_width_percent !== self.previousFilterDynWidth); + + if (dynFilterNeedChange) { showDialogDynFiltersChange(); } }); diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index 9002d472..89819bea 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -373,6 +373,7 @@ TABS.pid_tuning.initialize = function (callback) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) { const dynamicNotchWidthPercent_e = $('.pid_filter input[name="dynamicNotchWidthPercent"]'); const dynamicNotchQ_e = $('.pid_filter input[name="dynamicNotchQ"]'); + const dynamicNotchCount_e = $('.pid_filter input[name="dynamicNotchCount"]'); $('.smartfeedforward').hide(); @@ -385,8 +386,7 @@ TABS.pid_tuning.initialize = function (callback) { $('.pid_filter select[name="dynamicNotchRange"]').val(FC.FILTER_CONFIG.dyn_notch_range); dynamicNotchWidthPercent_e.val(FC.FILTER_CONFIG.dyn_notch_width_percent); dynamicNotchQ_e.val(FC.FILTER_CONFIG.dyn_notch_q); - $('.pid_filter input[name="dynamicNotchCount"]').val(FC.FILTER_CONFIG.dyn_notch_count); - $('.pid_filter input[name="dynamicNotchBandwidthHz"]').val(FC.FILTER_CONFIG.dyn_notch_bandwidth_hz); + dynamicNotchCount_e.val(FC.FILTER_CONFIG.dyn_notch_count); $('.pid_filter input[name="dynamicNotchMinHz"]').val(FC.FILTER_CONFIG.dyn_notch_min_hz); if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) { $('.pid_filter input[name="dynamicNotchMinHz"]').attr("max","250"); @@ -397,10 +397,8 @@ TABS.pid_tuning.initialize = function (callback) { if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { $('.dynamicNotchHelp').attr('title', i18n.getMessage('pidTuningMultiDynamicNotchFilterHelp')); $('.dynamicNotchWidthPercent').hide(); - $('.dynamicNotchQ').hide(); } else { $('.dynamicNotchCount').hide(); - $('.dynamicNotchBandwidthHz').hide(); } $('.rpmFilter').toggle(FC.MOTOR_CONFIG.use_dshot_telemetry); @@ -422,18 +420,21 @@ TABS.pid_tuning.initialize = function (callback) { if (checked !== (FC.FILTER_CONFIG.gyro_rpm_notch_harmonics !== 0)) { // if rpmFilterEnabled is not the same value as saved in the fc if (checked) { - dynamicNotchWidthPercent_e.val(FILTER_DEFAULT.dyn_notch_width_percent_rpm); + dynamicNotchCount_e.val(FILTER_DEFAULT.dyn_notch_count_rpm); dynamicNotchQ_e.val(FILTER_DEFAULT.dyn_notch_q_rpm); + dynamicNotchWidthPercent_e.val(FILTER_DEFAULT.dyn_notch_width_percent_rpm); } else { - dynamicNotchWidthPercent_e.val(FILTER_DEFAULT.dyn_notch_width_percent); + dynamicNotchCount_e.val(FILTER_DEFAULT.dyn_notch_count); dynamicNotchQ_e.val(FILTER_DEFAULT.dyn_notch_q); + dynamicNotchWidthPercent_e.val(FILTER_DEFAULT.dyn_notch_width_percent); } showDialogDynFiltersChange(); } else { // same value, return saved values - dynamicNotchWidthPercent_e.val(FC.FILTER_CONFIG.dyn_notch_width_percent); + dynamicNotchCount_e.val(FC.FILTER_CONFIG.dyn_notch_count); dynamicNotchQ_e.val(FC.FILTER_CONFIG.dyn_notch_q); + dynamicNotchWidthPercent_e.val(FC.FILTER_CONFIG.dyn_notch_width_percent); } }).prop('checked', FC.FILTER_CONFIG.gyro_rpm_notch_harmonics != 0).change(); @@ -1002,7 +1003,6 @@ TABS.pid_tuning.initialize = function (callback) { FC.ADVANCED_TUNING.vbat_sag_compensation = $('input[id="vbatSagCompensation"]').is(':checked') ? parseInt($('input[name="vbatSagValue"]').val()) : 0; FC.ADVANCED_TUNING.thrustLinearization = $('input[id="thrustLinearization"]').is(':checked') ? parseInt($('input[name="thrustLinearValue"]').val()) : 0; FC.FILTER_CONFIG.dyn_notch_count = parseInt($('.pid_filter input[name="dynamicNotchCount"]').val()); - FC.FILTER_CONFIG.dyn_notch_bandwidth_hz = parseInt($('.pid_filter input[name="dynamicNotchBandwidthHz"]').val()); } if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) { diff --git a/src/tabs/pid_tuning.html b/src/tabs/pid_tuning.html index 02416799..2534eab3 100644 --- a/src/tabs/pid_tuning.html +++ b/src/tabs/pid_tuning.html @@ -1390,19 +1390,6 @@ - - - - - -
- -
-
- -