1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +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

@ -618,7 +618,7 @@ var Settings = (function () {
var input = inputs.shift(); var input = inputs.shift();
var settingPair = self.processInput(input); var settingPair = self.processInput(input);
return mspHelper.setSetting(settingPair.setting, settingPair.value, function() { return mspHelper.setSetting(settingPair.setting, settingPair.value, function() {
return self.pickAndSaveSingleInput(inputs); return self.pickAndSaveSingleInput(inputs, finalCallback);
}); });
} else { } else {
if (finalCallback) { if (finalCallback) {

View file

@ -1714,7 +1714,9 @@
"auxiliaryEepromSaved": { "auxiliaryEepromSaved": {
"message": "EEPROM <span style=\"color: #37a8db\">saved</span>" "message": "EEPROM <span style=\"color: #37a8db\">saved</span>"
}, },
"eepromSaved": {
"message": "EEPROM <span style=\"color: #37a8db\">saved</span>"
},
"adjustmentsHelp": { "adjustmentsHelp": {
"message": "Configure adjustment switches. See the 'in-flight adjustments' section of the manual for details. The changes that adjustment functions make are not saved automatically. There are 4 slots. Each switch used to concurrently make adjustments requires exclusive use of a slot." "message": "Configure adjustment switches. See the 'in-flight adjustments' section of the manual for details. The changes that adjustment functions make are not saved automatically. There are 4 slots. Each switch used to concurrently make adjustments requires exclusive use of a slot."
}, },

View file

@ -216,7 +216,7 @@
</div> </div>
<div class="number"> <div class="number">
<input type="number" id="cruiseYawRate" data-setting="nav_fw_cruise_yaw_rate" data-setting-multiplier="1" step="1" min="0" max="60" /> <input type="number" id="cruiseYawRate" data-setting="nav_cruise_yaw_rate" data-setting-multiplier="1" step="1" min="0" max="60" />
<label for="cruiseYawRate"><span data-i18n="cruiseYawRateLabel"></span></label> <label for="cruiseYawRate"><span data-i18n="cruiseYawRateLabel"></span></label>
<div for="cruiseYawRate" class="helpicon cf_tip" data-i18n_title="cruiseYawRateHelp"></div> <div for="cruiseYawRate" class="helpicon cf_tip" data-i18n_title="cruiseYawRateHelp"></div>
</div> </div>

View file

@ -19,6 +19,20 @@ TABS.advanced_tuning.initialize = function (callback) {
loadHtml(); 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() { function loadHtml() {
GUI.load(path.join(__dirname, "advanced_tuning.html"), Settings.processHtml(function () { 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(); TABS.advanced_tuning.checkRequirements_LinearDescent();
$('a.save').on('click', function () { $('a.save').on('click', function () {
Settings.saveInputs().then(function () { Settings.saveInputs(save_to_eeprom);
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); 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'));
}
}; };

View file

@ -52,7 +52,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
]; ];
function saveSettings(onComplete) { function saveSettings(onComplete) {
Settings.saveInputs().then(onComplete); Settings.saveInputs(onComplete);
} }
saveChainer.setChain(saveChain); saveChainer.setChain(saveChain);

View file

@ -127,29 +127,22 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
load_failssafe_config(); load_failssafe_config();
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_failsafe a'));
});
});
});
}
function savePhaseTwo() { function savePhaseTwo() {
Settings.saveInputs().then(function () { Settings.saveInputs(save_to_eeprom);
var self = this;
MSP.promise(MSPCodes.MSP_EEPROM_WRITE);
setTimeout(function () {
$(self).html('');
}, 2000);
reboot();
});
}
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_failsafe a'));
} }
}; };

View file

@ -73,7 +73,7 @@ TABS.gps.initialize = function (callback) {
]; ];
function saveSettings(onComplete) { function saveSettings(onComplete) {
Settings.saveInputs().then(onComplete); Settings.saveInputs(onComplete);
} }
saveChainer.setChain(saveChain); saveChainer.setChain(saveChain);

View file

@ -58,7 +58,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
saveChainer.setExitPoint(reboot); saveChainer.setExitPoint(reboot);
function saveSettings(onComplete) { function saveSettings(onComplete) {
Settings.saveInputs().then(onComplete); Settings.saveInputs(onComplete);
} }
function reboot() { function reboot() {

View file

@ -3256,6 +3256,20 @@ TABS.osd.initialize = function (callback) {
GUI.active_tab = 'osd'; GUI.active_tab = 'osd';
} }
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_osd a'));
});
});
});
}
GUI.load(path.join(__dirname, "osd.html"), Settings.processHtml(function () { GUI.load(path.join(__dirname, "osd.html"), Settings.processHtml(function () {
// translate to user-selected language // translate to user-selected language
i18n.localize(); i18n.localize();
@ -3274,16 +3288,7 @@ TABS.osd.initialize = function (callback) {
}); });
$('a.save').on('click', function () { $('a.save').on('click', function () {
Settings.saveInputs().then(function () { Settings.saveInputs(save_to_eeprom);
var self = this;
MSP.promise(MSPCodes.MSP_EEPROM_WRITE);
GUI.log(i18n.getMessage('osdSettingsSaved'));
var oldText = $(this).text();
$(this).html("Saved");
setTimeout(function () {
$(self).html(oldText);
}, 2000);
});
}); });
// Initialise guides checkbox // Initialise guides checkbox

View file

@ -79,7 +79,7 @@ TABS.outputs.initialize = function (callback) {
} }
function saveSettings(onComplete) { function saveSettings(onComplete) {
Settings.saveInputs().then(onComplete); Settings.saveInputs(onComplete);
} }
function onLoad() { function onLoad() {

View file

@ -44,7 +44,7 @@ TABS.receiver.initialize = function (callback) {
} }
function saveSettings(onComplete) { function saveSettings(onComplete) {
Settings.saveInputs().then(onComplete); Settings.saveInputs(onComplete);
} }
function drawRollPitchExpo() { function drawRollPitchExpo() {