mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
Simplify serial config loading
This commit is contained in:
parent
f93fba9c36
commit
a65ff23f8d
2 changed files with 11 additions and 10 deletions
|
@ -3539,6 +3539,13 @@ var mspHelper = (function (gui) {
|
|||
MSP.send_message(MSPCodes.MSP2_INAV_PROGRAMMING_PID_STATUS, false, false, callback);
|
||||
};
|
||||
|
||||
self.loadSerialPorts = function (callback) {
|
||||
MSP.send_message(MSPCodes.MSP2_CF_SERIAL_CONFIG, false, false, callback);
|
||||
};
|
||||
|
||||
self.saveSerialPorts = function (callback) {
|
||||
MSP.send_message(MSPCodes.MSP2_SET_CF_SERIAL_CONFIG, mspHelper.crunch(MSPCodes.MSP2_SET_CF_SERIAL_CONFIG), false, callback);
|
||||
};
|
||||
|
||||
return self;
|
||||
})(GUI);
|
||||
|
|
|
@ -170,15 +170,9 @@ TABS.ports.initialize = function (callback) {
|
|||
googleAnalytics.sendAppView('Ports');
|
||||
}
|
||||
|
||||
load_configuration_from_fc();
|
||||
|
||||
function load_configuration_from_fc() {
|
||||
MSP.send_message(MSPCodes.MSP2_CF_SERIAL_CONFIG, false, false, on_configuration_loaded_handler);
|
||||
|
||||
function on_configuration_loaded_handler() {
|
||||
GUI.load("./tabs/ports.html", on_tab_loaded_handler);
|
||||
}
|
||||
}
|
||||
mspHelper.loadSerialPorts(function () {
|
||||
GUI.load("./tabs/ports.html", on_tab_loaded_handler)
|
||||
});
|
||||
|
||||
function update_ui() {
|
||||
|
||||
|
@ -359,7 +353,7 @@ TABS.ports.initialize = function (callback) {
|
|||
SERIAL_CONFIG.ports.push(serialPort);
|
||||
});
|
||||
|
||||
MSP.send_message(MSPCodes.MSP2_SET_CF_SERIAL_CONFIG, mspHelper.crunch(MSPCodes.MSP2_SET_CF_SERIAL_CONFIG), false, save_to_eeprom);
|
||||
mspHelper.saveSerialPorts(save_to_eeprom);
|
||||
|
||||
function save_to_eeprom() {
|
||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, on_saved_handler);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue