1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

Added selection of dterm lowpass filter type

This commit is contained in:
Bas Delfos 2017-07-12 11:36:25 +02:00
parent 667c4d5af3
commit bc86e8bc18
5 changed files with 140 additions and 102 deletions

View file

@ -1879,6 +1879,12 @@
"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]"
},

View file

@ -313,6 +313,7 @@ var FC = {
dterm_notch_cutoff: 0,
gyro_soft_notch_hz_2: 0,
gyro_soft_notch_cutoff_2: 0,
dterm_filter_type: 0,
};
ADVANCED_TUNING = {

View file

@ -788,6 +788,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
FILTER_CONFIG.gyro_soft_notch_hz_2 = data.readU16();
FILTER_CONFIG.gyro_soft_notch_cutoff_2 = data.readU16();
}
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
FILTER_CONFIG.dterm_filter_type = data.readU8();
}
}
break;
case MSPCodes.MSP_SET_PID_ADVANCED:
@ -1388,6 +1391,9 @@ MspHelper.prototype.crunch = function(code) {
buffer.push16(FILTER_CONFIG.gyro_soft_notch_hz_2)
.push16(FILTER_CONFIG.gyro_soft_notch_cutoff_2)
}
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
buffer.push8(FILTER_CONFIG.dterm_filter_type);
}
}
break;
case MSPCodes.MSP_SET_PID_ADVANCED:

View file

@ -434,6 +434,21 @@
<p i18n="tuningHelp"></p>
</div>
</div>
<div class="dtermfiltertype cf_column twothird">
<div class="profile single-field" style="width:200px; margin-bottom: 0px;">
<div class="helpicon cf_tip" i18n_title="pidTuningDTermLowpassTypeTip" style="margin-top: 5px;"></div>
<div class="head" i18n="pidTuningDTermLowpassType"></div>
<div class="bottomarea">
<select name="dtermFilterType">
<option value="0" class="PT1">PT1</option>
<option value="1" class="BIQUAD">BIQUAD</option>
<option value="2" class="FIR">FIR</option>
</select>
</div>
</div>
</div>
<div class="cf_column twothird">
<div class="gui_box grey topspacer pid_filter">
<table class="pid_titlebar new_rates">

View file

@ -258,6 +258,12 @@ TABS.pid_tuning.initialize = function (callback) {
} else {
$('.pid_sensitivity').hide();
}
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
$('.profile select[name="dtermFilterType"]').val(FILTER_CONFIG.dterm_filter_type);
} else {
$('.dtermfiltertype').hide();
}
}
function form_to_pid_and_rc() {
@ -368,6 +374,10 @@ TABS.pid_tuning.initialize = function (callback) {
ADVANCED_TUNING.levelAngleLimit = parseInt($('.pid_tuning input[name="angleLimit"]').val());
ADVANCED_TUNING.levelSensitivity = parseInt($('.pid_tuning input[name="sensitivity"]').val());
}
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
FILTER_CONFIG.dterm_filter_type = $('.profile select[name="dtermFilterType"]').val();
}
}
function showAllPids() {