Skip to content

Commit 79e081f

Browse files
author
Ivan Efimov
authored
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.
2 parents 9b080c3 + 476ba71 commit 79e081f

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

src/js/TuningSliders.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,10 @@ TuningSliders.updatePidSlidersDisplay = function() {
409409
});
410410
});
411411

412-
if ($('input[id="useIntegratedYaw"]').is(':checked')) {
413-
this.pidSlidersUnavailable = true;
412+
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
413+
if ($('input[id="useIntegratedYaw"]').is(':checked')) {
414+
this.pidSlidersUnavailable = true;
415+
}
414416
}
415417

416418
if (!this.pidSlidersUnavailable) {

src/js/tabs/pid_tuning.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ TABS.pid_tuning.initialize = function (callback) {
596596

597597
$('input[id="useIntegratedYaw"]').change(function() {
598598
const checked = $(this).is(':checked');
599+
// 4.3 firmware has RP mode.
600+
if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
601+
$('#pid_main .pid_data input').prop('disabled', !checked);
602+
}
599603
$('#pidTuningIntegratedYawCaution').toggle(checked);
600604
}).change();
601605

@@ -2125,9 +2129,11 @@ TABS.pid_tuning.initialize = function (callback) {
21252129
});
21262130
});
21272131

2132+
// exclude integratedYaw from setDirty for 4.3 as it uses RP mode.
21282133
$('#pid-tuning').find('input').each(function (k, item) {
21292134
if ($(item).attr('class') !== "feature toggle"
2130-
&& $(item).attr('class') !== "nonProfile") {
2135+
&& $(item).attr('class') !== "nonProfile"
2136+
&& (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) && $(item).attr('id'))) {
21312137
$(item).change(function () {
21322138
self.setDirty(true);
21332139
});
@@ -2254,8 +2260,19 @@ TABS.pid_tuning.initialize = function (callback) {
22542260
});
22552261
}
22562262

2257-
// disable slides if Integrated Yaw is enabled or Slider PID mode is set to OFF
2258-
$('input[id="useIntegratedYaw"]').change(() => TuningSliders.updatePidSlidersDisplay());
2263+
const useIntegratedYaw = $('input[id="useIntegratedYaw"]');
2264+
2265+
useIntegratedYaw.on('change', () => {
2266+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
2267+
// set slider to RP mode if Integrated Yaw is enabled and sliders are enabled
2268+
if (useIntegratedYaw.is(':checked') && TuningSliders.sliderPidsMode) {
2269+
sliderPidsModeSelect.val(1).trigger('change');
2270+
}
2271+
} else {
2272+
// disable sliders if Integrated Yaw is enabled or Slider PID mode is set to OFF
2273+
TuningSliders.updatePidSlidersDisplay();
2274+
}
2275+
});
22592276

22602277
// trigger Slider Display update when PID / Filter mode is changed
22612278
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
@@ -2270,6 +2287,11 @@ TABS.pid_tuning.initialize = function (callback) {
22702287
const disableRP = !!setMode;
22712288
const disableY = setMode > 1;
22722289

2290+
// disable Integrated Yaw when going into RPY mode
2291+
if (setMode === 2) {
2292+
useIntegratedYaw.prop('checked', false).trigger('change');
2293+
}
2294+
22732295
$('#pid_main .ROLL .pid_data input, #pid_main .PITCH .pid_data input').each(function() {
22742296
$(this).prop('disabled', disableRP);
22752297
});

0 commit comments

Comments
 (0)