Merge pull request #2621 from haslinghuis/slider_patch

Small patch
10.8-maintenance
haslinghuis 2021-10-06 04:34:35 +02:00 committed by GitHub
commit 3f74761558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 11 deletions

View File

@ -3634,6 +3634,10 @@
"message": "<strong>Note:</strong> Sliders are disabled because values were changed manually. Clicking the '$t(pidTuningSliderEnableButton.message)' button will activate them again. This will reset the values and any unsaved changes will be lost.",
"description": "Tuning sliders disabled note when manual changes are detected"
},
"pidTuningPidSlidersDisabled": {
"message": "<strong>Note:</strong> Sliders are disabled. Clicking the '$t(pidTuningSliderEnableButton.message)' button will change the PID values to match your previously saved slider position.",
"description": "Tuning sliders disabled note"
},
"pidTuningSliderEnableButton": {
"message": "Enable Sliders",
"description": "Button label for enabling sliders"

View File

@ -361,16 +361,16 @@ TuningSliders.updateSlidersWarning = function(slidersUnavailable = false) {
let WARNING_I_GAIN = 120;
const WARNING_DMAX_GAIN = 60;
let WARNING_DMIN_GAIN = 40;
let condition;
let enableWarning;
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
WARNING_I_GAIN = 2.5 * FC.PIDS[0][0];
WARNING_DMIN_GAIN = 42;
condition = FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_DMAX_GAIN || FC.ADVANCED_TUNING.dMinRoll > WARNING_DMIN_GAIN;
enableWarning = FC.PIDS[0][0] > WARNING_P_GAIN || FC.PIDS[0][1] > WARNING_I_GAIN || FC.PIDS[0][2] > WARNING_DMAX_GAIN || FC.ADVANCED_TUNING.dMinRoll > WARNING_DMIN_GAIN;
} else {
condition = FC.PIDS[1][0] > WARNING_P_GAIN || FC.PIDS[1][1] > WARNING_I_GAIN || FC.PIDS[1][2] > WARNING_DMAX_GAIN || FC.ADVANCED_TUNING.dMinPitch > WARNING_DMIN_GAIN;
enableWarning = FC.PIDS[1][0] > WARNING_P_GAIN || FC.PIDS[1][1] > WARNING_I_GAIN || FC.PIDS[1][2] > WARNING_DMAX_GAIN || FC.ADVANCED_TUNING.dMinPitch > WARNING_DMIN_GAIN;
}
$('.subtab-pid .slidersWarning').toggle(condition && !slidersUnavailable);
$('.subtab-pid .slidersWarning').toggle(enableWarning && !slidersUnavailable);
};
TuningSliders.updateFilterSlidersWarning = function(gyroSliderUnavailable = false, DTermSliderUnavailable = false) {
@ -430,7 +430,7 @@ TuningSliders.updatePidSlidersDisplay = function() {
$('.subtab-pid .slidersDisabled').toggle(this.pidSlidersUnavailable);
$('.subtab-pid .nonExpertModeSlidersNote').toggle(!this.pidSlidersUnavailable && !this.expertMode);
this.updateSlidersWarning();
this.updateSlidersWarning(this.pidSlidersUnavailable);
};
TuningSliders.updateFilterSlidersDisplay = function() {

View File

@ -863,13 +863,14 @@ const FC = {
getPidDefaults() {
let versionPidDefaults = this.DEFAULT_PIDS;
// if defaults change they should go here
if (semver.gte(this.CONFIG.apiVersion, API_VERSION_1_43)) {
if (semver.eq(this.CONFIG.apiVersion, API_VERSION_1_43)) {
versionPidDefaults = [
42, 85, 35, 23, 90,
46, 90, 38, 25, 95,
45, 90, 0, 0, 90,
];
} else if (semver.gte(this.CONFIG.apiVersion, API_VERSION_1_44)) {
}
if (semver.gte(this.CONFIG.apiVersion, API_VERSION_1_44)) {
versionPidDefaults = [
45, 80, 40, 30, 120,
47, 84, 46, 34, 125,

View File

@ -1943,15 +1943,15 @@ TABS.pid_tuning.initialize = function (callback) {
const allowRP = originalMode === 0 && setMode === 0;
const allowRPY = originalMode < 2 && originalMode === setMode;
$('.ROLL .pid_data input').each(function() {
$('#pid_main .ROLL .pid_data input').each(function() {
$(this).prop('disabled', !allowRP);
});
$('.PITCH .pid_data input').each(function() {
$('#pid_main .PITCH .pid_data input').each(function() {
$(this).prop('disabled', !allowRP);
});
$('.YAW .pid_data input').each(function() {
$('#pid_main .YAW .pid_data input').each(function() {
$(this).prop('disabled', !allowRPY);
});
}).trigger('change');

View File

@ -157,7 +157,7 @@
<div class="gui_box topspacer slidersDisabled">
<table class="note-button">
<td i18n="pidTuningSlidersDisabled"></td>
<td i18n="pidTuningPidSlidersDisabled"></td>
<td>
<a href="#" class="buttonPidTuningSliders regular-button" i18n="pidTuningSliderEnableButton"></a>
</td>