mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-18 13:55:14 +03:00
Merge pull request #673 from basdelfos/fix-filter-switches
Fix resetting filter values after reloading tab
This commit is contained in:
commit
4f15aaeedf
1 changed files with 15 additions and 12 deletions
|
@ -270,26 +270,29 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
|
||||
$('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(checked ? DEFAULT.gyro_soft_notch_cutoff_1 : 0)
|
||||
.attr('disabled', !checked);
|
||||
var hz = FILTER_CONFIG.gyro_soft_notch_hz_1 > 0 ? FILTER_CONFIG.gyro_soft_notch_hz_1 : DEFAULT.gyro_soft_notch_hz_1;
|
||||
var cutoff = FILTER_CONFIG.gyro_soft_notch_cutoff_1 > 0 ? FILTER_CONFIG.gyro_soft_notch_cutoff_1 : DEFAULT.gyro_soft_notch_cutoff_1;
|
||||
|
||||
$('.pid_filter input[name="gyroNotch1Frequency"]').val(checked ? hz : 0).attr('disabled', !checked);
|
||||
$('.pid_filter input[name="gyroNotch1Cutoff"]').val(checked ? cutoff : 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);
|
||||
var hz = FILTER_CONFIG.gyro_soft_notch_hz_2 > 0 ? FILTER_CONFIG.gyro_soft_notch_hz_2 : DEFAULT.gyro_soft_notch_hz_2;
|
||||
var cutoff = FILTER_CONFIG.gyro_soft_notch_cutoff_2 > 0 ? FILTER_CONFIG.gyro_soft_notch_cutoff_2 : DEFAULT.gyro_soft_notch_cutoff_2;
|
||||
|
||||
$('.pid_filter input[name="gyroNotch2Frequency"]').val(checked ? hz : 0).attr('disabled', !checked);
|
||||
$('.pid_filter input[name="gyroNotch2Cutoff"]').val(checked ? cutoff : 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);
|
||||
var hz = FILTER_CONFIG.dterm_notch_hz > 0 ? FILTER_CONFIG.dterm_notch_hz : DEFAULT.dterm_notch_hz;
|
||||
var cutoff = FILTER_CONFIG.dterm_notch_cutoff > 0 ? FILTER_CONFIG.dterm_notch_cutoff : DEFAULT.dterm_notch_cutoff;
|
||||
|
||||
$('.pid_filter input[name="dTermNotchFrequency"]').val(checked ? hz : 0).attr('disabled', !checked);
|
||||
$('.pid_filter input[name="dTermNotchCutoff"]').val(checked ? cutoff : 0).attr('disabled', !checked);
|
||||
});
|
||||
|
||||
$('input[id="gyroNotch1Enabled"]').prop('checked', FILTER_CONFIG.gyro_soft_notch_cutoff_1 != 0).change();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue