From eb8d9940ddd031f3fdce3829edcfa7a8a69c5413 Mon Sep 17 00:00:00 2001 From: hughbarney Date: Sat, 2 Oct 2021 15:41:12 +0100 Subject: [PATCH] findphone tweak to code --- apps/findphone/app.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/findphone/app.js b/apps/findphone/app.js index 36c3f1884..e5e32739a 100644 --- a/apps/findphone/app.js +++ b/apps/findphone/app.js @@ -19,10 +19,14 @@ function draw() { g.flip(); } +function findPhone(v) { + Bluetooth.println(JSON.stringify({t:"findPhone", n:v})); +} + function find(){ finding = !finding; draw(); - Bluetooth.println("\n"+JSON.stringify({t:"findPhone", n:finding})); + findPhone(finding); } draw(); @@ -43,12 +47,9 @@ if (process.env.HWVERSION == 2) { // 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(); + findPhone(false); + setTimeout(load, 100); // exit in 100ms } }); } -