diff --git a/apps/espruinoctrl/ChangeLog b/apps/espruinoctrl/ChangeLog index 819ae56cb..522cba63e 100644 --- a/apps/espruinoctrl/ChangeLog +++ b/apps/espruinoctrl/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Disable not existing BTN3 on Bangle.js 2, set maximum transmit power +0.03: Now use BTN2 on Bangle.js 1, and on Bangle.js 2 use the middle button to return to the menu \ No newline at end of file diff --git a/apps/espruinoctrl/README.md b/apps/espruinoctrl/README.md index 7b2e434e7..59c96b0de 100644 --- a/apps/espruinoctrl/README.md +++ b/apps/espruinoctrl/README.md @@ -14,7 +14,8 @@ with 4 options: with this address will be connected to directly. If not specified a menu showing available Espruino devices is popped up. * **RX** - If checked, the app will display any data received from the -device being connected to. Use this if you want to print data - eg: `print(E.getBattery())` +device being connected to (waiting 500ms after the last data before disconnecting). +Use this if you want to print data - eg: `print(E.getBattery())` When done, click 'Upload'. Your changes will be saved to local storage so they'll be remembered next time you upload from the same device. @@ -25,4 +26,9 @@ Simply load the app and you'll see a menu with the menu items you defined. Select one and you'll be able to connect to the device and send the command. -If a command should wait for a response then +The Bangle will connect to the device, send the command, and if: + +* `RX` isn't set it will disconnect immediately and return to the menu +* `RX` is set it will listen for a response and write it to the screen, before +disconnecting after 500ms of inactivity. To return to the menu after this, press the button. + diff --git a/apps/espruinoctrl/custom.html b/apps/espruinoctrl/custom.html index 2329ad214..27ef1eb53 100644 --- a/apps/espruinoctrl/custom.html +++ b/apps/espruinoctrl/custom.html @@ -194,16 +194,14 @@ function sendCommandRX(device, text, callback) { function done() { Terminal.println("\\n============\\n Disconnected"); device.disconnect(); - if (global.BTN3 !== undefined) { - setTimeout(function() { - setWatch(function() { - if (callback) callback(); - resolve(); - }, BTN3); - g.reset().setFont("6x8",2).setFontAlign(0,0,1); - g.drawString("Back", g.getWidth()-10, g.getHeight()-50); - }, 200); - } + setTimeout(function() { + setWatch(function() { + if (callback) callback(); + resolve(); + }, (process.env.HWVERSION==2) ? BTN1 : BTN2); + g.reset().setFont("6x8",2).setFontAlign(0,0,1); + g.drawString("Back", g.getWidth()-10, g.getHeight()/2); + }, 200); } device.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e").then(function(s) { service = s; diff --git a/apps/espruinoctrl/metadata.json b/apps/espruinoctrl/metadata.json index 9308b4a46..4f5fa01c8 100644 --- a/apps/espruinoctrl/metadata.json +++ b/apps/espruinoctrl/metadata.json @@ -2,7 +2,7 @@ "id": "espruinoctrl", "name": "Espruino Control", "shortName": "Espruino Ctrl", - "version": "0.02", + "version": "0.03", "description": "Send commands to other Espruino devices via the Bluetooth UART interface. Customisable commands!", "icon": "app.png", "tags": "tool,bluetooth",