diff options
author | cTn <ctndesigner@gmail.com> | 2014-11-22 08:31:46 +0300 |
---|---|---|
committer | cTn <ctndesigner@gmail.com> | 2014-11-22 08:31:46 +0300 |
commit | de87fab5304883fd8e1b84f0735b3ec7664ba3cc (patch) | |
tree | a7424de73e2a55e3602f096f916c1ce4f4d1c347 /eventPage.js | |
parent | f241c0f70da9acb0d81cda8cbfeb65ca147bae3e (diff) |
reworked serial layer (more verbose), added checks for chrome.runtime.lastError in connect and disconnect api calls
Diffstat (limited to 'eventPage.js')
-rw-r--r-- | eventPage.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/eventPage.js b/eventPage.js index 052e496e..9d1b7bd0 100644 --- a/eventPage.js +++ b/eventPage.js @@ -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); }); |