espruinoctrl - fix docs (fix #3180), and

0.03: Now use BTN2 on Bangle.js 1, and on Bangle.js 2 use the middle button to return to the menu
pull/3186/head
Gordon Williams 2024-02-06 09:41:52 +00:00
parent 91ac2e1be7
commit d35f72b4c8
4 changed files with 18 additions and 13 deletions

View File

@ -1,2 +1,3 @@
0.01: New App! 0.01: New App!
0.02: Disable not existing BTN3 on Bangle.js 2, set maximum transmit power 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

View File

@ -14,7 +14,8 @@ with 4 options:
with this address will be connected to directly. If not specified a menu with this address will be connected to directly. If not specified a menu
showing available Espruino devices is popped up. showing available Espruino devices is popped up.
* **RX** - If checked, the app will display any data received from the * **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 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. 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 you defined. Select one and you'll be able to connect to the device
and send the command. 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.

View File

@ -194,16 +194,14 @@ function sendCommandRX(device, text, callback) {
function done() { function done() {
Terminal.println("\\n============\\n Disconnected"); Terminal.println("\\n============\\n Disconnected");
device.disconnect(); device.disconnect();
if (global.BTN3 !== undefined) { setTimeout(function() {
setTimeout(function() { setWatch(function() {
setWatch(function() { if (callback) callback();
if (callback) callback(); resolve();
resolve(); }, (process.env.HWVERSION==2) ? BTN1 : BTN2);
}, BTN3); g.reset().setFont("6x8",2).setFontAlign(0,0,1);
g.reset().setFont("6x8",2).setFontAlign(0,0,1); g.drawString("Back", g.getWidth()-10, g.getHeight()/2);
g.drawString("Back", g.getWidth()-10, g.getHeight()-50); }, 200);
}, 200);
}
} }
device.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e").then(function(s) { device.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e").then(function(s) {
service = s; service = s;

View File

@ -2,7 +2,7 @@
"id": "espruinoctrl", "id": "espruinoctrl",
"name": "Espruino Control", "name": "Espruino Control",
"shortName": "Espruino Ctrl", "shortName": "Espruino Ctrl",
"version": "0.02", "version": "0.03",
"description": "Send commands to other Espruino devices via the Bluetooth UART interface. Customisable commands!", "description": "Send commands to other Espruino devices via the Bluetooth UART interface. Customisable commands!",
"icon": "app.png", "icon": "app.png",
"tags": "tool,bluetooth", "tags": "tool,bluetooth",