diff --git a/js/boards.js b/js/boards.js index 5b3850f3..65658bdd 100644 --- a/js/boards.js +++ b/js/boards.js @@ -3,46 +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" + 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 index faf5c8fd..4b890069 100755 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -45,16 +45,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config); - function waitSeconds(iMilliSeconds) { - var counter= 0 - , start = new Date().getTime() - , end = 0; - while (counter < iMilliSeconds) { - end = new Date().getTime(); - counter = end - start; - } - } - function process_html() { // translate to user-selected language localize(); @@ -400,17 +390,24 @@ 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); - }); // status data pulled via separate timer with static speed diff --git a/tabs/ports.js b/tabs/ports.js index 44020072..9d9c4a35 100755 --- a/tabs/ports.js +++ b/tabs/ports.js @@ -211,16 +211,6 @@ TABS.ports.initialize = function (callback, scrollPosition) { if (callback) callback(); } - function waitSeconds(iMilliSeconds) { - var counter= 0 - , start = new Date().getTime() - , end = 0; - while (counter < iMilliSeconds) { - end = new Date().getTime(); - counter = end - start; - } - } - function on_save_handler() { // update configuration based on current ui state @@ -249,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() { @@ -272,16 +259,23 @@ 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 + } + + + } } };