mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Merge pull request #1567 from IvoFPV/adddynnotchtoui
Add dynamic notch settings to UI
This commit is contained in:
commit
bac0417975
6 changed files with 171 additions and 0 deletions
|
@ -377,6 +377,10 @@ var FC = {
|
|||
dterm_notch_hz: 0,
|
||||
dterm_notch_cutoff: 0,
|
||||
yaw_lowpass_hz: 0,
|
||||
dyn_notch_range: 0,
|
||||
dyn_notch_width_percent: 0,
|
||||
dyn_notch_q: 0,
|
||||
dyn_notch_min_hz: 0,
|
||||
};
|
||||
|
||||
ADVANCED_TUNING = {
|
||||
|
|
|
@ -987,6 +987,12 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FILTER_CONFIG.gyro_lowpass_dyn_max_hz = data.readU16();
|
||||
FILTER_CONFIG.dterm_lowpass_dyn_min_hz = data.readU16();
|
||||
FILTER_CONFIG.dterm_lowpass_dyn_max_hz = data.readU16();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
FILTER_CONFIG.dyn_notch_range = data.readU8();
|
||||
FILTER_CONFIG.dyn_notch_width_percent = data.readU8();
|
||||
FILTER_CONFIG.dyn_notch_q = data.readU16();
|
||||
FILTER_CONFIG.dyn_notch_min_hz = data.readU16();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1747,6 +1753,12 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push16(FILTER_CONFIG.dterm_lowpass_dyn_min_hz)
|
||||
.push16(FILTER_CONFIG.dterm_lowpass_dyn_max_hz);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
buffer.push8(FILTER_CONFIG.dyn_notch_range)
|
||||
.push8(FILTER_CONFIG.dyn_notch_width_percent)
|
||||
.push16(FILTER_CONFIG.dyn_notch_q)
|
||||
.push16(FILTER_CONFIG.dyn_notch_min_hz);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SET_PID_ADVANCED:
|
||||
|
|
|
@ -352,8 +352,20 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
$('.smartfeedforward').hide();
|
||||
$('.itermRelaxCutoff').show();
|
||||
|
||||
if (FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')) {
|
||||
$('.dynamicNotch').show();
|
||||
} else {
|
||||
$('.dynamicNotch').hide();
|
||||
}
|
||||
|
||||
$('.pid_filter select[name="dynamicNotchRange"]').val(FILTER_CONFIG.dyn_notch_range);
|
||||
$('.pid_filter input[name="dynamicNotchWidthPercent"]').val(FILTER_CONFIG.dyn_notch_width_percent);
|
||||
$('.pid_filter input[name="dynamicNotchQ"]').val(FILTER_CONFIG.dyn_notch_q);
|
||||
$('.pid_filter input[name="dynamicNotchMinHz"]').val(FILTER_CONFIG.dyn_notch_min_hz);
|
||||
} else {
|
||||
$('.itermRelaxCutoff').hide();
|
||||
$('.dynamicNotch').hide();
|
||||
}
|
||||
|
||||
$('input[id="useIntegratedYaw"]').change(function() {
|
||||
|
@ -685,6 +697,12 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
ADVANCED_TUNING.useIntegratedYaw = $('input[id="useIntegratedYaw"]').is(':checked') ? 1 : 0;
|
||||
}
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
FILTER_CONFIG.dyn_notch_range = parseInt($('.pid_filter select[name="dynamicNotchRange"]').val());
|
||||
FILTER_CONFIG.dyn_notch_width_percent = parseInt($('.pid_filter input[name="dynamicNotchWidthPercent"]').val());
|
||||
FILTER_CONFIG.dyn_notch_q = parseInt($('.pid_filter input[name="dynamicNotchQ"]').val());
|
||||
FILTER_CONFIG.dyn_notch_min_hz = parseInt($('.pid_filter input[name="dynamicNotchMinHz"]').val());
|
||||
}
|
||||
}
|
||||
|
||||
function showAllPids() {
|
||||
|
@ -1068,6 +1086,22 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
dtermFilterSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||
});
|
||||
}
|
||||
// Added in API 1.42.0
|
||||
function loadDynamicNotchRangeValues() {
|
||||
var dynamicNotchRangeValues = [
|
||||
"HIGH", "MEDIUM", "LOW", "AUTO",
|
||||
];
|
||||
return dynamicNotchRangeValues;
|
||||
}
|
||||
function populateDynamicNotchRangeSelect(selectDynamicNotchRangeValues) {
|
||||
var dynamicNotchRangeSelect = $('select[name="dynamicNotchRange"]');
|
||||
selectDynamicNotchRangeValues.forEach(function(value, key) {
|
||||
dynamicNotchRangeSelect.append('<option value="' + key + '">' + value + '</option>');
|
||||
});
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
populateDynamicNotchRangeSelect(loadDynamicNotchRangeValues());
|
||||
}
|
||||
|
||||
populateFilterTypeSelector('gyroLowpassType', loadFilterTypeValues());
|
||||
populateFilterTypeSelector('gyroLowpassDynType', loadFilterTypeValues());
|
||||
|
@ -1785,9 +1819,19 @@ TABS.pid_tuning.updateFilterWarning = function() {
|
|||
var dtermDynamicLowpassEnabled = $('input[id="dtermLowpassDynEnabled"]').is(':checked');
|
||||
var dtermLowpass1Enabled = $('input[id="dtermLowpassEnabled"]').is(':checked');
|
||||
var warning_e = $('#pid-tuning .filterWarning');
|
||||
var warningDynamicNotch_e = $('#pid-tuning .dynamicNotchWarning');
|
||||
if (!(gyroDynamicLowpassEnabled || gyroLowpass1Enabled) || !(dtermDynamicLowpassEnabled || dtermLowpass1Enabled)) {
|
||||
warning_e.show();
|
||||
} else {
|
||||
warning_e.hide();
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
if (FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')) {
|
||||
warningDynamicNotch_e.hide();
|
||||
} else {
|
||||
warningDynamicNotch_e.show();
|
||||
}
|
||||
} else {
|
||||
warningDynamicNotch_e.hide();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue