mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 21:05:30 +03:00
Refactor and up to date filters for Betaflight 3.4
This commit is contained in:
parent
ba968fe940
commit
3be244e7a5
6 changed files with 413 additions and 144 deletions
|
@ -822,20 +822,29 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
}
|
||||
break;
|
||||
case MSPCodes.MSP_FILTER_CONFIG:
|
||||
FILTER_CONFIG.gyro_soft_lpf_hz = data.readU8();
|
||||
FILTER_CONFIG.dterm_lpf_hz = data.readU16();
|
||||
FILTER_CONFIG.yaw_lpf_hz = data.readU16();
|
||||
FILTER_CONFIG.gyro_lowpass_hz = data.readU8();
|
||||
FILTER_CONFIG.dterm_lowpass_hz = data.readU16();
|
||||
FILTER_CONFIG.yaw_lowpass_hz = data.readU16();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||
FILTER_CONFIG.gyro_soft_notch_hz_1 = data.readU16();
|
||||
FILTER_CONFIG.gyro_soft_notch_cutoff_1 = data.readU16();
|
||||
FILTER_CONFIG.gyro_notch_hz = data.readU16();
|
||||
FILTER_CONFIG.gyro_notch_cutoff = data.readU16();
|
||||
FILTER_CONFIG.dterm_notch_hz = 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();
|
||||
FILTER_CONFIG.gyro_notch2_hz = data.readU16();
|
||||
FILTER_CONFIG.gyro_notch2_cutoff = data.readU16();
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
FILTER_CONFIG.dterm_filter_type = data.readU8();
|
||||
FILTER_CONFIG.dterm_lowpass_type = data.readU8();
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
FILTER_CONFIG.gyro_hardware_lpf = data.readU8();
|
||||
FILTER_CONFIG.gyro_32khz_hardware_lpf = data.readU8();
|
||||
FILTER_CONFIG.gyro_soft_lpf_hz = data.readU16();
|
||||
FILTER_CONFIG.gyro_lowpass2_hz = data.readU16();
|
||||
FILTER_CONFIG.gyro_lowpass_type = data.readU8();
|
||||
FILTER_CONFIG.gyro_lowpass2_type = data.readU8();
|
||||
FILTER_CONFIG.dterm_lowpass2_hz = data.readU16();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1455,19 +1464,28 @@ MspHelper.prototype.crunch = function(code) {
|
|||
break;
|
||||
case MSPCodes.MSP_SET_FILTER_CONFIG:
|
||||
buffer.push8(FILTER_CONFIG.gyro_soft_lpf_hz)
|
||||
.push16(FILTER_CONFIG.dterm_lpf_hz)
|
||||
.push16(FILTER_CONFIG.yaw_lpf_hz);
|
||||
.push16(FILTER_CONFIG.dterm_lowpass_hz)
|
||||
.push16(FILTER_CONFIG.yaw_lowpass_hz);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
|
||||
buffer.push16(FILTER_CONFIG.gyro_soft_notch_hz_1)
|
||||
.push16(FILTER_CONFIG.gyro_soft_notch_cutoff_1)
|
||||
buffer.push16(FILTER_CONFIG.gyro_notch_hz)
|
||||
.push16(FILTER_CONFIG.gyro_notch_cutoff)
|
||||
.push16(FILTER_CONFIG.dterm_notch_hz)
|
||||
.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)
|
||||
buffer.push16(FILTER_CONFIG.gyro_notch2_hz)
|
||||
.push16(FILTER_CONFIG.gyro_notch2_cutoff)
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
buffer.push8(FILTER_CONFIG.dterm_filter_type);
|
||||
buffer.push8(FILTER_CONFIG.dterm_lowpass_type);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
buffer.push8(FILTER_CONFIG.gyro_hardware_lpf)
|
||||
.push8(FILTER_CONFIG.gyro_32khz_hardware_lpf)
|
||||
.push16(FILTER_CONFIG.gyro_lowpass_hz)
|
||||
.push16(FILTER_CONFIG.gyro_lowpass2_hz)
|
||||
.push8(FILTER_CONFIG.gyro_lowpass_type)
|
||||
.push8(FILTER_CONFIG.gyro_lowpass2_type)
|
||||
.push16(FILTER_CONFIG.dterm_lowpass2_hz);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue