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:
parent
a0582fd79f
commit
b5a1015610
4 changed files with 31 additions and 5 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue