You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
inav-configurator/tabs/programming.js

71 lines
1.8 KiB
JavaScript

'use strict';
TABS.programming = {};
TABS.programming.initialize = function (callback, scrollPosition) {
let loadChainer = new MSPChainerClass(),
saveChainer = new MSPChainerClass(),
statusChainer = new MSPChainerClass();
if (GUI.active_tab != 'programming') {
GUI.active_tab = 'programming';
googleAnalytics.sendAppView('Programming');
}
loadChainer.setChain([
mspHelper.loadLogicConditions,
mspHelper.loadGlobalFunctions
]);
loadChainer.setExitPoint(loadHtml);
loadChainer.execute();
saveChainer.setChain([
mspHelper.sendLogicConditions,
mspHelper.sendGlobalFunctions,
mspHelper.saveToEeprom
]);
statusChainer.setChain([
mspHelper.loadLogicConditionsStatus,
mspHelper.loadGlobalVariablesStatus
]);
statusChainer.setExitPoint(onStatusPullDone);
function loadHtml() {
GUI.load("./tabs/programming.html", processHtml);
}
function processHtml() {
LOGIC_CONDITIONS.init($('#logic-wrapper'));
LOGIC_CONDITIONS.render();
GLOBAL_FUNCTIONS.init($('#functions-wrapper'));
GLOBAL_FUNCTIONS.render();
5 years ago
helper.tabs.init($('.tab-programming'));
localize();
$('#save-button').click(function () {
saveChainer.execute();
});
if (semver.gte(CONFIG.flightControllerVersion, "2.3.0")) {
helper.mspBalancedInterval.add('logic_conditions_pull', 100, 1, function () {
statusChainer.execute();
});
}
GUI.content_ready(callback);
}
function onStatusPullDone() {
LOGIC_CONDITIONS.update(LOGIC_CONDITIONS_STATUS);
5 years ago
GLOBAL_VARIABLES_STATUS.update($('.tab-programming'));
}
}
TABS.programming.cleanup = function (callback) {
if (callback) callback();
};