Findphone - fix for Bangle 2

pull/832/head
hughbarney 2021-10-02 14:13:20 +01:00
parent 75cc74eda8
commit 6817cafba4
4 changed files with 35 additions and 8 deletions

View File

@ -2058,7 +2058,7 @@
"name": "Find Phone",
"shortName":"Find Phone",
"icon": "app.png",
"version":"0.02",
"version":"0.03",
"description": "Find your phone via Gadgetbridge. Click any button to let your phone ring. 📳 Note: The functionality is available even without this app, just go to Settings, App Settings, Gadgetbridge, Find Phone.",
"tags": "tool,android",
"readme": "README.md",

View File

@ -1,2 +1,3 @@
0.01: First Version
0.02: Remove HID requirement, update screen
0.03: Fix for Bangle 2, toggle find with top half of screen, exit touch bottom half of screen

View File

@ -6,3 +6,8 @@ Ring your phone via GadgetBridge if you lost it somewhere.
2. Lose phone
3. Open app
4. Click any button or screen
## On a Bangle 2
- You can touch the top half of the screen to toggle Find / Stop
- You can touch the bottom half of the screen to exit the app.

View File

@ -1,13 +1,15 @@
//notify your phone
const fontSize = g.getWidth() / 8;
var finding = false;
function draw() {
// show message
g.clear(1);
require("Font8x12").add(Graphics);
g.setFont("8x12",3);
g.clear(g.theme.bg);
g.setColor(g.theme.fg);
g.setFont("Vector", fontSize);
g.setFontAlign(0,0);
if (finding) {
g.drawString("Finding...", g.getWidth()/2, (g.getHeight()/2)-20);
g.drawString("Click to stop", g.getWidth()/2, (g.getHeight()/2)+20);
@ -27,7 +29,26 @@ draw();
//register all buttons and screen to find phone
setWatch(find, BTN1, {repeat:true});
setWatch(find, BTN2, {repeat:true});
setWatch(find, BTN3, {repeat:true});
setWatch(find, BTN4, {repeat:true});
setWatch(find, BTN5, {repeat:true});
if (process.env.HWVERSION == 1) {
setWatch(find, BTN2, {repeat:true});
setWatch(find, BTN3, {repeat:true});
setWatch(find, BTN4, {repeat:true});
setWatch(find, BTN5, {repeat:true});
}
if (process.env.HWVERSION == 2) {
Bangle.on('touch', function(button, xy) {
// click top part of the screen to stop start
if (xy.y < g.getHeight() / 2) {
find();
return;
} else {
// exit app
Bluetooth.println("\n"+JSON.stringify({t:"findPhone", n:false}));
load();
}
});
}