diff --git a/js/boards.js b/js/boards.js index 05e1d8fd..ca8a632c 100644 --- a/js/boards.js +++ b/js/boards.js @@ -56,6 +56,22 @@ var BOARD_DEFINITIONS = [ name: "MotoLab", identifier: "MOTO", vcp: true + }, { + name: "Omnibus", + identifier: "OMNI", + vcp: true + }, { + name: "Airbot F4", + identifier: "ABF4", + vcp: true + }, { + name: "Revolution", + identifier: "REVO", + vcp: true + }, { + name: "Omnibus F4", + identifier: "OBF4", + vcp: true } ]; @@ -66,7 +82,6 @@ var DEFAULT_BOARD_DEFINITION = { }; var BOARD = { - }; BOARD.find_board_definition = function (identifier) { diff --git a/js/serial.js b/js/serial.js index 17214f18..05b4f133 100644 --- a/js/serial.js +++ b/js/serial.js @@ -1,5 +1,7 @@ 'use strict'; +/*global chrome*/ + var serial = { connectionId: false, openRequested: false, @@ -291,4 +293,5 @@ var serial = { this.outputBuffer = []; this.transmitting = false; } + }; \ No newline at end of file diff --git a/js/serial_backend.js b/js/serial_backend.js index 0b4225bc..b738caa8 100755 --- a/js/serial_backend.js +++ b/js/serial_backend.js @@ -7,6 +7,45 @@ $(document).ready(function () { $baud = $('#baud'), $portOverride = $('#port-override'); + GUI.handleReconnect = function ($tabElement) { + if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect + + /* + Disconnect + */ + setTimeout(function () { + $('a.connect').click(); + }, 100); + + /* + Connect again + */ + setTimeout(function start_connection() { + $('a.connect').click(); + + /* + Open configuration tab + */ + if ($tabElement != null) { + setTimeout(function () { + $tabElement.click(); + }, 250); + } + + }, 5000); + } else { + + GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() { + MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () { + //noinspection JSUnresolvedVariable + GUI.log(chrome.i18n.getMessage('deviceReady')); + //noinspection JSValidateTypes + TABS.configuration.initialize(false, $('#content').scrollTop()); + }); + },1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts + } + }; + GUI.updateManualPortVisibility = function(){ var selected_port = $port.find('option:selected'); if (selected_port.data().isManual) { @@ -148,9 +187,6 @@ $(document).ready(function () { PortUsage.initialize(); }); - - - function onOpen(openInfo) { if (openInfo) { // update connected_to diff --git a/tabs/cli.js b/tabs/cli.js index 7160027f..3aa5e6d2 100644 --- a/tabs/cli.js +++ b/tabs/cli.js @@ -1,5 +1,5 @@ 'use strict'; - +/*global chrome*/ TABS.cli = { 'validateText': "", 'currentLine': "", @@ -163,23 +163,7 @@ TABS.cli.read = function (readInfo) { CONFIGURATOR.cliValid = false; GUI.log(chrome.i18n.getMessage('cliReboot')); GUI.log(chrome.i18n.getMessage('deviceRebooting')); - - if (BOARD.find_board_definition(CONFIG.boardIdentifier).vcp) { // VCP-based flight controls may crash old drivers, we catch and reconnect - $('a.connect').click(); - GUI.timeout_add('start_connection',function start_connection() { - $('a.connect').click(); - },2500); - } else { - - GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() { - MSP.send_message(MSPCodes.MSP_IDENT, false, false, function () { - GUI.log(chrome.i18n.getMessage('deviceReady')); - if (!GUI.tab_switch_in_progress) { - $('#tabs ul.mode-connected .tab_setup a').click(); - } - }); - },1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts - } + GUI.handleReconnect(); } } else { // try to catch part of valid CLI enter message diff --git a/tabs/configuration.html b/tabs/configuration.html index 7db8f9c9..ebcaaf87 100644 --- a/tabs/configuration.html +++ b/tabs/configuration.html @@ -188,29 +188,33 @@ -