From d22f3faf1d28497dd1e22c7d56240a6643587a0f Mon Sep 17 00:00:00 2001 From: "Larry (TBS)" Date: Thu, 6 Aug 2015 12:19:15 +0800 Subject: [PATCH 1/3] * Add Colibri Race Support --- js/boards.js | 3 +++ tabs/configuration.js | 19 +++++++++++++++++++ tabs/ports.js | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+) mode change 100644 => 100755 tabs/configuration.js mode change 100644 => 100755 tabs/ports.js diff --git a/js/boards.js b/js/boards.js index 6f0b6bd2..5b3850f3 100644 --- a/js/boards.js +++ b/js/boards.js @@ -31,6 +31,9 @@ var BOARD_DEFINITIONS = [ }, { name: "STM32F3Discovery", identifier: "SDF3" + }, { + name: "Colibri Race", + identifier: "CLBR" }, { name: "SP Racing F3", identifier: "SRF3" diff --git a/tabs/configuration.js b/tabs/configuration.js old mode 100644 new mode 100755 index 962f5120..53803d76 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -45,6 +45,16 @@ 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,6 +410,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) { } MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config); + + if(CONFIG.boardIdentifier == "CLBR") { + waitSeconds(200); + $('a.connect').click(); + + waitSeconds(500); + $('a.connect').click(); + } + }); // status data pulled via separate timer with static speed diff --git a/tabs/ports.js b/tabs/ports.js old mode 100644 new mode 100755 index 055d8075..9073a88a --- a/tabs/ports.js +++ b/tabs/ports.js @@ -211,6 +211,16 @@ 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 @@ -271,6 +281,15 @@ TABS.ports.initialize = function (callback, scrollPosition) { }); }, rebootTimeoutDelay); } + + if(CONFIG.boardIdentifier == "CLBR") { + waitSeconds(200); + $('a.connect').click(); + + waitSeconds(500); + $('a.connect').click(); + } + } }; From 14c4fe17397fac583223b1ea258059a0fb435e46 Mon Sep 17 00:00:00 2001 From: "Larry (TBS)" Date: Wed, 19 Aug 2015 16:40:14 +0800 Subject: [PATCH 2/3] - take off reconnect for PR --- tabs/configuration.js | 8 -------- tabs/ports.js | 8 -------- 2 files changed, 16 deletions(-) diff --git a/tabs/configuration.js b/tabs/configuration.js index 53803d76..faf5c8fd 100755 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -411,14 +411,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config); - if(CONFIG.boardIdentifier == "CLBR") { - waitSeconds(200); - $('a.connect').click(); - - waitSeconds(500); - $('a.connect').click(); - } - }); // status data pulled via separate timer with static speed diff --git a/tabs/ports.js b/tabs/ports.js index 9073a88a..44020072 100755 --- a/tabs/ports.js +++ b/tabs/ports.js @@ -282,14 +282,6 @@ TABS.ports.initialize = function (callback, scrollPosition) { }, rebootTimeoutDelay); } - if(CONFIG.boardIdentifier == "CLBR") { - waitSeconds(200); - $('a.connect').click(); - - waitSeconds(500); - $('a.connect').click(); - } - } }; From e4f47f8153cc7d36e2fca6443117f91c70806cc5 Mon Sep 17 00:00:00 2001 From: "Larry (TBS)" Date: Mon, 14 Sep 2015 20:21:09 +0800 Subject: [PATCH 3/3] - Target-unspecific VCP bugfix --- js/boards.js | 36 ++++++++++++++++++++++++------------ tabs/configuration.js | 31 ++++++++++++++----------------- tabs/ports.js | 38 ++++++++++++++++---------------------- 3 files changed, 54 insertions(+), 51 deletions(-) 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 + } + + + } } };