From 10916a5cfc1464f53147764395e5910565ecbab0 Mon Sep 17 00:00:00 2001 From: Miguel Angel Mulero Martinez Date: Thu, 6 Feb 2020 09:44:14 +0100 Subject: [PATCH] Fix throttle preview refresh --- src/js/tabs/pid_tuning.js | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index d2d3d3dc..5e01cd39 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -914,28 +914,6 @@ TABS.pid_tuning.initialize = function (callback) { self.currentRates.rc_expo_pitch = self.currentRates.rc_expo; } - function activateSubtab(subtabName) { - const names = ['pid', 'rates', 'filter']; - if (!names.includes(subtabName)) { - console.debug('Invalid subtab name: "' + subtabName + '"'); - return; - } - for (name of names) { - const el = $('.tab-pid_tuning .subtab-' + name); - el[name == subtabName ? 'show' : 'hide'](); - } - $('.tab-pid_tuning .tab-container .tab').removeClass('active'); - $('.tab-pid_tuning .tab-container .' + subtabName).addClass('active'); - self.activeSubtab = subtabName; - if (subtabName == 'rates') { - // force drawing of throttle curve once the throttle curve container element is available - // deferring drawing like this is needed to acquire the exact pixel size of the canvas - redrawThrottleCurve(true); - } - } - - activateSubtab(self.activeSubtab); - $('.tab-pid_tuning .tab-container .pid').on('click', () => activateSubtab('pid')); $('.tab-pid_tuning .tab-container .rates').on('click', () => activateSubtab('rates')); @@ -1143,6 +1121,28 @@ TABS.pid_tuning.initialize = function (callback) { pid_and_rc_to_form(); + function activateSubtab(subtabName) { + const names = ['pid', 'rates', 'filter']; + if (!names.includes(subtabName)) { + console.debug('Invalid subtab name: "' + subtabName + '"'); + return; + } + for (name of names) { + const el = $('.tab-pid_tuning .subtab-' + name); + el[name == subtabName ? 'show' : 'hide'](); + } + $('.tab-pid_tuning .tab-container .tab').removeClass('active'); + $('.tab-pid_tuning .tab-container .' + subtabName).addClass('active'); + self.activeSubtab = subtabName; + if (subtabName == 'rates') { + // force drawing of throttle curve once the throttle curve container element is available + // deferring drawing like this is needed to acquire the exact pixel size of the canvas + redrawThrottleCurve(true); + } + } + + activateSubtab(self.activeSubtab); + var pidController_e = $('select[name="controller"]'); if (semver.lt(CONFIG.apiVersion, "1.31.0")) {