1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 16:25:19 +03:00
inav-configurator/tabs/advanced_tuning.js
Darren Lines 15dea6b6d3 Reconfigured Advanced Tuning
The Advanced Tuning page has been reconfigured. It now will show only relevant settings based on the platform. Fixed Wing and Multirotor have their own top sections. Other platforms see both those sections as a fall-back, The bottom section (generic) is visible for all platforms. There is no replication on any views.

I have also updated the code to use the new data-setting method. Though this seems to have added some lag in loading times.
2021-04-10 10:29:48 +01:00

71 lines
1.9 KiB
JavaScript

'use strict';
TABS.advanced_tuning = {};
TABS.advanced_tuning.initialize = function (callback) {
if (GUI.active_tab != 'advanced_tuning') {
GUI.active_tab = 'advanced_tuning';
googleAnalytics.sendAppView('AdvancedTuning');
}
loadHtml();
function loadHtml() {
GUI.load("./tabs/advanced_tuning.html", Settings.processHtml(function () {
if (FC.isAirplane()) {
$('.airplaneTuning').show();
$('.multirotorTuning').hide();
$('.notFixedWingTuning').hide();
} else if (FC.isMultirotor()) {
$('.airplaneTuning').hide();
$('.multirotorTuning').show();
$('.notFixedWingTuning').show();
} else {
$('.airplaneTuning').show();
$('.multirotorTuning').show();
$('.notFixedWingTuning').show();
}
GUI.simpleBind();
localize();
$('a.save').click(function () {
Settings.saveInputs().then(function () {
var self = this;
MSP.promise(MSPCodes.MSP_EEPROM_WRITE);
var oldText = $(this).text();
$(this).html("Saved");
setTimeout(function () {
$(self).html(oldText);
}, 2000);
reboot();
});
});
GUI.content_ready(callback);
}));
}
function reboot() {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('configurationEepromSaved'));
GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
});
}
function reinitialize() {
//noinspection JSUnresolvedVariable
GUI.log(chrome.i18n.getMessage('deviceRebooting'));
GUI.handleReconnect($('.tab_advanced_tuning a'));
}
};
TABS.advanced_tuning.cleanup = function (callback) {
if (callback) callback();
};