1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00

reworked serial layer (more verbose), added checks for chrome.runtime.lastError in connect and disconnect api calls

This commit is contained in:
cTn 2014-11-22 06:31:46 +01:00
parent f241c0f70d
commit de87fab530
3 changed files with 79 additions and 66 deletions

View file

@ -25,7 +25,7 @@ function startApplication() {
valid_connection = createdWindow.contentWindow.CONFIGURATOR.connectionValid,
mincommand = createdWindow.contentWindow.MISC.mincommand;
if (connectionId > 0 && valid_connection) {
if (connectionId && valid_connection) {
// code below is handmade MSP message (without pretty JS wrapper), it behaves exactly like MSP.send_message
// reset motors to default (mincommand)
var bufferOut = new ArrayBuffer(22),
@ -55,7 +55,7 @@ function startApplication() {
console.log('SERIAL: Connection closed - ' + result);
});
});
} else if (connectionId > 0) {
} else if (connectionId) {
chrome.serial.disconnect(connectionId, function (result) {
console.log('SERIAL: Connection closed - ' + result);
});