mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
Add RPM filter configuration
This commit is contained in:
parent
fe08a7833e
commit
25fe13be25
7 changed files with 156 additions and 5 deletions
|
@ -409,6 +409,8 @@ var FC = {
|
|||
dyn_notch_width_percent: 0,
|
||||
dyn_notch_q: 0,
|
||||
dyn_notch_min_hz: 0,
|
||||
gyro_rpm_notch_harmonics: 0,
|
||||
gyro_rpm_notch_min_hz: 0,
|
||||
};
|
||||
|
||||
ADVANCED_TUNING = {
|
||||
|
@ -550,6 +552,7 @@ var FC = {
|
|||
gyro_notch_hz: 400,
|
||||
gyro_notch2_cutoff: 100,
|
||||
gyro_notch2_hz: 200,
|
||||
gyro_rpm_notch_harmonics: 3,
|
||||
dterm_lowpass_hz: 100,
|
||||
dterm_lowpass_dyn_min_hz: 150,
|
||||
dterm_lowpass_dyn_max_hz: 250,
|
||||
|
|
|
@ -1026,6 +1026,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FILTER_CONFIG.dyn_notch_width_percent = data.readU8();
|
||||
FILTER_CONFIG.dyn_notch_q = data.readU16();
|
||||
FILTER_CONFIG.dyn_notch_min_hz = data.readU16();
|
||||
|
||||
FILTER_CONFIG.gyro_rpm_notch_harmonics = data.readU8();
|
||||
FILTER_CONFIG.gyro_rpm_notch_min_hz = data.readU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1675,6 +1678,7 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push16(MOTOR_CONFIG.mincommand);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
buffer.push8(MOTOR_CONFIG.motor_poles);
|
||||
buffer.push8(MOTOR_CONFIG.use_dshot_telemetry ? 1 : 0);
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SET_GPS_CONFIG:
|
||||
|
@ -1920,7 +1924,9 @@ MspHelper.prototype.crunch = function(code) {
|
|||
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);
|
||||
.push16(FILTER_CONFIG.dyn_notch_min_hz)
|
||||
.push8(FILTER_CONFIG.gyro_rpm_notch_harmonics)
|
||||
.push8(FILTER_CONFIG.gyro_rpm_notch_min_hz);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
TABS.configuration = {
|
||||
DSHOT_PROTOCOL_MIN_VALUE: 5,
|
||||
PROSHOT_PROTOCOL_VALUE: 0,
|
||||
SHOW_OLD_BATTERY_CONFIG: false,
|
||||
analyticsChanges: {},
|
||||
};
|
||||
|
@ -417,6 +418,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
|
||||
escprotocols.push('PROSHOT1000');
|
||||
self.PROSHOT_PROTOCOL_VALUE = escprotocols.length - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,7 +439,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$('input[id="unsyncedPWMSwitch"]').prop('checked', PID_ADVANCED_CONFIG.use_unsyncedPwm !== 0).change();
|
||||
$('input[name="unsyncedpwmfreq"]').val(PID_ADVANCED_CONFIG.motor_pwm_rate);
|
||||
$('input[name="digitalIdlePercent"]').val(PID_ADVANCED_CONFIG.digitalIdlePercent);
|
||||
|
||||
$('input[id="dshotBidir"]').prop('checked', MOTOR_CONFIG.use_dshot_telemetry).change();
|
||||
$('input[name="motorPoles"]').val(MOTOR_CONFIG.motor_poles);
|
||||
|
||||
esc_protocol_e.val(PID_ADVANCED_CONFIG.fast_pwm_protocol + 1);
|
||||
esc_protocol_e.change(function () {
|
||||
|
@ -458,6 +461,10 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$('div.unsyncedpwmfreq').hide();
|
||||
|
||||
$('div.digitalIdlePercent').show();
|
||||
|
||||
$('div.checkboxDshotBidir').toggle(semver.gte(CONFIG.apiVersion, "1.42.0") && escProtocolValue < self.PROSHOT_PROTOCOL_VALUE);
|
||||
$('div.motorPoles').toggle(semver.gte(CONFIG.apiVersion, "1.42.0"));
|
||||
|
||||
} else {
|
||||
$('div.minthrottle').show();
|
||||
$('div.maxthrottle').show();
|
||||
|
@ -467,7 +474,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
$("input[id='unsyncedPWMSwitch']").change();
|
||||
|
||||
$('div.digitalIdlePercent').hide();
|
||||
|
||||
$('div.checkboxDshotBidir').hide();
|
||||
$('div.motorPoles').hide();
|
||||
}
|
||||
|
||||
}).change();
|
||||
|
||||
|
||||
|
@ -1068,6 +1079,10 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
MOTOR_CONFIG.minthrottle = parseInt($('input[name="minthrottle"]').val());
|
||||
MOTOR_CONFIG.maxthrottle = parseInt($('input[name="maxthrottle"]').val());
|
||||
MOTOR_CONFIG.mincommand = parseInt($('input[name="mincommand"]').val());
|
||||
if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
|
||||
MOTOR_CONFIG.motor_poles = parseInt($('input[name="motorPoles"]').val());
|
||||
MOTOR_CONFIG.use_dshot_telemetry = $('input[id="dshotBidir"]').prop('checked');
|
||||
}
|
||||
|
||||
if(self.SHOW_OLD_BATTERY_CONFIG) {
|
||||
MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val());
|
||||
|
|
|
@ -44,6 +44,8 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
return MSP.promise(MSPCodes.MSP_FILTER_CONFIG);
|
||||
}).then(function() {
|
||||
return MSP.promise(MSPCodes.MSP_RC_DEADBAND);
|
||||
}).then(function() {
|
||||
return MSP.promise(MSPCodes.MSP_MOTOR_CONFIG);
|
||||
}).then(function() {
|
||||
MSP.send_message(MSPCodes.MSP_MIXER_CONFIG, false, false, load_html);
|
||||
});
|
||||
|
@ -351,9 +353,29 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
$('.pid_filter input[name="dynamicNotchQ"]').val(FILTER_CONFIG.dyn_notch_q);
|
||||
$('.pid_filter input[name="dynamicNotchMinHz"]').val(FILTER_CONFIG.dyn_notch_min_hz);
|
||||
|
||||
$('.rpmFilter').toggle(MOTOR_CONFIG.use_dshot_telemetry);
|
||||
|
||||
$('.pid_filter input[name="rpmFilterHarmonics"]').val(FILTER_CONFIG.gyro_rpm_notch_harmonics);
|
||||
$('.pid_filter input[name="rpmFilterMinHz"]').val(FILTER_CONFIG.gyro_rpm_notch_min_hz);
|
||||
|
||||
$('.pid_filter #rpmFilterEnabled').change(function() {
|
||||
|
||||
let harmonics = $('.pid_filter input[name="rpmFilterHarmonics"]').val();
|
||||
let checked = $(this).is(':checked') && harmonics != 0;
|
||||
|
||||
$('.pid_filter input[name="rpmFilterHarmonics"]').attr('disabled', !checked);
|
||||
$('.pid_filter input[name="rpmFilterMinHz"]').attr('disabled', !checked);
|
||||
|
||||
if (harmonics == 0) {
|
||||
$('.pid_filter input[name="rpmFilterHarmonics"]').val(FILTER_DEFAULT.gyro_rpm_notch_harmonics);
|
||||
}
|
||||
}).prop('checked', FILTER_CONFIG.gyro_rpm_notch_harmonics != 0).change();
|
||||
|
||||
|
||||
} else {
|
||||
$('.itermRelaxCutoff').hide();
|
||||
$('.dynamicNotch').hide();
|
||||
$('.rpmFilter').hide();
|
||||
}
|
||||
|
||||
$('input[id="useIntegratedYaw"]').change(function() {
|
||||
|
@ -723,6 +745,10 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
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());
|
||||
|
||||
let rpmFilterEnabled = $('.pid_filter #rpmFilterEnabled').is(':checked');
|
||||
FILTER_CONFIG.gyro_rpm_notch_harmonics = rpmFilterEnabled ? parseInt($('.pid_filter input[name="rpmFilterHarmonics"]').val()) : 0;
|
||||
FILTER_CONFIG.gyro_rpm_notch_min_hz = parseInt($('.pid_filter input[name="rpmFilterMinHz"]').val());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue