Switches enable/disable notch filters (configurator side only)
parent
e0733b77f4
commit
a6ab3d9a3a
10
js/fc.js
10
js/fc.js
|
@ -56,6 +56,7 @@ var FILTER_CONFIG;
|
|||
var ADVANCED_TUNING;
|
||||
var SENSOR_CONFIG;
|
||||
var COPY_PROFILE;
|
||||
var DEFAULT;
|
||||
|
||||
var FC = {
|
||||
resetState: function() {
|
||||
|
@ -392,5 +393,14 @@ var FC = {
|
|||
};
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -826,11 +826,6 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
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();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
FILTER_CONFIG.enable_gyro_soft_notch_1 = data.readU8();
|
||||
FILTER_CONFIG.enable_gyro_soft_notch_2 = data.readU8();
|
||||
FILTER_CONFIG.enable_dterm_notch = data.readU8();
|
||||
}
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
FILTER_CONFIG.dterm_filter_type = data.readU8();
|
||||
|
@ -1454,11 +1449,6 @@ MspHelper.prototype.crunch = function(code) {
|
|||
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)
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
buffer.push8(FILTER_CONFIG.enable_gyro_soft_notch_1)
|
||||
.push8(FILTER_CONFIG.enable_gyro_soft_notch_2)
|
||||
.push8(FILTER_CONFIG.enable_dterm_notch);
|
||||
}
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
buffer.push8(FILTER_CONFIG.dterm_filter_type);
|
||||
|
|
|
@ -259,7 +259,6 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$('.pid_sensitivity').hide();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
$('.profile select[name="dtermFilterType"]').val(FILTER_CONFIG.dterm_filter_type);
|
||||
$('.antigravity input[name="itermThrottleThreshold"]').val(ADVANCED_TUNING.itermThrottleThreshold);
|
||||
|
@ -267,34 +266,40 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
} else {
|
||||
$('.dtermfiltertype').hide();
|
||||
$('.antigravity').hide();
|
||||
=======
|
||||
}
|
||||
|
||||
$('input[id="gyroNotch1Enabled"]').change(function() {
|
||||
FILTER_CONFIG.enable_gyro_soft_notch_1 = $(this).is(':checked') ? 1 : 0;
|
||||
$('.pid_filter input[name="gyroNotch1Frequency"]').attr('disabled', !FILTER_CONFIG.enable_gyro_soft_notch_1);
|
||||
$('.pid_filter input[name="gyroNotch1Cutoff"]').attr('disabled', !FILTER_CONFIG.enable_gyro_soft_notch_1);
|
||||
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() {
|
||||
FILTER_CONFIG.enable_gyro_soft_notch_2 = $(this).is(':checked') ? 1 : 0;
|
||||
$('.pid_filter input[name="gyroNotch2Frequency"]').attr('disabled', !FILTER_CONFIG.enable_gyro_soft_notch_2);
|
||||
$('.pid_filter input[name="gyroNotch2Cutoff"]').attr('disabled', !FILTER_CONFIG.enable_gyro_soft_notch_2);
|
||||
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() {
|
||||
FILTER_CONFIG.enable_dterm_notch = $(this).is(':checked') ? 1 : 0;
|
||||
$('.pid_filter input[name="dTermNotchFrequency"]').attr('disabled', !FILTER_CONFIG.enable_dterm_notch);
|
||||
$('.pid_filter input[name="dTermNotchCutoff"]').attr('disabled', !FILTER_CONFIG.enable_dterm_notch);
|
||||
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);
|
||||
});
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
$('input[id="gyroNotch1Enabled"]').prop('checked', FILTER_CONFIG.enable_gyro_soft_notch_1 != 0).change();
|
||||
$('input[id="gyroNotch2Enabled"]').prop('checked', FILTER_CONFIG.enable_gyro_soft_notch_2 != 0).change();
|
||||
$('input[id="dtermNotchEnabled"]').prop('checked', FILTER_CONFIG.enable_dterm_notch != 0).change();
|
||||
$('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();
|
||||
} else {
|
||||
$('.switchGyroNotch1').hide();
|
||||
$('.switchGyroNotch2').hide();
|
||||
$('.switchDTermNotch').hide();
|
||||
>>>>>>> Added switches to turn on/off gyro notch 1/2 and dterm notch filters
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue