Merge pull request #2653 from KarateBrot/dynNotchSwitch

Remove Dynamic Notch from "Features"
10.8-maintenance
J Blackman 2021-12-02 09:20:39 +11:00 committed by GitHub
commit 1497b544c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 116 additions and 115 deletions

View File

@ -84,9 +84,13 @@ const Features = function (config) {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) {
features.push(
{bit: 28, group: 'antiGravity', name: 'ANTI_GRAVITY', haveTip: true, hideName: true},
{bit: 29, group: 'other', name: 'DYNAMIC_FILTER'}
{bit: 28, group: 'antiGravity', name: 'ANTI_GRAVITY', haveTip: true, hideName: true}
);
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) { // DYNAMIC_FILTER got removed from FEATURES in BF 4.3 / API 1.44
features.push(
{bit: 29, group: 'other', name: 'DYNAMIC_FILTER'}
);
}
}
if (!semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_36)) {

View File

@ -377,51 +377,76 @@ TABS.pid_tuning.initialize = function (callback) {
}
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
const dynamicNotchWidthPercent_e = $('.pid_filter input[name="dynamicNotchWidthPercent"]');
const dynamicNotchQ_e = $('.pid_filter input[name="dynamicNotchQ"]');
const dynamicNotchCount_e = $('.pid_filter input[name="dynamicNotchCount"]');
$('.smartfeedforward').hide();
if (FC.FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')) {
$('.dynamicNotch').show();
} else {
$('.dynamicNotch').hide();
// Dynamic Notch Filter
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
if (FC.FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')) {
$('.dynamicNotch span.inputSwitch').hide();
} else {
$('.dynamicNotch').hide();
}
}
$('.dynamicNotchRange').toggle(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_43));
$('.pid_filter select[name="dynamicNotchRange"]').val(FC.FILTER_CONFIG.dyn_notch_range);
const dynamicNotchRange_e = $('.pid_filter select[name="dynamicNotchRange"]');
const dynamicNotchWidthPercent_e = $('.pid_filter input[name="dynamicNotchWidthPercent"]');
const dynamicNotchCount_e = $('.pid_filter input[name="dynamicNotchCount"]');
const dynamicNotchQ_e = $('.pid_filter input[name="dynamicNotchQ"]');
const dynamicNotchMinHz_e = $('.pid_filter input[name="dynamicNotchMinHz"]');
const dynamicNotchMaxHz_e = $('.pid_filter input[name="dynamicNotchMaxHz"]');
dynamicNotchRange_e.val(FC.FILTER_CONFIG.dyn_notch_range);
dynamicNotchWidthPercent_e.val(FC.FILTER_CONFIG.dyn_notch_width_percent);
dynamicNotchQ_e.val(FC.FILTER_CONFIG.dyn_notch_q);
dynamicNotchCount_e.val(FC.FILTER_CONFIG.dyn_notch_count);
$('.pid_filter input[name="dynamicNotchMinHz"]').val(FC.FILTER_CONFIG.dyn_notch_min_hz);
dynamicNotchQ_e.val(FC.FILTER_CONFIG.dyn_notch_q);
dynamicNotchMinHz_e.val(FC.FILTER_CONFIG.dyn_notch_min_hz);
dynamicNotchMaxHz_e.val(FC.FILTER_CONFIG.dyn_notch_max_hz);
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
$('.pid_filter input[name="dynamicNotchMinHz"]').attr("max","250");
$('.pid_filter input[name="dynamicNotchMaxHz"]').val(FC.FILTER_CONFIG.dyn_notch_max_hz);
dynamicNotchMinHz_e.attr("max","250");
} else {
$('.dynamicNotchMaxHz').hide();
}
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
$('.dynamicNotchHelp').attr('title', i18n.getMessage('pidTuningMultiDynamicNotchFilterHelp'));
$('.dynamicNotchWidthPercent').hide();
} else {
$('.dynamicNotchCount').hide();
}
const dynamicNotchSwitch_e = $('.pid_filter input[id="dynamicNotchEnabled"]');
dynamicNotchSwitch_e.on('change', function() {
const checked = $(this).is(':checked');
const count = parseInt(dynamicNotchCount_e.val());
if (checked && !count) {
dynamicNotchCount_e.val(FILTER_DEFAULT.dyn_notch_count);
}
$('.dynamicNotch span.suboption').toggle(checked);
$('.dynamicNotchRange').toggle(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_43) && checked);
$('.dynamicNotchMaxHz').toggle(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43) && checked);
$('.dynamicNotchWidthPercent').toggle(semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44) && checked);
$('.dynamicNotchCount').toggle(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) && checked);
}).prop('checked', FC.FILTER_CONFIG.dyn_notch_count !== 0 || FC.FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')).trigger('change');
// RPM Filter
$('.rpmFilter').toggle(FC.MOTOR_CONFIG.use_dshot_telemetry);
$('.pid_filter input[name="rpmFilterHarmonics"]').val(FC.FILTER_CONFIG.gyro_rpm_notch_harmonics);
$('.pid_filter input[name="rpmFilterMinHz"]').val(FC.FILTER_CONFIG.gyro_rpm_notch_min_hz);
const rpmFilterHarmonics_e = $('.pid_filter input[name="rpmFilterHarmonics"]');
const rpmFilterMinHz_e = $('.pid_filter input[name="rpmFilterMinHz"]');
$('.pid_filter #rpmFilterEnabled').change(function() {
rpmFilterHarmonics_e.val(FC.FILTER_CONFIG.gyro_rpm_notch_harmonics);
rpmFilterMinHz_e.val(FC.FILTER_CONFIG.gyro_rpm_notch_min_hz);
let harmonics = $('.pid_filter input[name="rpmFilterHarmonics"]').val();
let checked = $(this).is(':checked') && harmonics != 0;
$('.pid_filter #rpmFilterEnabled').on('change', function() {
$('.pid_filter input[name="rpmFilterHarmonics"]').attr('disabled', !checked);
$('.pid_filter input[name="rpmFilterMinHz"]').attr('disabled', !checked);
const harmonics = rpmFilterHarmonics_e.val();
const checked = $(this).is(':checked') && harmonics !== 0;
rpmFilterHarmonics_e.attr('disabled', !checked);
rpmFilterMinHz_e.attr('disabled', !checked);
if (harmonics == 0) {
$('.pid_filter input[name="rpmFilterHarmonics"]').val(FILTER_DEFAULT.gyro_rpm_notch_harmonics);
rpmFilterHarmonics_e.val(FILTER_DEFAULT.gyro_rpm_notch_harmonics);
}
if (checked !== (FC.FILTER_CONFIG.gyro_rpm_notch_harmonics !== 0)) { // if rpmFilterEnabled is not the same value as saved in the fc
@ -442,8 +467,10 @@ TABS.pid_tuning.initialize = function (callback) {
dynamicNotchQ_e.val(FC.FILTER_CONFIG.dyn_notch_q);
dynamicNotchWidthPercent_e.val(FC.FILTER_CONFIG.dyn_notch_width_percent);
}
$('.rpmFilter span.suboption').toggle(checked);
}).prop('checked', FC.FILTER_CONFIG.gyro_rpm_notch_harmonics != 0).change();
}).prop('checked', FC.FILTER_CONFIG.gyro_rpm_notch_harmonics !== 0).trigger('change');
} else {
$('.itermRelaxCutoff').hide();
@ -1325,7 +1352,7 @@ TABS.pid_tuning.initialize = function (callback) {
FC.FILTER_CONFIG.dyn_notch_q = parseInt($('.pid_filter input[name="dynamicNotchQ"]').val());
FC.FILTER_CONFIG.dyn_notch_min_hz = parseInt($('.pid_filter input[name="dynamicNotchMinHz"]').val());
let rpmFilterEnabled = $('.pid_filter #rpmFilterEnabled').is(':checked');
const rpmFilterEnabled = $('.pid_filter #rpmFilterEnabled').is(':checked');
FC.FILTER_CONFIG.gyro_rpm_notch_harmonics = rpmFilterEnabled ? parseInt($('.pid_filter input[name="rpmFilterHarmonics"]').val()) : 0;
FC.FILTER_CONFIG.gyro_rpm_notch_min_hz = parseInt($('.pid_filter input[name="rpmFilterMinHz"]').val());
}
@ -1356,7 +1383,9 @@ TABS.pid_tuning.initialize = function (callback) {
FC.ADVANCED_TUNING.vbat_sag_compensation = $('input[id="vbatSagCompensation"]').is(':checked') ? parseInt($('input[name="vbatSagValue"]').val()) : 0;
FC.ADVANCED_TUNING.thrustLinearization = $('input[id="thrustLinearization"]').is(':checked') ? parseInt($('input[name="thrustLinearValue"]').val()) : 0;
FC.FILTER_CONFIG.dyn_lpf_curve_expo = parseInt($('.pid_filter input[name="dtermLowpassExpo"]').val());
FC.FILTER_CONFIG.dyn_notch_count = parseInt($('.pid_filter input[name="dynamicNotchCount"]').val());
const dynamicNotchEnabled = $('.pid_filter input[id="dynamicNotchEnabled"]').is(':checked');
FC.FILTER_CONFIG.dyn_notch_count = dynamicNotchEnabled ? parseInt($('.pid_filter input[name="dynamicNotchCount"]').val()) : 0;
FC.TUNING_SLIDERS.slider_pids_mode = TuningSliders.sliderPidsMode;
//round slider values to nearest multiple of 5 and passes to the FW. Avoid dividing calc by (* x 100)/5 = 20
@ -3072,7 +3101,7 @@ TABS.pid_tuning.updateFilterWarning = function() {
} else {
warningE.hide();
}
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42)) {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42) && semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
if (FC.FEATURE_CONFIG.features.isEnabled('DYNAMIC_FILTER')) {
warningDynamicNotchE.hide();
} else {

View File

@ -1423,7 +1423,7 @@
</td>
</tr>
<tr>
<tr class="newFilter rpmFilter">
<th class="rpmFilter" colspan="2">
<div class="pid_mode rpmFilter">
<div i18n="pidTuningRpmFilterGroup"></div>
@ -1455,7 +1455,7 @@
</td>
</tr>
<tr>
<tr class="newFilter dynamicNotch">
<th class="dynamicNotch" colspan="2">
<div class="pid_mode dynamicNotch">
<div i18n="pidTuningDynamicNotchFilterGroup"></div>
@ -1463,87 +1463,55 @@
</div>
</th>
</tr>
<tr class="newFilter dynamicNotch dynamicNotchRange">
<td>
<select name="dynamicNotchRange">
<!-- Populated on execution -->
</select>
</td>
<td>
<div>
<label>
<span i18n="pidTuningDynamicNotchRange"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchRangeHelp"></div>
</div>
</td>
</tr>
<tr class="newFilter dynamicNotch dynamicNotchWidthPercent">
<td>
<input type="number" name="dynamicNotchWidthPercent" step="1" min="0" max="20"/>
</td>
<td>
<div>
<label>
<span i18n="pidTuningDynamicNotchWidthPercent"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchWidthPercentHelp"></div>
</div>
</td>
</tr>
<tr class="newFilter dynamicNotch dynamicNotchQ">
<td>
<input type="number" name="dynamicNotchQ" step="1" min="1" max="1000"/>
</td>
<td>
<div>
<label>
<span i18n="pidTuningDynamicNotchQ"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchQHelp"></div>
</div>
</td>
</tr>
<tr class="newFilter dynamicNotch dynamicNotchCount">
<td>
<input type="number" name="dynamicNotchCount" step="1" min="0" max="5"/>
</td>
<td>
<div>
<label>
<span i18n="pidTuningDynamicNotchCount"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchCountHelp"></div>
</div>
</td>
</tr>
<tr class="newFilter dynamicNotch">
<td>
<input type="number" name="dynamicNotchMinHz" step="1" min="60" max="1000"/>
</td>
<td>
<div>
<label>
<span i18n="pidTuningDynamicNotchMinHz"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchMinHzHelp"></div>
</div>
</td>
</tr>
<tr class="newFilter dynamicNotch dynamicNotchMaxHz">
<td>
<input type="number" name="dynamicNotchMaxHz" step="1" min="200" max="1000"/>
</td>
<td>
<div>
<label>
<span i18n="pidTuningDynamicNotchMaxHz"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchMaxHzHelp"></div>
</div>
</td>
</tr>
<tr class="newFilter dynamicNotch">
<td>
<span class="inputSwitch"><input type="checkbox" id="dynamicNotchEnabled" class="toggle" /></span>
</td>
<td colspan="2">
<span i18n="pidTuningDynamicNotchFilterGroup"></span>
<span class="suboption dynamicNotchRange">
<select name="dynamicNotchRange">
<!-- Populated on execution -->
</select>
<label><span i18n="pidTuningDynamicNotchRange"></span></label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchRangeHelp"></div>
</span>
<span class="suboption dynamicNotchWidthPercent">
<input type="number" name="dynamicNotchWidthPercent" step="1" min="0" max="20"/>
<label><span i18n="pidTuningDynamicNotchWidthPercent"></span></label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchWidthPercentHelp"></div>
</span>
<span class="suboption dynamicNotchCount">
<input type="number" name="dynamicNotchCount" step="1" min="1" max="5"/>
<label><span i18n="pidTuningDynamicNotchCount"></span></label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchCountHelp"></div>
</span>
<span class="suboption dynamicNotchQ">
<input type="number" name="dynamicNotchQ" step="1" min="1" max="1000"/>
<label><span i18n="pidTuningDynamicNotchQ"></span></label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchQHelp"></div>
</span>
<span class="suboption dynamicNotchMinHz">
<input type="number" name="dynamicNotchMinHz" step="1" min="60" max="1000"/>
<label><span i18n="pidTuningDynamicNotchMinHz"></span></label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchMinHzHelp"></div>
</span>
<span class="suboption dynamicNotchMaxHz">
<input type="number" name="dynamicNotchMaxHz" step="1" min="200" max="1000"/>
<label><span i18n="pidTuningDynamicNotchMaxHz"></span></label>
<div class="helpicon cf_tip" i18n_title="pidTuningDynamicNotchMaxHzHelp"></div>
</span>
</td>
</tr>
</table>
</div>
<div class="gui_box grey topspacer pid_filter two_columns_second">