1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-20 23:05:15 +03:00

Merge pull request #1875 from McGiverGim/fix_throttle_preview

Fix throttle preview refresh
This commit is contained in:
Michael Keller 2020-02-08 13:23:24 +13:00 committed by GitHub
commit a27ffbd453
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -925,28 +925,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'));
@ -1154,6 +1132,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")) {