Merge pull request #576 from basdelfos/filter-switches

Filter switches (take two)
10.3.x-maintenance
Michael Keller 2017-08-30 11:16:55 +12:00 committed by GitHub
commit dfb2d8123a
5 changed files with 92 additions and 11 deletions

View File

@ -1949,14 +1949,20 @@
"pidTuningGyroLowpassFrequencyHelp": { "pidTuningGyroLowpassFrequencyHelp": {
"message": "Gyro Soft Lowpass Frequency [Hz]" "message": "Gyro Soft Lowpass Frequency [Hz]"
}, },
"pidTuningGyroNotch1Enable": {
"message": "Enable Gyro Notch Filter 1"
},
"pidTuningGyroNotch1Frequency": { "pidTuningGyroNotch1Frequency": {
"message": "Gyro Notch Filter 1 Frequency [Hz]" "message": "Gyro Notch Filter 1 Frequency [Hz]"
}, },
"pidTuningGyroNotch2Enable": {
"message": "Enable Gyro Notch Filter 2"
},
"pidTuningGyroNotch2Frequency": { "pidTuningGyroNotch2Frequency": {
"message": "Gyro Notch Filter 2 Frequency [Hz]" "message": "Gyro Notch Filter 2 Frequency [Hz]"
}, },
"pidTuningGyroNotchFrequencyHelp": { "pidTuningGyroNotchFrequencyHelp": {
"message": "Gyro Notch Filter Frequency in Hz (0 means disabled)" "message": "Gyro Notch Filter Frequency in Hz"
}, },
"pidTuningGyroNotch1Cutoff": { "pidTuningGyroNotch1Cutoff": {
"message": "Gyro Notch Filter Cutoff 1 Frequency [Hz]" "message": "Gyro Notch Filter Cutoff 1 Frequency [Hz]"
@ -1970,18 +1976,15 @@
"pidTuningFilterSettings": { "pidTuningFilterSettings": {
"message": "Filter Settings" "message": "Filter Settings"
}, },
"pidTuningDTermLowpassType": {
"message": "D-Term Lowpass Filter"
},
"pidTuningDTermLowpassTypeTip": {
"message": "Select D-Term lowpass filter type to use. Default is BIQUAD"
},
"pidTuningDTermLowpassFrequency": { "pidTuningDTermLowpassFrequency": {
"message": "D Term Lowpass Frequency [Hz]" "message": "D Term Lowpass Frequency [Hz]"
}, },
"pidTuningDTermLowpassFrequencyHelp": { "pidTuningDTermLowpassFrequencyHelp": {
"message": "D Term Lowpass Frequency [Hz] (0 means disabled)" "message": "D Term Lowpass Frequency [Hz] (0 means disabled)"
}, },
"pidTuningDTermNotchEnable": {
"message": "Enable D Term Notch Filter"
},
"pidTuningDTermNotchFrequency": { "pidTuningDTermNotchFrequency": {
"message": "D Term Notch Filter Frequency [Hz]" "message": "D Term Notch Filter Frequency [Hz]"
}, },

View File

@ -56,6 +56,7 @@ var FILTER_CONFIG;
var ADVANCED_TUNING; var ADVANCED_TUNING;
var SENSOR_CONFIG; var SENSOR_CONFIG;
var COPY_PROFILE; var COPY_PROFILE;
var DEFAULT;
var FC = { var FC = {
resetState: function() { resetState: function() {
@ -337,7 +338,7 @@ var FC = {
dterm_notch_cutoff: 0, dterm_notch_cutoff: 0,
gyro_soft_notch_hz_2: 0, gyro_soft_notch_hz_2: 0,
gyro_soft_notch_cutoff_2: 0, gyro_soft_notch_cutoff_2: 0,
dterm_filter_type: 0, dterm_filter_type: 0,
}; };
ADVANCED_TUNING = { ADVANCED_TUNING = {
@ -392,5 +393,14 @@ var FC = {
}; };
RXFAIL_CONFIG = []; 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,
};
} }
}; };

View File

@ -326,7 +326,8 @@
.tab-pid_tuning table tr td { .tab-pid_tuning table tr td {
text-align: left; text-align: left;
padding-left: 0px; padding-left: 5px;
padding-right: 5px;
} }
.tab-pid_tuning table input { .tab-pid_tuning table input {
@ -636,7 +637,7 @@
.tab-pid_tuning .controller { .tab-pid_tuning .controller {
width: 150px; width: 150px;
} }
.tab-pid_tuning .controller select { .tab-pid_tuning .controller select {
@ -646,7 +647,7 @@
} }
.tab-pid_tuning .delta { .tab-pid_tuning .delta {
width: 150px; width: 150px;
} }
.tab-pid_tuning .delta select { .tab-pid_tuning .delta select {

View File

@ -451,6 +451,9 @@
</div> </div>
</div> </div>
</div> </div>
<!-- FILTER SUBTAB -->
<div class="subtab-filter" style="display: none;"> <div class="subtab-filter" style="display: none;">
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="note topspacer" style="margin-top: 0px;"> <div class="note topspacer" style="margin-top: 0px;">
@ -494,6 +497,18 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr class="switchGyroNotch1">
<td style="text-align: right;">
<input type="checkbox" id="gyroNotch1Enabled" class="toggle" />
</td>
<td>
<div>
<label>
<span i18n="pidTuningGyroNotch1Enable"></span>
</label>
</div>
</td>
</tr>
<tr class="newFilter"> <tr class="newFilter">
<td> <td>
<input type="number" class="nonProfile" name="gyroNotch1Frequency" step="1" min="0" max="16000"/> <input type="number" class="nonProfile" name="gyroNotch1Frequency" step="1" min="0" max="16000"/>
@ -520,6 +535,18 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr class="switchGyroNotch2">
<td style="text-align: right;">
<input type="checkbox" id="gyroNotch2Enabled" class="toggle" />
</td>
<td>
<div>
<label>
<span i18n="pidTuningGyroNotch2Enable"></span>
</label>
</div>
</td>
<tr>
<tr class="newFilter gyroNotch2"> <tr class="newFilter gyroNotch2">
<td> <td>
<input type="number" class="nonProfile" name="gyroNotch2Frequency" step="1" min="0" max="16000"/> <input type="number" class="nonProfile" name="gyroNotch2Frequency" step="1" min="0" max="16000"/>
@ -568,6 +595,18 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr class="switchDTermNotch">
<td style="text-align: right;">
<input type="checkbox" id="dtermNotchEnabled" class="toggle" />
</td>
<td>
<div>
<label>
<span i18n="pidTuningDTermNotchEnable"></span>
</label>
</div>
</td>
<tr>
<tr class="newFilter"> <tr class="newFilter">
<td> <td>
<input type="number" name="dTermNotchFrequency" step="1" min="0" max="16000"/> <input type="number" name="dTermNotchFrequency" step="1" min="0" max="16000"/>

View File

@ -267,6 +267,34 @@ TABS.pid_tuning.initialize = function (callback) {
$('.dtermfiltertype').hide(); $('.dtermfiltertype').hide();
$('.antigravity').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() { function form_to_pid_and_rc() {