diff --git a/js/msp.js b/js/msp.js index 124bc84208..af9ea0d2c9 100644 --- a/js/msp.js +++ b/js/msp.js @@ -213,6 +213,7 @@ function process_data(command, message_buffer, message_length_expected) { // IDENT received, show the tab content if (!configuration_received) { + GUI.timeout_remove('connecting'); // kill connecting timer configuration_received = true; $('div#port-picker a.connect').text('Disconnect').addClass('active'); diff --git a/js/serial_backend.js b/js/serial_backend.js index d5a81c3850..6cd9a4e63e 100644 --- a/js/serial_backend.js +++ b/js/serial_backend.js @@ -119,6 +119,7 @@ $(document).ready(function() { disable_timers(); GUI.tab_switch_cleanup(); + GUI.timeout_remove('connecting'); // kill connecting timer chrome.serial.close(connectionId, onClosed); @@ -183,6 +184,15 @@ function onOpen(openInfo) { // start polling serial_poll = setInterval(readPoll, 10); port_usage_poll = setInterval(port_usage, 1000); + + // disconnect after 10 seconds with error if we don't get IDENT data + GUI.timeout_add('connecting', function() { + if (!configuration_received) { + notify('Did not received configuration within 10 seconds, communication failed - Disconnecting'); + + $('div#port-picker a.connect').click(); // disconnect + } + }, 10000); // baseflight specific send_message(MSP_codes.MSP_UID, MSP_codes.MSP_UID);