1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 19:40:22 +03:00

cleanup & improvements, callback approach

This commit is contained in:
cTn 2014-01-18 12:55:09 +01:00
parent 643a894730
commit e27f8019d7

View file

@ -235,7 +235,7 @@ function onOpen(openInfo) {
});
serial.onReceive.addListener(read_serial);
GUI.interval_add('port_usage', port_usage, 1000);
GUI.interval_add('port_usage', port_usage, 1000, true);
// disconnect after 10 seconds with error if we don't get IDENT data
GUI.timeout_add('connecting', function() {
@ -247,8 +247,7 @@ function onOpen(openInfo) {
}, 10000);
// request configuration data
send_message(MSP_codes.MSP_UID, MSP_codes.MSP_UID);
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS); // in theory this could be removed (MSP_STATUS is pulled in initial tab)
send_message(MSP_codes.MSP_UID, MSP_codes.MSP_UID, false, function() {
send_message(MSP_codes.MSP_IDENT, MSP_codes.MSP_IDENT, false, function() {
GUI.timeout_remove('connecting'); // kill connecting timer
@ -259,6 +258,7 @@ function onOpen(openInfo) {
$('div#port-picker a.connect').text('Disconnect').addClass('active');
$('#tabs li a:first').click();
});
});
} else {
console.log('Failed to open serial port');
notify('Failed to open serial port', 'red');