1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

handle connecting failure more gracefully

This commit is contained in:
cTn 2013-11-22 12:11:20 +01:00
parent e99cbcecee
commit 56251916aa
2 changed files with 11 additions and 0 deletions

View file

@ -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');

View file

@ -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);
@ -184,6 +185,15 @@ function onOpen(openInfo) {
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 <span style="color: red">10 seconds</span>, communication <span style="color: red">failed</span> - Disconnecting');
$('div#port-picker a.connect').click(); // disconnect
}
}, 10000);
// baseflight specific
send_message(MSP_codes.MSP_UID, MSP_codes.MSP_UID);
send_message(MSP_codes.MSP_ACC_TRIM, MSP_codes.MSP_ACC_TRIM);