1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

DFU: Make permissions compulsary, make DFU detection more robust

This commit is contained in:
Michael Corcoran 2015-10-08 14:31:12 +13:00
parent 88a59f05c9
commit d89e9682c2
10 changed files with 54 additions and 88 deletions

View file

@ -103,19 +103,22 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
// delay to allow board to boot in bootloader mode
// required to detect if a DFU device appears
setTimeout(function() {
if($("div#port-picker #port [value='DFU']").length) {
GUI.connect_lock = false;
STM32DFU.connect(usbDevices.STM32DFU, hex);
} else {
serial.connect(port, {bitrate: self.baud, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
if (openInfo) {
self.initialize();
} else {
GUI.connect_lock = false;
GUI.log('<span style="color: red">Failed</span> to open serial port');
}
});
}
// refresh device list
PortHandler.check_usb_devices(function(dfu_available) {
if(dfu_available) {
GUI.connect_lock = false;
STM32DFU.connect(usbDevices.STM32DFU, hex);
} else {
serial.connect(port, {bitrate: self.baud, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
if (openInfo) {
self.initialize();
} else {
GUI.connect_lock = false;
GUI.log('<span style="color: red">Failed</span> to open serial port');
}
});
}
});
}, 1000);
} else {
GUI.connect_lock = false;