mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 21:35:33 +03:00
Added gyro notch 2 filter.
This commit is contained in:
parent
30857b7490
commit
23d0a8eb5f
5 changed files with 71 additions and 22 deletions
|
@ -1649,14 +1649,20 @@
|
||||||
"pidTuningGyroLowpassFrequencyHelp": {
|
"pidTuningGyroLowpassFrequencyHelp": {
|
||||||
"message": "Gyro Soft Lowpass Frequency (Hz)"
|
"message": "Gyro Soft Lowpass Frequency (Hz)"
|
||||||
},
|
},
|
||||||
"pidTuningGyroNotchFrequency": {
|
"pidTuningGyroNotch1Frequency": {
|
||||||
"message": "Gyro Notch Filter Frequency (Hz)"
|
"message": "Gyro Notch Filter 1 Frequency (Hz)"
|
||||||
|
},
|
||||||
|
"pidTuningGyroNotch2Frequency": {
|
||||||
|
"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 (0 means disabled)"
|
||||||
},
|
},
|
||||||
"pidTuningGyroNotchCutoff": {
|
"pidTuningGyroNotch1Cutoff": {
|
||||||
"message": "Gyro Notch Filter Cutoff Frequency (Hz)"
|
"message": "Gyro Notch Filter Cutoff 1 Frequency (Hz)"
|
||||||
|
},
|
||||||
|
"pidTuningGyroNotch2Cutoff": {
|
||||||
|
"message": "Gyro Notch Filter Cutoff 2 Frequency (Hz)"
|
||||||
},
|
},
|
||||||
"pidTuningGyroNotchCutoffHelp": {
|
"pidTuningGyroNotchCutoffHelp": {
|
||||||
"message": "Gyro Notch Filter Cutoff Frequency in Hz (This is where notch filter starts. For example with notch filter 160 and notch hz of 260 it means the range is 160-360hz with most attenuation around center)"
|
"message": "Gyro Notch Filter Cutoff Frequency in Hz (This is where notch filter starts. For example with notch filter 160 and notch hz of 260 it means the range is 160-360hz with most attenuation around center)"
|
||||||
|
|
8
js/fc.js
8
js/fc.js
|
@ -261,10 +261,12 @@ var FC = {
|
||||||
gyro_soft_lpf_hz: 0,
|
gyro_soft_lpf_hz: 0,
|
||||||
dterm_lpf_hz: 0,
|
dterm_lpf_hz: 0,
|
||||||
yaw_lpf_hz: 0,
|
yaw_lpf_hz: 0,
|
||||||
gyro_soft_notch_hz: 0,
|
gyro_soft_notch_hz_1: 0,
|
||||||
gyro_soft_notch_cutoff: 0,
|
gyro_soft_notch_cutoff_1: 0,
|
||||||
dterm_notch_hz: 0,
|
dterm_notch_hz: 0,
|
||||||
dterm_notch_cutoff: 0
|
dterm_notch_cutoff: 0,
|
||||||
|
gyro_soft_notch_hz_2: 0,
|
||||||
|
gyro_soft_notch_cutoff_2: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
ADVANCED_TUNING = {
|
ADVANCED_TUNING = {
|
||||||
|
|
|
@ -591,13 +591,16 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
FILTER_CONFIG.dterm_lpf_hz = data.readU16();
|
FILTER_CONFIG.dterm_lpf_hz = data.readU16();
|
||||||
FILTER_CONFIG.yaw_lpf_hz = data.readU16();
|
FILTER_CONFIG.yaw_lpf_hz = data.readU16();
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||||
FILTER_CONFIG.gyro_soft_notch_hz = data.readU16();
|
FILTER_CONFIG.gyro_soft_notch_hz_1 = data.readU16();
|
||||||
FILTER_CONFIG.gyro_soft_notch_cutoff = data.readU16();
|
FILTER_CONFIG.gyro_soft_notch_cutoff_1 = data.readU16();
|
||||||
FILTER_CONFIG.dterm_notch_hz = data.readU16();
|
FILTER_CONFIG.dterm_notch_hz = data.readU16();
|
||||||
FILTER_CONFIG.dterm_notch_cutoff = data.readU16();
|
FILTER_CONFIG.dterm_notch_cutoff = data.readU16();
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
|
||||||
|
FILTER_CONFIG.gyro_soft_notch_hz_2 = data.readU16();
|
||||||
|
FILTER_CONFIG.gyro_soft_notch_cutoff_2 = data.readU16();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP_SET_PID_ADVANCED:
|
case MSPCodes.MSP_SET_PID_ADVANCED:
|
||||||
console.log("Advanced PID settings saved");
|
console.log("Advanced PID settings saved");
|
||||||
break;
|
break;
|
||||||
|
@ -1124,10 +1127,14 @@ MspHelper.prototype.crunch = function(code) {
|
||||||
.push16(FILTER_CONFIG.dterm_lpf_hz)
|
.push16(FILTER_CONFIG.dterm_lpf_hz)
|
||||||
.push16(FILTER_CONFIG.yaw_lpf_hz);
|
.push16(FILTER_CONFIG.yaw_lpf_hz);
|
||||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||||
buffer.push16(FILTER_CONFIG.gyro_soft_notch_hz)
|
buffer.push16(FILTER_CONFIG.gyro_soft_notch_hz_1)
|
||||||
.push16(FILTER_CONFIG.gyro_soft_notch_cutoff)
|
.push16(FILTER_CONFIG.gyro_soft_notch_cutoff_1)
|
||||||
.push16(FILTER_CONFIG.dterm_notch_hz)
|
.push16(FILTER_CONFIG.dterm_notch_hz)
|
||||||
.push16(FILTER_CONFIG.dterm_notch_cutoff);
|
.push16(FILTER_CONFIG.dterm_notch_cutoff);
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.21.0")) {
|
||||||
|
buffer.push16(FILTER_CONFIG.gyro_soft_notch_hz_2)
|
||||||
|
.push16(FILTER_CONFIG.gyro_soft_notch_cutoff_2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_SET_PID_ADVANCED:
|
case MSPCodes.MSP_SET_PID_ADVANCED:
|
||||||
|
|
|
@ -444,12 +444,12 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="newFilter">
|
<tr class="newFilter">
|
||||||
<td>
|
<td>
|
||||||
<input type="number" class="nonProfile" name="gyroNotchFrequency" step="1" min="0" max="500"/>
|
<input type="number" class="nonProfile" name="gyroNotch1Frequency" step="1" min="0" max="500"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<span i18n="pidTuningGyroNotchFrequency"></span>
|
<span i18n="pidTuningGyroNotch1Frequency"></span>
|
||||||
</label>
|
</label>
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningGyroNotchFrequencyHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningGyroNotchFrequencyHelp"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -457,12 +457,38 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="newFilter">
|
<tr class="newFilter">
|
||||||
<td>
|
<td>
|
||||||
<input type="number" class="nonProfile" name="gyroNotchCutoff" step="1" min="0" max="500"/>
|
<input type="number" class="nonProfile" name="gyroNotch1Cutoff" step="1" min="0" max="500"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<span i18n="pidTuningGyroNotchCutoff"></span>
|
<span i18n="pidTuningGyroNotch1Cutoff"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" i18n_title="pidTuningGyroNotchCutoffHelp"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="newFilter">
|
||||||
|
<td>
|
||||||
|
<input type="number" class="nonProfile" name="gyroNotch2Frequency" step="1" min="0" max="500"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
<span i18n="pidTuningGyroNotch2Frequency"></span>
|
||||||
|
</label>
|
||||||
|
<div class="helpicon cf_tip" i18n_title="pidTuningGyroNotchFrequencyHelp"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="newFilter">
|
||||||
|
<td>
|
||||||
|
<input type="number" class="nonProfile" name="gyroNotch2Cutoff" step="1" min="0" max="500"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
<span i18n="pidTuningGyroNotch2Cutoff"></span>
|
||||||
</label>
|
</label>
|
||||||
<div class="helpicon cf_tip" i18n_title="pidTuningGyroNotchCutoffHelp"></div>
|
<div class="helpicon cf_tip" i18n_title="pidTuningGyroNotchCutoffHelp"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -247,8 +247,8 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, '3.0.0')) {
|
if (semver.gte(CONFIG.flightControllerVersion, '3.0.0')) {
|
||||||
$('.pid_filter input[name="gyroNotchFrequency"]').val(FILTER_CONFIG.gyro_soft_notch_hz);
|
$('.pid_filter input[name="gyroNotch1Frequency"]').val(FILTER_CONFIG.gyro_soft_notch_hz_1);
|
||||||
$('.pid_filter input[name="gyroNotchCutoff"]').val(FILTER_CONFIG.gyro_soft_notch_cutoff);
|
$('.pid_filter input[name="gyroNotch1Cutoff"]').val(FILTER_CONFIG.gyro_soft_notch_cutoff_1);
|
||||||
$('.pid_filter input[name="dTermNotchFrequency"]').val(FILTER_CONFIG.dterm_notch_hz);
|
$('.pid_filter input[name="dTermNotchFrequency"]').val(FILTER_CONFIG.dterm_notch_hz);
|
||||||
$('.pid_filter input[name="dTermNotchCutoff"]').val(FILTER_CONFIG.dterm_notch_cutoff);
|
$('.pid_filter input[name="dTermNotchCutoff"]').val(FILTER_CONFIG.dterm_notch_cutoff);
|
||||||
|
|
||||||
|
@ -257,6 +257,10 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
|
|
||||||
$('input[name="dtermSetpoint-number"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
|
$('input[name="dtermSetpoint-number"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
|
||||||
$('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
|
$('input[name="dtermSetpoint-range"]').val(ADVANCED_TUNING.dtermSetpointWeight / 100);
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, '3.0.1')) {
|
||||||
|
$('.pid_filter input[name="gyroNotch2Frequency"]').val(FILTER_CONFIG.gyro_soft_notch_hz_2);
|
||||||
|
$('.pid_filter input[name="gyroNotch2Cutoff"]').val(FILTER_CONFIG.gyro_soft_notch_cutoff_2);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('.pid_filter .newFilter').hide();
|
$('.pid_filter .newFilter').hide();
|
||||||
}
|
}
|
||||||
|
@ -356,10 +360,14 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
ADVANCED_TUNING.ptermSetpointWeight = parseInt($('input[name="ptermSetpoint-number"]').val() * 100);
|
ADVANCED_TUNING.ptermSetpointWeight = parseInt($('input[name="ptermSetpoint-number"]').val() * 100);
|
||||||
ADVANCED_TUNING.dtermSetpointWeight = parseInt($('input[name="dtermSetpoint-number"]').val() * 100);
|
ADVANCED_TUNING.dtermSetpointWeight = parseInt($('input[name="dtermSetpoint-number"]').val() * 100);
|
||||||
|
|
||||||
FILTER_CONFIG.gyro_soft_notch_hz = parseInt($('.pid_filter input[name="gyroNotchFrequency"]').val());
|
FILTER_CONFIG.gyro_soft_notch_hz_1 = parseInt($('.pid_filter input[name="gyroNotch1Frequency"]').val());
|
||||||
FILTER_CONFIG.gyro_soft_notch_cutoff = parseInt($('.pid_filter input[name="gyroNotchCutoff"]').val());
|
FILTER_CONFIG.gyro_soft_notch_cutoff_1 = parseInt($('.pid_filter input[name="gyroNotch1Cutoff"]').val());
|
||||||
FILTER_CONFIG.dterm_notch_hz = parseInt($('.pid_filter input[name="dTermNotchFrequency"]').val());
|
FILTER_CONFIG.dterm_notch_hz = parseInt($('.pid_filter input[name="dTermNotchFrequency"]').val());
|
||||||
FILTER_CONFIG.dterm_notch_cutoff = parseInt($('.pid_filter input[name="dTermNotchCutoff"]').val());
|
FILTER_CONFIG.dterm_notch_cutoff = parseInt($('.pid_filter input[name="dTermNotchCutoff"]').val());
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, '3.0.1')) {
|
||||||
|
FILTER_CONFIG.gyro_soft_notch_hz_2 = parseInt($('.pid_filter input[name="gyroNotch2Frequency"]').val());
|
||||||
|
FILTER_CONFIG.gyro_soft_notch_cutoff_2 = parseInt($('.pid_filter input[name="gyroNotch2Cutoff"]').val());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue