Merge pull request #2651 from Asizon/integrated_yaw_fix
Nice, works all as expected. Enabled editing: sets YPR to PR. Setting back to YPR disables integrated yaw. resets works as expected.10.8-maintenance
commit
79e081f0f7
|
@ -409,8 +409,10 @@ TuningSliders.updatePidSlidersDisplay = function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($('input[id="useIntegratedYaw"]').is(':checked')) {
|
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
this.pidSlidersUnavailable = true;
|
if ($('input[id="useIntegratedYaw"]').is(':checked')) {
|
||||||
|
this.pidSlidersUnavailable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.pidSlidersUnavailable) {
|
if (!this.pidSlidersUnavailable) {
|
||||||
|
|
|
@ -596,6 +596,10 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
|
|
||||||
$('input[id="useIntegratedYaw"]').change(function() {
|
$('input[id="useIntegratedYaw"]').change(function() {
|
||||||
const checked = $(this).is(':checked');
|
const checked = $(this).is(':checked');
|
||||||
|
// 4.3 firmware has RP mode.
|
||||||
|
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
|
$('#pid_main .pid_data input').prop('disabled', !checked);
|
||||||
|
}
|
||||||
$('#pidTuningIntegratedYawCaution').toggle(checked);
|
$('#pidTuningIntegratedYawCaution').toggle(checked);
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
|
@ -2125,9 +2129,11 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// exclude integratedYaw from setDirty for 4.3 as it uses RP mode.
|
||||||
$('#pid-tuning').find('input').each(function (k, item) {
|
$('#pid-tuning').find('input').each(function (k, item) {
|
||||||
if ($(item).attr('class') !== "feature toggle"
|
if ($(item).attr('class') !== "feature toggle"
|
||||||
&& $(item).attr('class') !== "nonProfile") {
|
&& $(item).attr('class') !== "nonProfile"
|
||||||
|
&& (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) && $(item).attr('id'))) {
|
||||||
$(item).change(function () {
|
$(item).change(function () {
|
||||||
self.setDirty(true);
|
self.setDirty(true);
|
||||||
});
|
});
|
||||||
|
@ -2254,8 +2260,19 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable slides if Integrated Yaw is enabled or Slider PID mode is set to OFF
|
const useIntegratedYaw = $('input[id="useIntegratedYaw"]');
|
||||||
$('input[id="useIntegratedYaw"]').change(() => TuningSliders.updatePidSlidersDisplay());
|
|
||||||
|
useIntegratedYaw.on('change', () => {
|
||||||
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
|
// set slider to RP mode if Integrated Yaw is enabled and sliders are enabled
|
||||||
|
if (useIntegratedYaw.is(':checked') && TuningSliders.sliderPidsMode) {
|
||||||
|
sliderPidsModeSelect.val(1).trigger('change');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// disable sliders if Integrated Yaw is enabled or Slider PID mode is set to OFF
|
||||||
|
TuningSliders.updatePidSlidersDisplay();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// trigger Slider Display update when PID / Filter mode is changed
|
// trigger Slider Display update when PID / Filter mode is changed
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
|
||||||
|
@ -2270,6 +2287,11 @@ TABS.pid_tuning.initialize = function (callback) {
|
||||||
const disableRP = !!setMode;
|
const disableRP = !!setMode;
|
||||||
const disableY = setMode > 1;
|
const disableY = setMode > 1;
|
||||||
|
|
||||||
|
// disable Integrated Yaw when going into RPY mode
|
||||||
|
if (setMode === 2) {
|
||||||
|
useIntegratedYaw.prop('checked', false).trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
$('#pid_main .ROLL .pid_data input, #pid_main .PITCH .pid_data input').each(function() {
|
$('#pid_main .ROLL .pid_data input, #pid_main .PITCH .pid_data input').each(function() {
|
||||||
$(this).prop('disabled', disableRP);
|
$(this).prop('disabled', disableRP);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue