1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-23 16:25:19 +03:00

Fix additional tabs

This commit is contained in:
Pawel Spychalski (DzikuVx) 2024-05-05 21:40:10 +02:00
parent a4c3490d38
commit 07600e1fa6
11 changed files with 55 additions and 64 deletions

View file

@ -19,6 +19,20 @@ TABS.advanced_tuning.initialize = function (callback) {
loadHtml();
function save_to_eeprom() {
console.log('save_to_eeprom');
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, function () {
GUI.log(i18n.getMessage('eepromSaved'));
GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () {
GUI.log(i18n.getMessage('deviceRebooting'));
GUI.handleReconnect($('.tab_advanced_tuning a'));
});
});
});
}
function loadHtml() {
GUI.load(path.join(__dirname, "advanced_tuning.html"), Settings.processHtml(function () {
@ -68,35 +82,12 @@ TABS.advanced_tuning.initialize = function (callback) {
TABS.advanced_tuning.checkRequirements_LinearDescent();
$('a.save').on('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();
});
Settings.saveInputs(save_to_eeprom);
});
GUI.content_ready(callback);
}));
}
function reboot() {
//noinspection JSUnresolvedVariable
GUI.log(i18n.getMessage('configurationEepromSaved'));
GUI.tab_switch_cleanup(function () {
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize);
});
}
function reinitialize() {
//noinspection JSUnresolvedVariable
GUI.log(i18n.getMessage('deviceRebooting'));
GUI.handleReconnect($('.tab_advanced_tuning a'));
}
};