mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 01:35:28 +03:00
Indicate inactive dyn notch if looprate less 2k
This commit is contained in:
parent
61603bcb58
commit
69f5da9b51
2 changed files with 11 additions and 7 deletions
|
@ -3917,7 +3917,7 @@
|
||||||
"message": "Dynamic Notch Filter tracks peak gyro noise frequencies and places one to five notch filters with their center at these frequencies on every axis."
|
"message": "Dynamic Notch Filter tracks peak gyro noise frequencies and places one to five notch filters with their center at these frequencies on every axis."
|
||||||
},
|
},
|
||||||
"pidTuningDynamicNotchFilterDisabledWarning": {
|
"pidTuningDynamicNotchFilterDisabledWarning": {
|
||||||
"message": "<strong>Notice:</strong> The dynamic notch filter is disabled. In order to configure and use it, please enable the 'DYNAMIC_FILTER' feature in the '$t(configurationFeatures.message)' section of the '$t(tabConfiguration.message)' tab."
|
"message": "<strong>Notice:</strong> The dynamic notch filter is disabled. In order to configure and use it, please enable the 'DYNAMIC_FILTER' feature in the '$t(configurationFeatures.message)' section of the '$t(tabConfiguration.message)' tab. Also make sure the PID looprate is at least 2kHz."
|
||||||
},
|
},
|
||||||
"pidTuningDynamicNotchRange": {
|
"pidTuningDynamicNotchRange": {
|
||||||
"message": "Dynamic Notch Filter Range"
|
"message": "Dynamic Notch Filter Range"
|
||||||
|
|
|
@ -381,8 +381,14 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$('.smartfeedforward').hide();
|
$('.smartfeedforward').hide();
|
||||||
|
|
||||||
// Dynamic Notch Filter
|
// Dynamic Notch Filter
|
||||||
|
const sampleRateHz = FC.CONFIG.sampleRateHz / FC.PID_ADVANCED_CONFIG.pid_process_denom;
|
||||||
|
|
||||||
|
let isDynamicNotchActive = FC.FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER');
|
||||||
|
isDynamicNotchActive = isDynamicNotchActive || FC.FILTER_CONFIG.dyn_notch_count !== 0;
|
||||||
|
isDynamicNotchActive = isDynamicNotchActive && sampleRateHz >= 2000;
|
||||||
|
|
||||||
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
if (FC.FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')) {
|
if (isDynamicNotchActive) {
|
||||||
$('.dynamicNotch span.inputSwitch').hide();
|
$('.dynamicNotch span.inputSwitch').hide();
|
||||||
} else {
|
} else {
|
||||||
$('.dynamicNotch').hide();
|
$('.dynamicNotch').hide();
|
||||||
|
@ -409,12 +415,10 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$('.dynamicNotchMaxHz').hide();
|
$('.dynamicNotchMaxHz').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
const dynamicNotchSwitch_e = $('.pid_filter input[id="dynamicNotchEnabled"]');
|
$('.pid_filter input[id="dynamicNotchEnabled"]').on('change', function() {
|
||||||
|
|
||||||
dynamicNotchSwitch_e.on('change', function() {
|
|
||||||
|
|
||||||
const checked = $(this).is(':checked');
|
|
||||||
const count = parseInt(dynamicNotchCount_e.val());
|
const count = parseInt(dynamicNotchCount_e.val());
|
||||||
|
const checked = $(this).is(':checked');
|
||||||
|
|
||||||
if (checked && !count) {
|
if (checked && !count) {
|
||||||
dynamicNotchCount_e.val(FILTER_DEFAULT.dyn_notch_count);
|
dynamicNotchCount_e.val(FILTER_DEFAULT.dyn_notch_count);
|
||||||
|
@ -426,7 +430,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
$('.dynamicNotchWidthPercent').toggle(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44) && checked);
|
$('.dynamicNotchWidthPercent').toggle(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44) && checked);
|
||||||
$('.dynamicNotchCount').toggle(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) && checked);
|
$('.dynamicNotchCount').toggle(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) && checked);
|
||||||
|
|
||||||
}).prop('checked', FC.FILTER_CONFIG.dyn_notch_count !== 0 || FC.FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')).trigger('change');
|
}).prop('checked', isDynamicNotchActive).trigger('change');
|
||||||
|
|
||||||
// RPM Filter
|
// RPM Filter
|
||||||
$('.rpmFilter').toggle(FC.MOTOR_CONFIG.use_dshot_telemetry);
|
$('.rpmFilter').toggle(FC.MOTOR_CONFIG.use_dshot_telemetry);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue