1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

DFU detection and port UI DFU option injection

This commit is contained in:
cTn 2014-06-08 20:10:07 +02:00
parent a0582fd79f
commit b5a1015610
4 changed files with 31 additions and 5 deletions

View file

@ -131,10 +131,27 @@ port_handler.prototype.check = function() {
self.initial_ports = current_ports;
}
self.main_timeout_reference = setTimeout(function() {
self.check();
}, 250);
check_usb_devices();
});
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) {