diff options
author | Roeland Lutters <Roeland.lutters@telenet.be> | 2015-01-11 00:01:02 +0300 |
---|---|---|
committer | Roeland Lutters <Roeland.lutters@telenet.be> | 2015-01-11 00:01:02 +0300 |
commit | 71008b6aadb0603ff265a67ba4119bf2e10a0700 (patch) | |
tree | 6a8a099f45bdd98af39bea9e6769f482d1fda428 /eventPage.js | |
parent | 91a63e05cf12140903151338fca0f63549d20ba2 (diff) |
Sending exit command on closing configurator.
Diffstat (limited to 'eventPage.js')
-rwxr-xr-x | eventPage.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/eventPage.js b/eventPage.js index 9d1b7bd0..5cc72594 100755 --- a/eventPage.js +++ b/eventPage.js @@ -27,10 +27,23 @@ function startApplication() { if (connectionId && valid_connection) { // code below is handmade MSP message (without pretty JS wrapper), it behaves exactly like MSP.send_message + // sending exit command just in case the cli tab was open. // reset motors to default (mincommand) - var bufferOut = new ArrayBuffer(22), - bufView = new Uint8Array(bufferOut), - checksum = 0; + + var bufferOut = new ArrayBuffer(5); + var bufView = new Uint8Array(bufferOut); + + bufView[0] = 0x65; // e + bufView[1] = 0x78; // x + bufView[2] = 0x69; // i + bufView[3] = 0x74; // t + bufView[4] = 0x0D; // enter + + chrome.serial.send(connectionId, bufferOut, function () { console.log('Send exit') }); + + bufferOut = new ArrayBuffer(29); + bufView = new Uint8Array(bufferOut); + var checksum = 0; bufView[0] = 36; // $ bufView[1] = 77; // M |