1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-16 04:45:18 +03:00
This commit is contained in:
skaman82 2015-11-02 22:07:37 +01:00
parent 278e25a872
commit 06f643812d
30 changed files with 1280 additions and 1143 deletions

View file

@ -100,14 +100,25 @@ 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 {
GUI.connect_lock = false;
GUI.log('<span style="color: red">Failed</span> to open serial port');
}
});
// delay to allow board to boot in bootloader mode
// required to detect if a DFU device appears
setTimeout(function() {
// refresh device list
PortHandler.check_usb_devices(function(dfu_available) {
if(dfu_available) {
STM32DFU.connect(usbDevices.STM32DFU, hex, options);
} 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;
}