1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 21:05:30 +03:00

Fix tcp boot

This commit is contained in:
Mark Haslinghuis 2020-10-29 00:28:29 +01:00
parent 71586c914a
commit 545ec324c0
5 changed files with 235 additions and 243 deletions

View file

@ -112,7 +112,8 @@ function closeSerial() {
bufView[3] = 0x74; // t
bufView[4] = 0x0D; // enter
chrome.serial.send(connectionId, bufferOut, function () {
const sendFn = (serial.connectionType === 'serial' ? chrome.serial.send : chrome.sockets.tcp.send);
sendFn(connectionId, bufferOut, function () {
console.log('Send exit');
});
@ -139,16 +140,12 @@ function closeSerial() {
bufView[5 + 16] = checksum;
chrome.serial.send(connectionId, bufferOut, function () {
chrome.serial.disconnect(connectionId, function (result) {
console.log(`SERIAL: Connection closed - ${result}`);
});
sendFn(connectionId, bufferOut, function () {
serial.disconnect();
});
}, 100);
} else if (connectionId) {
chrome.serial.disconnect(connectionId, function (result) {
console.log(`SERIAL: Connection closed - ${result}`);
});
serial.disconnect();
}
}