- Target-unspecific VCP bugfix

10.3.x-maintenance
Larry (TBS) 2015-09-14 20:21:09 +08:00
parent 14c4fe1739
commit e4f47f8153
3 changed files with 54 additions and 51 deletions

View File

@ -3,46 +3,58 @@
var BOARD_DEFINITIONS = [ var BOARD_DEFINITIONS = [
{ {
name: "CC3D", name: "CC3D",
identifier: "CC3D" identifier: "CC3D",
vcp: true
}, { }, {
name: "ChebuzzF3", name: "ChebuzzF3",
identifier: "CHF3" identifier: "CHF3",
vcp: false
}, { }, {
name: "CJMCU", name: "CJMCU",
identifier: "CJM1" identifier: "CJM1",
vcp: false
}, { }, {
name: "EUSTM32F103RB", name: "EUSTM32F103RB",
identifier: "EUF1" identifier: "EUF1",
vcp: false
}, { }, {
name: "Naze/Flip32+", name: "Naze/Flip32+",
identifier: "AFNA" identifier: "AFNA",
vcp: false
}, { }, {
name: "Naze32Pro", name: "Naze32Pro",
identifier: "AFF3" identifier: "AFF3",
vcp: false
}, { }, {
name: "Olimexino", name: "Olimexino",
identifier: "OLI1" identifier: "OLI1"
}, { }, {
name: "Port103R", name: "Port103R",
identifier: "103R" identifier: "103R",
vcp: false
}, { }, {
name: "Sparky", name: "Sparky",
identifier: "SPKY" identifier: "SPKY",
vcp: true
}, { }, {
name: "STM32F3Discovery", name: "STM32F3Discovery",
identifier: "SDF3" identifier: "SDF3",
vcp: true
}, { }, {
name: "Colibri Race", name: "Colibri Race",
identifier: "CLBR" identifier: "CLBR",
vcp: true
}, { }, {
name: "SP Racing F3", name: "SP Racing F3",
identifier: "SRF3" identifier: "SRF3",
vcp: false
} }
]; ];
var DEFAULT_BOARD_DEFINITION = { var DEFAULT_BOARD_DEFINITION = {
name: "Unknown", name: "Unknown",
identifier: "????" identifier: "????",
vcp: false
}; };
var BOARD = { var BOARD = {

View File

@ -45,16 +45,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config); 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() { function process_html() {
// translate to user-selected language // translate to user-selected language
localize(); localize();
@ -400,17 +390,24 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
function reinitialize() { function reinitialize() {
GUI.log(chrome.i18n.getMessage('deviceRebooting')); 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() { GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () { MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () {
GUI.log(chrome.i18n.getMessage('deviceReady')); GUI.log(chrome.i18n.getMessage('deviceReady'));
TABS.configuration.initialize(false, $('#content').scrollTop()); TABS.configuration.initialize(false, $('#content').scrollTop());
}); });
},1500); // 1500 ms seems to be just the right amount of delay to prevent data request timeouts },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); 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 // status data pulled via separate timer with static speed

View File

@ -211,16 +211,6 @@ TABS.ports.initialize = function (callback, scrollPosition) {
if (callback) callback(); 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() { function on_save_handler() {
// update configuration based on current ui state // 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(), blackbox_baudrate: $(portConfiguration_e).find('.blackbox_baudrate').val(),
identifier: oldSerialPort.identifier identifier: oldSerialPort.identifier
}; };
console.log(serialPort);
SERIAL_CONFIG.ports.push(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); 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() { function save_to_eeprom() {
@ -272,16 +259,23 @@ TABS.ports.initialize = function (callback, scrollPosition) {
function on_reboot_success_handler() { function on_reboot_success_handler() {
GUI.log(chrome.i18n.getMessage('deviceRebooting')); GUI.log(chrome.i18n.getMessage('deviceRebooting'));
var rebootTimeoutDelay = 1500; // seems to be just the right amount of delay to prevent data request timeouts 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('waiting_for_bootup', function waiting_for_bootup() { GUI.timeout_add('start_connection',function start_connection() {
MSP.send_message(MSP_codes.MSP_IDENT, false, false, function () { $('a.connect').click();
GUI.log(chrome.i18n.getMessage('deviceReady')); },2000);
TABS.ports.initialize(false, $('#content').scrollTop()); } else {
}); GUI.timeout_add('waiting_for_bootup', function waiting_for_bootup() {
}, rebootTimeoutDelay); 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
}
}
} }
}; };