DFU detection and port UI DFU option injection
parent
a0582fd79f
commit
b5a1015610
|
@ -131,10 +131,27 @@ port_handler.prototype.check = function() {
|
||||||
self.initial_ports = current_ports;
|
self.initial_ports = current_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.main_timeout_reference = setTimeout(function() {
|
check_usb_devices();
|
||||||
self.check();
|
|
||||||
}, 250);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function check_usb_devices() {
|
||||||
|
chrome.usb.getDevices(usbDevices.STM32DFU, function(result) {
|
||||||
|
if (result.length) {
|
||||||
|
if (!$("div#port-picker .port select [value='DFU']").length) {
|
||||||
|
$('div#port-picker .port select').append('<option value="DFU">DFU</option>');
|
||||||
|
$('div#port-picker .port select').val('DFU');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($("div#port-picker .port select [value='DFU']").length) {
|
||||||
|
$("div#port-picker .port select [value='DFU']").remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.main_timeout_reference = setTimeout(function() {
|
||||||
|
self.check();
|
||||||
|
}, 250);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
port_handler.prototype.update_port_select = function(ports) {
|
port_handler.prototype.update_port_select = function(ports) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ $(document).ready(function() {
|
||||||
var selected_port = String($('div#port-picker .port select').val());
|
var selected_port = String($('div#port-picker .port select').val());
|
||||||
var selected_baud = parseInt($('div#port-picker #baud').val());
|
var selected_baud = parseInt($('div#port-picker #baud').val());
|
||||||
|
|
||||||
if (selected_port != '0') {
|
if (selected_port != '0' && selected_port != 'DFU') {
|
||||||
if (!clicks) {
|
if (!clicks) {
|
||||||
console.log('Connecting to: ' + selected_port);
|
console.log('Connecting to: ' + selected_port);
|
||||||
GUI.connecting_to = selected_port;
|
GUI.connecting_to = selected_port;
|
||||||
|
|
|
@ -55,6 +55,11 @@ var STM32DFU_protocol = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
STM32DFU_protocol.prototype.connect = function(hex) {
|
||||||
|
var self = this;
|
||||||
|
self.hex = hex;
|
||||||
|
};
|
||||||
|
|
||||||
STM32DFU_protocol.prototype.openDevice = function(callback) {
|
STM32DFU_protocol.prototype.openDevice = function(callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,11 @@ function tab_initialize_firmware_flasher() {
|
||||||
if (!$(this).hasClass('locked')) {
|
if (!$(this).hasClass('locked')) {
|
||||||
if (!GUI.connect_lock) { // button disabled while flashing is in progress
|
if (!GUI.connect_lock) { // button disabled while flashing is in progress
|
||||||
if (parsed_hex != false) {
|
if (parsed_hex != false) {
|
||||||
STM32.connect(parsed_hex);
|
if (String($('div#port-picker .port select').val()) != 'DFU') {
|
||||||
|
STM32.connect(parsed_hex);
|
||||||
|
} else {
|
||||||
|
STM32DFU.connect(parsed_hex);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
STM32.GUI_status(chrome.i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));
|
STM32.GUI_status(chrome.i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue