diff --git a/js/boards.js b/js/boards.js index 6f0b6bd2..65658bdd 100644 --- a/js/boards.js +++ b/js/boards.js @@ -3,43 +3,58 @@ var BOARD_DEFINITIONS = [ { name: "CC3D", - identifier: "CC3D" + identifier: "CC3D", + vcp: true }, { name: "ChebuzzF3", - identifier: "CHF3" + identifier: "CHF3", + vcp: false }, { name: "CJMCU", - identifier: "CJM1" + identifier: "CJM1", + vcp: false }, { name: "EUSTM32F103RB", - identifier: "EUF1" + identifier: "EUF1", + vcp: false }, { name: "Naze/Flip32+", - identifier: "AFNA" + identifier: "AFNA", + vcp: false }, { name: "Naze32Pro", - identifier: "AFF3" + identifier: "AFF3", + vcp: false }, { name: "Olimexino", identifier: "OLI1" }, { name: "Port103R", - identifier: "103R" + identifier: "103R", + vcp: false }, { name: "Sparky", - identifier: "SPKY" + identifier: "SPKY", + vcp: true }, { name: "STM32F3Discovery", - identifier: "SDF3" + identifier: "SDF3", + vcp: true + }, { + name: "Colibri Race", + identifier: "CLBR", + vcp: true }, { name: "SP Racing F3", - identifier: "SRF3" + identifier: "SRF3", + vcp: false } ]; var DEFAULT_BOARD_DEFINITION = { name: "Unknown", - identifier: "????" + identifier: "????", + vcp: false }; var BOARD = { diff --git a/tabs/configuration.js b/tabs/configuration.js old mode 100644 new mode 100755 index 1e5f5e55..6118d461 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -427,13 +427,21 @@ TABS.configuration.initialize = function (callback, scrollPosition) { function reinitialize() { 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(); + },2000); + } else { - GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() { - MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () { - GUI.log(chrome.i18n.getMessage('deviceReady')); - TABS.configuration.initialize(false, $('#content').scrollTop()); - }); - },1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts + GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() { + MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () { + GUI.log(chrome.i18n.getMessage('deviceReady')); + TABS.configuration.initialize(false, $('#content').scrollTop()); + }); + },1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts + } } MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config); diff --git a/tabs/ports.js b/tabs/ports.js old mode 100644 new mode 100755 index 055d8075..9d9c4a35 --- a/tabs/ports.js +++ b/tabs/ports.js @@ -239,12 +239,9 @@ TABS.ports.initialize = function (callback, scrollPosition) { blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(), identifier: oldSerialPort.identifier }; - - console.log(serialPort); SERIAL_CONFIG.ports.push(serialPort); }); - MSP.send_message(MSP_codes.MSP_SET_CF_SERIAL_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CF_SERIAL_CONFIG), false, save_to_eeprom); function save_to_eeprom() { @@ -262,14 +259,22 @@ TABS.ports.initialize = function (callback, scrollPosition) { function on_reboot_success_handler() { GUI.log(chrome.i18n.getMessage('deviceRebooting')); - var rebootTimeoutDelay = 1500; // seems to be just the right amount of delay to prevent data request timeouts - - GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() { - MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () { - GUI.log(chrome.i18n.getMessage('deviceReady')); - TABS.ports.initialize(false, $('#content').scrollTop()); - }); - }, rebootTimeoutDelay); + 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(); + },2000); + } else { + GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() { + MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () { + GUI.log(chrome.i18n.getMessage('deviceReady')); + TABS.ports.initialize(false, $('#content').scrollTop()); + }); + }, 1500); // seems to be just the right amount of delay to prevent data request timeouts + } + + + } } };