Findphone - fix for Bangle 2

master
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", "name": "Find Phone",
"shortName":"Find Phone", "shortName":"Find Phone",
"icon": "app.png", "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.", "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", "tags": "tool,android",
"readme": "README.md", "readme": "README.md",

View File

@ -1,2 +1,3 @@
0.01: First Version 0.01: First Version
0.02: Remove HID requirement, update screen 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 2. Lose phone
3. Open app 3. Open app
4. Click any button or screen 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 //notify your phone
const fontSize = g.getWidth() / 8;
var finding = false; var finding = false;
function draw() { function draw() {
// show message // show message
g.clear(1); g.clear(g.theme.bg);
require("Font8x12").add(Graphics); g.setColor(g.theme.fg);
g.setFont("8x12",3); g.setFont("Vector", fontSize);
g.setFontAlign(0,0); g.setFontAlign(0,0);
if (finding) { if (finding) {
g.drawString("Finding...", g.getWidth()/2, (g.getHeight()/2)-20); g.drawString("Finding...", g.getWidth()/2, (g.getHeight()/2)-20);
g.drawString("Click to stop", 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 //register all buttons and screen to find phone
setWatch(find, BTN1, {repeat:true}); setWatch(find, BTN1, {repeat:true});
setWatch(find, BTN2, {repeat:true});
setWatch(find, BTN3, {repeat:true}); if (process.env.HWVERSION == 1) {
setWatch(find, BTN4, {repeat:true}); setWatch(find, BTN2, {repeat:true});
setWatch(find, BTN5, {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();
}
});
}