espruinoctrl updates for Bangle.js 2

Disable not existing BTN3 on Bangle.js 2, set maximum transmit power
master
Erik Andresen 2023-01-13 22:50:05 +01:00
parent 705a5d7a1b
commit fec1432280
3 changed files with 13 additions and 9 deletions

View File

@ -1 +1,2 @@
0.01: New App! 0.01: New App!
0.02: Disable not existing BTN3 on Bangle.js 2, set maximum transmit power

View File

@ -164,6 +164,7 @@ function cmd(cmd,mac,rx) {
if (mac) { if (mac) {
E.showMessage("Connecting\\n"+mac); E.showMessage("Connecting\\n"+mac);
if (mac.length==17) mac+=" random"; if (mac.length==17) mac+=" random";
NRF.setTxPower(process.env.HWVERSION == 2 ? 8 : 4);
NRF.connect(mac).then(dev=>send(dev,cmd,onDone)).catch(err); NRF.connect(mac).then(dev=>send(dev,cmd,onDone)).catch(err);
} else { } else {
E.showMessage("Scanning..."); E.showMessage("Scanning...");
@ -193,14 +194,16 @@ function sendCommandRX(device, text, callback) {
function done() { function done() {
Terminal.println("\\n============\\n Disconnected"); Terminal.println("\\n============\\n Disconnected");
device.disconnect(); device.disconnect();
setTimeout(function() { if (global.BTN3 !== undefined) {
setWatch(function() { setTimeout(function() {
if (callback) callback(); setWatch(function() {
resolve(); if (callback) callback();
}, BTN3); resolve();
g.reset().setFont("6x8",2).setFontAlign(0,0,1); }, BTN3);
g.drawString("Back", g.getWidth()-10, g.getHeight()-50); g.reset().setFont("6x8",2).setFontAlign(0,0,1);
}, 200); g.drawString("Back", g.getWidth()-10, g.getHeight()-50);
}, 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.01", "version": "0.02",
"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",