mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 03:49:53 +03:00
STM32: Check for DFU device after device reboot
This commit is contained in:
parent
8b029edbcf
commit
42a8d38e32
1 changed files with 15 additions and 6 deletions
|
@ -100,14 +100,23 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
||||||
serial.send(bufferOut, function () {
|
serial.send(bufferOut, function () {
|
||||||
serial.disconnect(function (result) {
|
serial.disconnect(function (result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
serial.connect(port, {bitrate: self.baud, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
|
// delay to allow board to boot in bootloader mode
|
||||||
if (openInfo) {
|
// required to detect if a DFU device appears
|
||||||
self.initialize();
|
setTimeout(function() {
|
||||||
} else {
|
if($("div#port-picker #port [value='DFU']").length) {
|
||||||
GUI.connect_lock = false;
|
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 {
|
} else {
|
||||||
GUI.connect_lock = false;
|
GUI.connect_lock = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue