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

STM32: Check for DFU device after device reboot

This commit is contained in:
Michael Corcoran 2015-10-03 21:01:58 +13:00
parent 8b029edbcf
commit 42a8d38e32

View file

@ -100,14 +100,23 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
serial.send(bufferOut, function () {
serial.disconnect(function (result) {
if (result) {
serial.connect(port, {bitrate: self.baud, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
if (openInfo) {
self.initialize();
} else {
// 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;
GUI.log('<span style="color: red">Failed</span> to open serial port');
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;
}