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:
parent
e99cbcecee
commit
56251916aa
2 changed files with 11 additions and 0 deletions
|
@ -213,6 +213,7 @@ function process_data(command, message_buffer, message_length_expected) {
|
||||||
|
|
||||||
// IDENT received, show the tab content
|
// IDENT received, show the tab content
|
||||||
if (!configuration_received) {
|
if (!configuration_received) {
|
||||||
|
GUI.timeout_remove('connecting'); // kill connecting timer
|
||||||
configuration_received = true;
|
configuration_received = true;
|
||||||
|
|
||||||
$('div#port-picker a.connect').text('Disconnect').addClass('active');
|
$('div#port-picker a.connect').text('Disconnect').addClass('active');
|
||||||
|
|
|
@ -119,6 +119,7 @@ $(document).ready(function() {
|
||||||
disable_timers();
|
disable_timers();
|
||||||
|
|
||||||
GUI.tab_switch_cleanup();
|
GUI.tab_switch_cleanup();
|
||||||
|
GUI.timeout_remove('connecting'); // kill connecting timer
|
||||||
|
|
||||||
chrome.serial.close(connectionId, onClosed);
|
chrome.serial.close(connectionId, onClosed);
|
||||||
|
|
||||||
|
@ -183,6 +184,15 @@ function onOpen(openInfo) {
|
||||||
// start polling
|
// start polling
|
||||||
serial_poll = setInterval(readPoll, 10);
|
serial_poll = setInterval(readPoll, 10);
|
||||||
port_usage_poll = setInterval(port_usage, 1000);
|
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
|
// baseflight specific
|
||||||
send_message(MSP_codes.MSP_UID, MSP_codes.MSP_UID);
|
send_message(MSP_codes.MSP_UID, MSP_codes.MSP_UID);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue