From e2f57cfb20eece3ea60824e93e30b0b19e47f6c4 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 28 Jan 2023 09:34:27 +0100 Subject: [PATCH 01/39] android - Use GadgetBridge GPS data whenever it arrives --- apps/android/boot.js | 70 +++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index 73d4dda67..deefe184a 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -6,6 +6,7 @@ var lastMsg; // for music messages - may not be needed now... var actInterval; // Realtime activity reporting interval when `act` is true var actHRMHandler; // For Realtime activity reporting + var gpsState = {}; // keep information on GPS via Gadgetbridge // this settings var is deleted after this executes to save memory var settings = require("Storage").readJSON("android.settings.json",1)||{}; @@ -139,6 +140,8 @@ "gps": function() { const settings = require("Storage").readJSON("android.settings.json",1)||{}; if (!settings.overwriteGps) return; + + // modify event for using it as Bangle GPS event delete event.t; event.satellites = NaN; if (!isFinite(event.course)) event.course = NaN; @@ -147,6 +150,28 @@ event.lon = event.long; delete event.long; } + + if (!gpsState.firstGPSEvent) { + // this is the first event, save time of arrival and deactivate internal GPS + gpsState.firstGPSEvent = Date.now(); + Bangle.moveGPSPower(0); + } else { + if (!gpsState.interval){ + // this is the second event, store the intervall for expecting the next GPS event + gpsState.interval = Date.now() - gpsState.firstGPSEvent; + } + } + // in any case, cleanup the GPS state in case no new events arrive + if (gpsState.timeoutGPS) clearTimeout(gpsState.timeoutGPS); + gpsState.timeoutGPS = setTimeout(()=>{ + // reset state + gpsState.firstGPSEvent = undefined; + gpsState.timeoutGPS = undefined; + gpsState.interval = undefined; + // did not get an expected GPS event but have GPS clients, switch back to internal GPS + if (Bangle.isGPSOn()) Bangle.moveGPSPower(1); + }, (gpsState.interval || 10000) + 1000); + Bangle.emit('GPS', event); }, // {t:"is_gps_active"} @@ -261,7 +286,7 @@ if (settings.overwriteGps) { // if the overwrite option is set../ const origSetGPSPower = Bangle.setGPSPower; // migrate all GPS clients to the other variant on connection events - let handleConnection = (state) => { + Bangle.moveGPSPower = (state) => { if (Bangle.isGPSOn()){ let orig = Bangle._PWR.GPS; delete Bangle._PWR.GPS; @@ -269,39 +294,50 @@ Bangle._PWR.GPS = orig; } }; - NRF.on('connect', ()=>{handleConnection(0);}); - NRF.on('disconnect', ()=>{handleConnection(1);}); - // Work around Serial1 for GPS not working when connected to something + // work around Serial1 for GPS not working when connected to something let serialTimeout; let wrap = function(f){ return (s)=>{ if (serialTimeout) clearTimeout(serialTimeout); - handleConnection(1); + Bangle.moveGPSPower(1); f(s); serialTimeout = setTimeout(()=>{ serialTimeout = undefined; - if (NRF.getSecurityStatus().connected) handleConnection(0); + if (gpsState.firstGPSEvent) Bangle.moveGPSPower(0); }, 10000); }; }; Serial1.println = wrap(Serial1.println); Serial1.write = wrap(Serial1.write); - // Replace set GPS power logic to suppress activation of gps (and instead request it from the phone) + // update the GPS state on reconnect + NRF.on("connect", ()=>{ + gbSend({ t: "gps_power", status: Bangle.isGPSOn() }); + }); + + // replace set GPS power logic to suppress activation of gps (and instead request it from the phone) Bangle.setGPSPower = (isOn, appID) => { - // if not connected use internal GPS power function - if (!NRF.getSecurityStatus().connected) return origSetGPSPower(isOn, appID); - if (!Bangle._PWR) Bangle._PWR={}; - if (!Bangle._PWR.GPS) Bangle._PWR.GPS=[]; - if (!appID) appID="?"; - if (isOn && !Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.push(appID); - if (!isOn && Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.splice(Bangle._PWR.GPS.indexOf(appID),1); - let pwr = Bangle._PWR.GPS.length>0; + let pwr; + if (!gpsState.firstGPSEvent){ + // use internal GPS power function if no gps event has arrived from GadgetBridge + pwr = origSetGPSPower(isOn, appID); + } else { + // we currently expecting the next GPS event from GadgetBridge, keep track of GPS state per App + if (!Bangle._PWR) Bangle._PWR={}; + if (!Bangle._PWR.GPS) Bangle._PWR.GPS=[]; + if (!appID) appID="?"; + if (isOn && !Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.push(appID); + if (!isOn && Bangle._PWR.GPS.includes(appID)) Bangle._PWR.GPS.splice(Bangle._PWR.GPS.indexOf(appID),1); + pwr = Bangle._PWR.GPS.length>0; + // stop internal GPS, no clients left + if (!pwr) origSetGPSPower(0); + } + // always update Gadgetbridge on current power state gbSend({ t: "gps_power", status: pwr }); return pwr; }; - // Allow checking for GPS via GadgetBridge + // allow checking for GPS via GadgetBridge Bangle.isGPSOn = () => { return !!(Bangle._PWR && Bangle._PWR.GPS && Bangle._PWR.GPS.length>0); }; @@ -313,4 +349,4 @@ // remove settings object so it's not taking up RAM delete settings; -})(); +})(); \ No newline at end of file From 9b8ecf8f8c5149c8b57e719c3972338c52c1b4a6 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 28 Jan 2023 10:03:06 +0100 Subject: [PATCH 02/39] android - Simplify test step running --- apps/android/test.js | 66 +++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/apps/android/test.js b/apps/android/test.js index 88a7c0566..d1b8ddb81 100644 --- a/apps/android/test.js +++ b/apps/android/test.js @@ -29,8 +29,10 @@ let sec = { NRF.getSecurityStatus = () => sec; -setTimeout(() => { - // add an empty starting point to make the asserts work +let teststeps = []; + +teststeps.push(()=>{ + // add an empty starting point to make the asserts work Bangle._PWR={}; print("Not connected, should use internal GPS"); @@ -90,37 +92,49 @@ setTimeout(() => { NRF.emit("disconnect", {}); print("disconnect"); sec.connected = false; +}); - setTimeout(() => { +teststeps.push(()=>{ + assertNotEmpty(Bangle._PWR.GPS, "GPS"); + assertTrue(Bangle.isGPSOn(), "isGPSOn"); + assertTrue(internalOn(), "Internal GPS on"); - assertNotEmpty(Bangle._PWR.GPS, "GPS"); - assertTrue(Bangle.isGPSOn(), "isGPSOn"); - assertTrue(internalOn(), "Internal GPS on"); + print("connect"); + sec.connected = true; + NRF.emit("connect", {}); +}); - print("connect"); - sec.connected = true; - NRF.emit("connect", {}); +teststeps.push(()=>{ + assertNotEmpty(Bangle._PWR.GPS, "GPS"); + assertTrue(Bangle.isGPSOn(), "isGPSOn"); + assertFalse(internalOn(), "Internal GPS off"); - setTimeout(() => { - assertNotEmpty(Bangle._PWR.GPS, "GPS"); - assertTrue(Bangle.isGPSOn(), "isGPSOn"); - assertFalse(internalOn(), "Internal GPS off"); + assertFalse(Bangle.setGPSPower(0, "test"), "Switch GPS off"); - assertFalse(Bangle.setGPSPower(0, "test"), "Switch GPS off"); + assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); + assertFalse(Bangle.isGPSOn(), "isGPSOn"); + assertFalse(internalOn(), "Internal GPS off"); +}); - assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); - assertFalse(Bangle.isGPSOn(), "isGPSOn"); - assertFalse(internalOn(), "Internal GPS off"); +setTimeout(()=>{ + print("Test disconnect without gps on"); - setTimeout(() => { - print("Test disconnect without gps on"); + assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); + assertFalse(Bangle.isGPSOn(), "isGPSOn"); + assertFalse(internalOn(), "Internal GPS off"); - assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); - assertFalse(Bangle.isGPSOn(), "isGPSOn"); - assertFalse(internalOn(), "Internal GPS off"); + print("Result Overall is " + (result ? "OK" : "FAIL")); +}); - print("Result Overall is " + (result ? "OK" : "FAIL")); - }, 0); - }, 0); - }, 0); +let wrap = (functions) => { + if (functions.length > 0) { + setTimeout(()=>{ + functions.shift()(); + wrap(functions); + },0); + } +}; + +setTimeout(()=>{ + wrap(teststeps); }, 5000); \ No newline at end of file From ef9c1b979a60f23711c343966b817798e11f76d3 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 28 Jan 2023 11:52:14 +0100 Subject: [PATCH 03/39] android - Remove tests checking no longer used connect/disconnect events --- apps/android/test.js | 56 ++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/apps/android/test.js b/apps/android/test.js index d1b8ddb81..511afd791 100644 --- a/apps/android/test.js +++ b/apps/android/test.js @@ -28,13 +28,12 @@ let sec = { }; NRF.getSecurityStatus = () => sec; +// add an empty starting point to make the asserts work +Bangle._PWR={}; let teststeps = []; teststeps.push(()=>{ - // add an empty starting point to make the asserts work - Bangle._PWR={}; - print("Not connected, should use internal GPS"); assertTrue(!NRF.getSecurityStatus().connected, "Not connected"); @@ -53,6 +52,9 @@ teststeps.push(()=>{ assertFalse(Bangle.isGPSOn(), "isGPSOn"); assertFalse(internalOn(), "Internal GPS off"); +}); + +teststeps.push(()=>{ print("Connected, should use GB GPS"); sec.connected = true; @@ -62,53 +64,28 @@ teststeps.push(()=>{ assertFalse(Bangle.isGPSOn(), "isGPSOn"); assertFalse(internalOn(), "Internal GPS off"); + + print("Internal GPS stays on until the first GadgetBridge event arrives"); assertTrue(Bangle.setGPSPower(1, "test"), "Switch GPS on"); - assertNotEmpty(Bangle._PWR.GPS, "GPS"); - assertTrue(Bangle.isGPSOn(), "isGPSOn"); - assertFalse(internalOn(), "Internal GPS off"); - - assertFalse(Bangle.setGPSPower(0, "test"), "Switch GPS off"); - - assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); - assertFalse(Bangle.isGPSOn(), "isGPSOn"); - assertFalse(internalOn(), "Internal GPS off"); - - print("Connected, then reconnect cycle"); - sec.connected = true; - - assertTrue(NRF.getSecurityStatus().connected, "Connected"); - - assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); - assertFalse(Bangle.isGPSOn(), "isGPSOn"); - assertFalse(internalOn(), "Internal GPS off"); - - assertTrue(Bangle.setGPSPower(1, "test"), "Switch GPS on"); - - assertNotEmpty(Bangle._PWR.GPS, "GPS"); - assertTrue(Bangle.isGPSOn(), "isGPSOn"); - assertFalse(internalOn(), "Internal GPS off"); - - NRF.emit("disconnect", {}); - print("disconnect"); - sec.connected = false; -}); - -teststeps.push(()=>{ assertNotEmpty(Bangle._PWR.GPS, "GPS"); assertTrue(Bangle.isGPSOn(), "isGPSOn"); assertTrue(internalOn(), "Internal GPS on"); - print("connect"); - sec.connected = true; - NRF.emit("connect", {}); + print("Send minimal GadgetBridge GPS event to trigger switch"); + GB({t:"gps"}); }); teststeps.push(()=>{ + print("GPS should be on, internal off"); + assertNotEmpty(Bangle._PWR.GPS, "GPS"); assertTrue(Bangle.isGPSOn(), "isGPSOn"); assertFalse(internalOn(), "Internal GPS off"); +}); +teststeps.push(()=>{ + print("Switching GPS off turns both GadgetBridge as well as internal off"); assertFalse(Bangle.setGPSPower(0, "test"), "Switch GPS off"); assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); @@ -116,7 +93,7 @@ teststeps.push(()=>{ assertFalse(internalOn(), "Internal GPS off"); }); -setTimeout(()=>{ +teststeps.push(()=>{ print("Test disconnect without gps on"); assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); @@ -137,4 +114,5 @@ let wrap = (functions) => { setTimeout(()=>{ wrap(teststeps); -}, 5000); \ No newline at end of file +}, 5000); + From 10da4e8a06613589359974086fbe745034bcd1d4 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 28 Jan 2023 12:34:18 +0100 Subject: [PATCH 04/39] android - Update tests to new behaviour --- apps/android/test.js | 45 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/apps/android/test.js b/apps/android/test.js index 511afd791..007b06fc7 100644 --- a/apps/android/test.js +++ b/apps/android/test.js @@ -94,20 +94,55 @@ teststeps.push(()=>{ }); teststeps.push(()=>{ - print("Test disconnect without gps on"); + print("Wait for all timeouts to run out"); + return 12000; +}); - assertUndefinedOrEmpty(Bangle._PWR.GPS, "No GPS"); - assertFalse(Bangle.isGPSOn(), "isGPSOn"); +teststeps.push(()=>{ + print("Check auto switch when no GPS event arrives"); + + assertTrue(Bangle.setGPSPower(1, "test"), "Switch GPS on"); + + assertNotEmpty(Bangle._PWR.GPS, "GPS"); + assertTrue(Bangle.isGPSOn(), "isGPSOn"); + assertTrue(internalOn(), "Internal GPS on"); + + print("Send minimal GadgetBridge GPS event to trigger switch"); + GB({t:"gps"}); + + print("Internal should be switched off now"); + + assertNotEmpty(Bangle._PWR.GPS, "GPS"); + assertTrue(Bangle.isGPSOn(), "isGPSOn"); assertFalse(internalOn(), "Internal GPS off"); + //wait on next test + return 12000; +}); + +teststeps.push(()=>{ + print("Check state and disable GPS, internal should be on"); + + assertNotEmpty(Bangle._PWR.GPS, "GPS"); + assertTrue(Bangle.isGPSOn(), "isGPSOn"); + assertTrue(internalOn(), "Internal GPS on"); + + assertFalse(Bangle.setGPSPower(0, "test"), "Switch GPS off"); +}); + +teststeps.push(()=>{ print("Result Overall is " + (result ? "OK" : "FAIL")); }); let wrap = (functions) => { if (functions.length > 0) { setTimeout(()=>{ - functions.shift()(); - wrap(functions); + let waitingTime = functions.shift()(); + if (waitingTime){ + print("WAITING: ", waitingTime); + setTimeout(()=>{wrap(functions);}, waitingTime); + } else + wrap(functions); },0); } }; From 3f5fb1527b0b6acbd919e250a80d2c7871ef4fa2 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 28 Jan 2023 12:42:38 +0100 Subject: [PATCH 05/39] android - GadgetBridge handles connect/disconnect GPS state --- apps/android/boot.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index deefe184a..21882adc4 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -283,7 +283,7 @@ if (isFinite(msg.id)) return gbSend({ t: "notify", n:"MUTE", id: msg.id }); }; // GPS overwrite logic - if (settings.overwriteGps) { // if the overwrite option is set../ + if (settings.overwriteGps) { // if the overwrite option is set.. const origSetGPSPower = Bangle.setGPSPower; // migrate all GPS clients to the other variant on connection events Bangle.moveGPSPower = (state) => { @@ -300,22 +300,17 @@ let wrap = function(f){ return (s)=>{ if (serialTimeout) clearTimeout(serialTimeout); - Bangle.moveGPSPower(1); + origSetGPSPower(1, "androidgpsserial") f(s); serialTimeout = setTimeout(()=>{ serialTimeout = undefined; - if (gpsState.firstGPSEvent) Bangle.moveGPSPower(0); + origSetGPSPower(0, "androidgpsserial"); }, 10000); }; }; Serial1.println = wrap(Serial1.println); Serial1.write = wrap(Serial1.write); - // update the GPS state on reconnect - NRF.on("connect", ()=>{ - gbSend({ t: "gps_power", status: Bangle.isGPSOn() }); - }); - // replace set GPS power logic to suppress activation of gps (and instead request it from the phone) Bangle.setGPSPower = (isOn, appID) => { let pwr; @@ -323,7 +318,7 @@ // use internal GPS power function if no gps event has arrived from GadgetBridge pwr = origSetGPSPower(isOn, appID); } else { - // we currently expecting the next GPS event from GadgetBridge, keep track of GPS state per App + // we are currently expecting the next GPS event from GadgetBridge, keep track of GPS state per app if (!Bangle._PWR) Bangle._PWR={}; if (!Bangle._PWR.GPS) Bangle._PWR.GPS=[]; if (!appID) appID="?"; From 2afa3b6daaca86d2fe691cf7be1f72314aa72748 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 28 Jan 2023 12:43:56 +0100 Subject: [PATCH 06/39] android - Bump version --- apps/android/ChangeLog | 4 +++- apps/android/metadata.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/android/ChangeLog b/apps/android/ChangeLog index 55bf56c16..2262f20d8 100644 --- a/apps/android/ChangeLog +++ b/apps/android/ChangeLog @@ -23,4 +23,6 @@ 0.22: Handle connection events for GPS forwarding from phone 0.23: Handle 'act' Gadgetbridge messages for realtime activity monitoring 0.24: Handle new 'nav' event for navigation -0.25: Added option to 'ignore' an app from the message \ No newline at end of file +0.25: Added option to 'ignore' an app from the message +0.26: Change handling of GPS status to depend on GPS events instead of connection events + diff --git a/apps/android/metadata.json b/apps/android/metadata.json index 26f646162..c5312a33e 100644 --- a/apps/android/metadata.json +++ b/apps/android/metadata.json @@ -2,7 +2,7 @@ "id": "android", "name": "Android Integration", "shortName": "Android", - "version": "0.25", + "version": "0.26", "description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.", "icon": "app.png", "tags": "tool,system,messages,notifications,gadgetbridge", From a267419f74fbf3edec732743f52fdeffd694a0a2 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sun, 19 Feb 2023 20:37:25 +0100 Subject: [PATCH 07/39] android - Fix type for time value --- apps/android/boot.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index 21882adc4..cdd8b2a6b 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -150,6 +150,9 @@ event.lon = event.long; delete event.long; } + if (event.time){ + event.time = new Date(event.time); + } if (!gpsState.firstGPSEvent) { // this is the first event, save time of arrival and deactivate internal GPS @@ -344,4 +347,4 @@ // remove settings object so it's not taking up RAM delete settings; -})(); \ No newline at end of file +})(); From abd8313a6c1a9fad2b140535c29d6620992776a0 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Mon, 20 Feb 2023 08:17:42 +0100 Subject: [PATCH 08/39] android - Use number of satellites if available --- apps/android/boot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index cdd8b2a6b..7216e7df1 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -143,7 +143,7 @@ // modify event for using it as Bangle GPS event delete event.t; - event.satellites = NaN; + if (!isFinite(event.satellites)) event.satellites = NaN; if (!isFinite(event.course)) event.course = NaN; event.fix = 1; if (event.long!==undefined) { // for earlier Gadgetbridge implementations From 6b352486ea1a34de4f9c7220db97509e6e1097c9 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Thu, 23 Feb 2023 20:39:37 +0100 Subject: [PATCH 09/39] android - Update the interval each time --- apps/android/boot.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index 7216e7df1..eeb4fab7d 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -140,7 +140,6 @@ "gps": function() { const settings = require("Storage").readJSON("android.settings.json",1)||{}; if (!settings.overwriteGps) return; - // modify event for using it as Bangle GPS event delete event.t; if (!isFinite(event.satellites)) event.satellites = NaN; @@ -154,27 +153,24 @@ event.time = new Date(event.time); } - if (!gpsState.firstGPSEvent) { + if (!gpsState.lastGPSEvent) { // this is the first event, save time of arrival and deactivate internal GPS - gpsState.firstGPSEvent = Date.now(); Bangle.moveGPSPower(0); } else { - if (!gpsState.interval){ - // this is the second event, store the intervall for expecting the next GPS event - gpsState.interval = Date.now() - gpsState.firstGPSEvent; - } + // this is the second event, store the intervall for expecting the next GPS event + gpsState.interval = Date.now() - gpsState.lastGPSEvent; } + gpsState.lastGPSEvent = Date.now(); // in any case, cleanup the GPS state in case no new events arrive if (gpsState.timeoutGPS) clearTimeout(gpsState.timeoutGPS); gpsState.timeoutGPS = setTimeout(()=>{ // reset state - gpsState.firstGPSEvent = undefined; + gpsState.lastGPSEvent = undefined; gpsState.timeoutGPS = undefined; gpsState.interval = undefined; // did not get an expected GPS event but have GPS clients, switch back to internal GPS if (Bangle.isGPSOn()) Bangle.moveGPSPower(1); }, (gpsState.interval || 10000) + 1000); - Bangle.emit('GPS', event); }, // {t:"is_gps_active"} @@ -288,7 +284,6 @@ // GPS overwrite logic if (settings.overwriteGps) { // if the overwrite option is set.. const origSetGPSPower = Bangle.setGPSPower; - // migrate all GPS clients to the other variant on connection events Bangle.moveGPSPower = (state) => { if (Bangle.isGPSOn()){ let orig = Bangle._PWR.GPS; @@ -303,7 +298,7 @@ let wrap = function(f){ return (s)=>{ if (serialTimeout) clearTimeout(serialTimeout); - origSetGPSPower(1, "androidgpsserial") + origSetGPSPower(1, "androidgpsserial"); f(s); serialTimeout = setTimeout(()=>{ serialTimeout = undefined; @@ -315,9 +310,9 @@ Serial1.write = wrap(Serial1.write); // replace set GPS power logic to suppress activation of gps (and instead request it from the phone) - Bangle.setGPSPower = (isOn, appID) => { + Bangle.setGPSPower = ((isOn, appID) => { let pwr; - if (!gpsState.firstGPSEvent){ + if (!this.lastGPSEvent){ // use internal GPS power function if no gps event has arrived from GadgetBridge pwr = origSetGPSPower(isOn, appID); } else { @@ -334,7 +329,7 @@ // always update Gadgetbridge on current power state gbSend({ t: "gps_power", status: pwr }); return pwr; - }; + }).bind(gpsState); // allow checking for GPS via GadgetBridge Bangle.isGPSOn = () => { return !!(Bangle._PWR && Bangle._PWR.GPS && Bangle._PWR.GPS.length>0); From eb611fd95be578414954bbdfa1cdd5492377bca9 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Thu, 18 May 2023 00:23:32 +0200 Subject: [PATCH 10/39] android - Do not read settings on every gps message --- apps/android/boot.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/android/boot.js b/apps/android/boot.js index eeb4fab7d..8e2e64dd0 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -138,7 +138,6 @@ }, // {t:"gps", lat, lon, alt, speed, course, time, satellites, hdop, externalSource:true } "gps": function() { - const settings = require("Storage").readJSON("android.settings.json",1)||{}; if (!settings.overwriteGps) return; // modify event for using it as Bangle GPS event delete event.t; From d5c3650007b065b54bbf6da949fca742a7718f97 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Wed, 24 May 2023 08:19:05 +0100 Subject: [PATCH 11/39] popcon: add settings for reset --- apps/popconlaunch/ChangeLog | 1 + apps/popconlaunch/metadata.json | 5 +++-- apps/popconlaunch/settings.js | 11 +++++++++++ apps/popconlaunch/settings.ts | 12 ++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 apps/popconlaunch/settings.js create mode 100644 apps/popconlaunch/settings.ts diff --git a/apps/popconlaunch/ChangeLog b/apps/popconlaunch/ChangeLog index c430b4412..e174349bf 100644 --- a/apps/popconlaunch/ChangeLog +++ b/apps/popconlaunch/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Trim old entries from the popcon app cache 0.03: Avoid polluting global scope +0.04: Add settings app for resetting popcon diff --git a/apps/popconlaunch/metadata.json b/apps/popconlaunch/metadata.json index be3bc6a92..42cff2116 100644 --- a/apps/popconlaunch/metadata.json +++ b/apps/popconlaunch/metadata.json @@ -2,7 +2,7 @@ "id": "popconlaunch", "name": "Popcon Launcher", "shortName": "Popcon", - "version": "0.03", + "version": "0.04", "description": "Launcher modification - your launchers will display your favourite (popular) apps first. Overrides `readJSON`, may slow down your watch", "readme": "README.md", "icon": "app.png", @@ -11,7 +11,8 @@ "supports": ["BANGLEJS2"], "storage": [ {"name":"popcon.boot.js","url":"boot.js"}, - {"name":"popcon.img","url":"icon.js","evaluate":true} + {"name":"popcon.img","url":"icon.js","evaluate":true}, + {"name":"popcon.settings.js","url":"settings.js"} ], "data": [ {"name":"popcon.cache.json"} diff --git a/apps/popconlaunch/settings.js b/apps/popconlaunch/settings.js new file mode 100644 index 000000000..57edd2940 --- /dev/null +++ b/apps/popconlaunch/settings.js @@ -0,0 +1,11 @@ +(function (back) { + var menu = { + '': { 'title': 'Popcon' }, + '< Back': back, + 'Reset app popularities': function () { + require("Storage").erase("popcon.cache.json"); + E.showMessage("Popcon reset", "Done"); + }, + }; + E.showMenu(menu); +}); diff --git a/apps/popconlaunch/settings.ts b/apps/popconlaunch/settings.ts new file mode 100644 index 000000000..f52d68980 --- /dev/null +++ b/apps/popconlaunch/settings.ts @@ -0,0 +1,12 @@ +(function(back) { + const menu = { + '': {'title': 'Popcon'}, + '< Back': back, + 'Reset app popularities': () => { + require("Storage").erase("popcon.cache.json"); + E.showMessage("Popcon reset", "Done"); + }, + }; + + E.showMenu(menu); +}) satisfies SettingsFunc From 9efdafb2dc04b61c09c1c22d212e2690f50c479f Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Wed, 24 May 2023 08:20:30 +0100 Subject: [PATCH 12/39] popcon: don't advertise as a launcher As it doesn't actually do any launching --- apps/popconlaunch/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/popconlaunch/metadata.json b/apps/popconlaunch/metadata.json index 42cff2116..9e1f096d4 100644 --- a/apps/popconlaunch/metadata.json +++ b/apps/popconlaunch/metadata.json @@ -7,7 +7,7 @@ "readme": "README.md", "icon": "app.png", "type": "bootloader", - "tags": "tool,system,launcher", + "tags": "tool,system", "supports": ["BANGLEJS2"], "storage": [ {"name":"popcon.boot.js","url":"boot.js"}, From 966a855a0f815b29e698c32434602f05a2a63847 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Wed, 24 May 2023 08:27:12 +0100 Subject: [PATCH 13/39] popcon: clear cache on reset --- apps/popconlaunch/settings.js | 6 +++++- apps/popconlaunch/settings.ts | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/popconlaunch/settings.js b/apps/popconlaunch/settings.js index 57edd2940..d1ecc2dff 100644 --- a/apps/popconlaunch/settings.js +++ b/apps/popconlaunch/settings.js @@ -3,7 +3,11 @@ '': { 'title': 'Popcon' }, '< Back': back, 'Reset app popularities': function () { - require("Storage").erase("popcon.cache.json"); + var S = require("Storage"); + S.erase("popcon.cache.json"); + var info = S.readJSON("popcon.info", true); + info.cacheBuster = !info.cacheBuster; + S.writeJSON("popcon.info", info); E.showMessage("Popcon reset", "Done"); }, }; diff --git a/apps/popconlaunch/settings.ts b/apps/popconlaunch/settings.ts index f52d68980..8f8760a62 100644 --- a/apps/popconlaunch/settings.ts +++ b/apps/popconlaunch/settings.ts @@ -3,7 +3,13 @@ '': {'title': 'Popcon'}, '< Back': back, 'Reset app popularities': () => { - require("Storage").erase("popcon.cache.json"); + const S = require("Storage"); + S.erase("popcon.cache.json"); + + const info: AppInfo & { cacheBuster?: boolean } = S.readJSON("popcon.info", true); + info.cacheBuster = !info.cacheBuster; + S.writeJSON("popcon.info", info); + E.showMessage("Popcon reset", "Done"); }, }; From 6968bb762ca3baa3f08a68994881e2db8f1afa85 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Wed, 24 May 2023 08:27:29 +0100 Subject: [PATCH 14/39] popcon: fix info filename --- apps/popconlaunch/boot.js | 4 ++-- apps/popconlaunch/boot.ts | 4 ++-- apps/popconlaunch/settings.js | 4 ++-- apps/popconlaunch/settings.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/popconlaunch/boot.js b/apps/popconlaunch/boot.js index 0080a66f9..60c8ffcb7 100644 --- a/apps/popconlaunch/boot.js +++ b/apps/popconlaunch/boot.js @@ -26,9 +26,9 @@ trimCache(cache); require("Storage").writeJSON("popcon.cache.json", cache); if (orderChanged) { - var info = oldRead("popcon.info", true); + var info = oldRead("popconlaunch.info", true); info.cacheBuster = !info.cacheBuster; - require("Storage").writeJSON("popcon.info", info); + require("Storage").writeJSON("popconlaunch.info", info); } }; var sortCache = function () { diff --git a/apps/popconlaunch/boot.ts b/apps/popconlaunch/boot.ts index 4fe638f75..a6b52fb0f 100644 --- a/apps/popconlaunch/boot.ts +++ b/apps/popconlaunch/boot.ts @@ -38,9 +38,9 @@ const saveCache = (cache: Cache, orderChanged: boolean) => { require("Storage").writeJSON("popcon.cache.json", cache); if(orderChanged){ // ensure launchers reload their caches: - const info: AppInfo & { cacheBuster?: boolean } = oldRead("popcon.info", true); + const info: AppInfo & { cacheBuster?: boolean } = oldRead("popconlaunch.info", true); info.cacheBuster = !info.cacheBuster; - require("Storage").writeJSON("popcon.info", info); + require("Storage").writeJSON("popconlaunch.info", info); } }; diff --git a/apps/popconlaunch/settings.js b/apps/popconlaunch/settings.js index d1ecc2dff..29528c5dd 100644 --- a/apps/popconlaunch/settings.js +++ b/apps/popconlaunch/settings.js @@ -5,9 +5,9 @@ 'Reset app popularities': function () { var S = require("Storage"); S.erase("popcon.cache.json"); - var info = S.readJSON("popcon.info", true); + var info = S.readJSON("popconlaunch.info", true); info.cacheBuster = !info.cacheBuster; - S.writeJSON("popcon.info", info); + S.writeJSON("popconlaunch.info", info); E.showMessage("Popcon reset", "Done"); }, }; diff --git a/apps/popconlaunch/settings.ts b/apps/popconlaunch/settings.ts index 8f8760a62..e301df9b2 100644 --- a/apps/popconlaunch/settings.ts +++ b/apps/popconlaunch/settings.ts @@ -6,9 +6,9 @@ const S = require("Storage"); S.erase("popcon.cache.json"); - const info: AppInfo & { cacheBuster?: boolean } = S.readJSON("popcon.info", true); + const info: AppInfo & { cacheBuster?: boolean } = S.readJSON("popconlaunch.info", true); info.cacheBuster = !info.cacheBuster; - S.writeJSON("popcon.info", info); + S.writeJSON("popconlaunch.info", info); E.showMessage("Popcon reset", "Done"); }, From 0b2ca361c4aaad4ed63594775d1dd28b45cf6cad Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 24 May 2023 10:20:41 +0100 Subject: [PATCH 15/39] Report latest HRM rather than HRM 10 minutes ago (fix #2395) --- apps/advcasio/ChangeLog | 3 ++- apps/advcasio/app.js | 2 +- apps/advcasio/metadata.json | 2 +- apps/cassioWatch/ChangeLog | 3 ++- apps/cassioWatch/app.js | 2 +- apps/cassioWatch/metadata.json | 2 +- apps/lcars/ChangeLog | 1 + apps/lcars/lcars.app.js | 4 ++-- apps/lcars/metadata.json | 2 +- 9 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/advcasio/ChangeLog b/apps/advcasio/ChangeLog index fd37c324e..bc4850635 100644 --- a/apps/advcasio/ChangeLog +++ b/apps/advcasio/ChangeLog @@ -1,4 +1,5 @@ 0.01: AdvCasio first version 0.02: Remove un-needed fonts to improve memory usage 0.03: Tell clock widgets to hide. -0.04: Swipe down to see widgets, step counter now just uses getHealthStatus +0.04: Swipe down to see widgets, step counter now just uses getHealthStatus +0.05: Report latest HRM rather than HRM 10 minutes ago (fix #2395) \ No newline at end of file diff --git a/apps/advcasio/app.js b/apps/advcasio/app.js index 9d246b7ef..d951da4cc 100644 --- a/apps/advcasio/app.js +++ b/apps/advcasio/app.js @@ -122,7 +122,7 @@ function draw() { g.setFontAlign(0,-1); g.setFont("8x12", 2); g.drawString(getTemperature(), 155, 132); - g.drawString(Math.round(Bangle.getHealthStatus("last").bpm), 109, 98); + g.drawString(Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm), 109, 98); g.drawString(getSteps(), 158, 98); g.setFontAlign(-1,-1); diff --git a/apps/advcasio/metadata.json b/apps/advcasio/metadata.json index 25dc1243a..32f5de7d3 100644 --- a/apps/advcasio/metadata.json +++ b/apps/advcasio/metadata.json @@ -1,7 +1,7 @@ { "id": "advcasio", "name": "Advanced Casio Clock", "shortName":"advcasio", - "version":"0.04", + "version":"0.05", "description": "An over-engineered clock inspired by Casio watches. It has a 4 days weather, a timer using swipe and a scratchpad. Can be updated using a dedicated webapp.", "icon": "app.png", "tags": "clock", diff --git a/apps/cassioWatch/ChangeLog b/apps/cassioWatch/ChangeLog index 1180554ff..e0abc576c 100644 --- a/apps/cassioWatch/ChangeLog +++ b/apps/cassioWatch/ChangeLog @@ -10,4 +10,5 @@ 0.9: Remove ESLint spaces 0.10: Show daily steps, heartrate and the temperature if weather information is available. 0.11: Tell clock widgets to hide. -0.12: Swipe down to see widgets, step counter now just uses getHealthStatus +0.12: Swipe down to see widgets, step counter now just uses getHealthStatus +0.13: Report latest HRM rather than HRM 10 minutes ago (fix #2395) \ No newline at end of file diff --git a/apps/cassioWatch/app.js b/apps/cassioWatch/app.js index 19dd883d2..68c8a3ceb 100644 --- a/apps/cassioWatch/app.js +++ b/apps/cassioWatch/app.js @@ -121,7 +121,7 @@ function draw() { g.setFontAlign(0,-1); g.setFont("8x12", 2); g.drawString(getTemperature(), 155, 132); - g.drawString(Math.round(Bangle.getHealthStatus("last").bpm), 109, 98); + g.drawString(Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm), 109, 98); g.drawString(getSteps(), 158, 98); g.setFontAlign(-1,-1); diff --git a/apps/cassioWatch/metadata.json b/apps/cassioWatch/metadata.json index 5ac4502fd..4b9985c82 100644 --- a/apps/cassioWatch/metadata.json +++ b/apps/cassioWatch/metadata.json @@ -4,7 +4,7 @@ "description": "Animated Clock with Space Cassio Watch Style", "screenshots": [{ "url": "screens/screen_night.png" },{ "url": "screens/screen_day.png" }], "icon": "app.png", - "version": "0.12", + "version": "0.13", "type": "clock", "tags": "clock, weather, cassio, retro", "supports": ["BANGLEJS2"], diff --git a/apps/lcars/ChangeLog b/apps/lcars/ChangeLog index 7deef5a4b..fb778c278 100644 --- a/apps/lcars/ChangeLog +++ b/apps/lcars/ChangeLog @@ -24,3 +24,4 @@ 0.24: Add ability to disable alarm functionality. 0.25: Add more colors to the settings and add the ability to disable the data charts+Markup. 0.26: Use widget_utils. +0.27: Report latest HRM rather than HRM 10 minutes ago (fix #2395) \ No newline at end of file diff --git a/apps/lcars/lcars.app.js b/apps/lcars/lcars.app.js index 4a5539c7a..cbb6e6ad5 100644 --- a/apps/lcars/lcars.app.js +++ b/apps/lcars/lcars.app.js @@ -240,7 +240,7 @@ function _drawData(key, y, c){ value = E.getAnalogVRef().toFixed(2) + "V"; } else if(key == "HRM"){ - value = Math.round(Bangle.getHealthStatus("last").bpm); + value = Math.round(Bangle.getHealthStatus().bpm||Bangle.getHealthStatus("last").bpm); } else if (key == "TEMP"){ var weather = getWeather(); @@ -710,7 +710,7 @@ Bangle.on('touch', function(btn, e){ var is_right = e.x > right; var is_upper = e.y < upper; var is_lower = e.y > lower; - + if(!settings.disableData){ if(is_left && lcarsViewPos == 1){ feedback(); diff --git a/apps/lcars/metadata.json b/apps/lcars/metadata.json index 787ca9046..65c59081f 100644 --- a/apps/lcars/metadata.json +++ b/apps/lcars/metadata.json @@ -3,7 +3,7 @@ "name": "LCARS Clock", "shortName":"LCARS", "icon": "lcars.png", - "version":"0.26", + "version":"0.27", "readme": "README.md", "supports": ["BANGLEJS2"], "description": "Library Computer Access Retrieval System (LCARS) clock.", From c1f2ca5b78a0bf685f22805425ac42aa25c852ea Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 24 May 2023 13:01:00 +0100 Subject: [PATCH 16/39] Update to be aware of 2v18 --- apps/fwupdate/custom.html | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/fwupdate/custom.html b/apps/fwupdate/custom.html index 90f7c642b..6dcaad035 100644 --- a/apps/fwupdate/custom.html +++ b/apps/fwupdate/custom.html @@ -100,6 +100,7 @@ function onInit(device) { if (crc==2560806221) version = "2v15"; if (crc==2886730689) version = "2v16"; if (crc==156320890) version = "2v17"; + if (crc==4012421318) version = "2v18"; if (!ok) { version += `(⚠ update required)`; } From eba60876f02bac6279f899655ac7edc5e322d3cf Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 21:38:48 -0500 Subject: [PATCH 17/39] Create app.js --- apps/Uke/app.js | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 apps/Uke/app.js diff --git a/apps/Uke/app.js b/apps/Uke/app.js new file mode 100644 index 000000000..c60c49a6b --- /dev/null +++ b/apps/Uke/app.js @@ -0,0 +1,131 @@ +const stringInterval = 30; +const stringLength = 131; +const fretHeight = 35; +const fingerOffset = 17; +const x = 44; +const y = 32; + +//chords +const cc = [ + "C", + "x", + "x", + "x", + "33" +]; + +const dd = [ + "D", + "23", + "22", + "24", + "x" +]; + +const gg = [ + "G", + "x", + "21", + "33", + "22", +]; + +const am = [ + "Am", + "22", + "x", + "x", + "x" +]; + +const em = [ + "Em", + "x", + "43", + "32", + "21" +]; + +const aa = [ + "A", + "22", + "11", + "x", + "x" +]; + +const ff = [ + "F", + "22", + "x", + "11", + "x" +]; + +var ee = [ + "E", + "33", + "32", + "34", + "11" +]; + +var index = 0; +var chords = []; + +function init() { + g.setFontAlign(0,0); // center font + g.setFont("6x8",2); // bitmap font, 8x magnified + chords.push(cc, dd, gg, am, em, aa, ff, ee); +} + +function drawBase() { + for (let i = 0; i < 4; i++) { + g.drawLine(x + i * stringInterval, y, x + i * stringInterval, y + stringLength); + g.fillRect(x- 1, y + i * fretHeight - 1, x + stringInterval * 3 + 1, y + i * fretHeight + 1); + } +} + +function drawChord(chord) { + g.drawString(chord[0], g.getWidth() * 0.5 + 2, 18); + for (let i = 0; i < chord.length; i++) { + if (i === 0 || chord[i][0] === "x") { + continue; + } + if (chord[i][0] === "0") { + g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y + fretHeight * chord[i][0], true); + g.drawCircle(x + (i - 1) * stringInterval -1, y + fretHeight * chord[i][0], 8); + } + else { + g.drawString(chord[i][1], x + (i - 1) * stringInterval + 1, y -fingerOffset + fretHeight * chord[i][0], true); + g.drawCircle(x + (i - 1) * stringInterval -1, y -fingerOffset + fretHeight * chord[i][0], 8); + } + } +} + +function buttonPress() { + setWatch(() => { + buttonPress(); + }, BTN); + index++; + if (index >= chords.length) { index = 0; } + draw(); +} + +function draw() { + g.clear(); + drawBase(); + drawChord(chords[index]); +} + + + +function main() { + init(); + draw(); + setWatch(() => { + buttonPress(); + }, BTN); +} + +main(); From 97f0691e5f19ace2aefd32252992109885d7f1b4 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 21:39:27 -0500 Subject: [PATCH 18/39] Add files via upload --- apps/Uke/uke.img | Bin 0 -> 972 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/Uke/uke.img diff --git a/apps/Uke/uke.img b/apps/Uke/uke.img new file mode 100644 index 0000000000000000000000000000000000000000..0ccffbe611b219c2f6603cd98228e97beb7a9355 GIT binary patch literal 972 zcma)&F^0di*3Xy}XwMSw*ZFjhX?ta888bAsmPc0LrEyf9GjvJ| z%yBKfw`Z^_b1cvpy@baW7EoAAl(_G;%1Q%xvqDqw?WoFLp#pRw1zh?I2s0Jh7|smC zNC#Y}8+Vz!lSz~*-MtJNZ7*%zp_S*u|&d(=`8nbunk5X>~}*%eMw hk#5ag*>!?2Y`cBh#NK>cVWF3o+@lt&B;jh`{@&lpm@ohU literal 0 HcmV?d00001 From a3139d9e6cbdee1118c5dc084d1bd87135586896 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 21:45:48 -0500 Subject: [PATCH 19/39] Create metadata.json --- apps/Uke/metadata.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 apps/Uke/metadata.json diff --git a/apps/Uke/metadata.json b/apps/Uke/metadata.json new file mode 100644 index 000000000..9bf2e8d63 --- /dev/null +++ b/apps/Uke/metadata.json @@ -0,0 +1,12 @@ +{ "id": "Uke", + "name": "Uke Chords", + "shortName":"Uke", + "icon": "uke.img", + "version":"0.01", + "description": "Wrist mounted ukulele chords", + "tags": "", + "storage": [ + {"name":"novadawn999.app.js","url":"app.js"}, + {"name":"uke.img","url":"app-icon.js","evaluate":true} + ] +} From 08d464d3b6ac0f3d83c58606668bc802e3c44e14 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 21:48:52 -0500 Subject: [PATCH 20/39] Create app-icon.js --- apps/Uke/app-icon.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/Uke/app-icon.js diff --git a/apps/Uke/app-icon.js b/apps/Uke/app-icon.js new file mode 100644 index 000000000..49232b838 --- /dev/null +++ b/apps/Uke/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwJC/AH4A/AH4AgA==")) From bd6225a4aecd0c719c3a41c7f29e9c0b0ef3ea2b Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 21:52:57 -0500 Subject: [PATCH 21/39] Update metadata.json --- apps/Uke/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Uke/metadata.json b/apps/Uke/metadata.json index 9bf2e8d63..77ffa4d56 100644 --- a/apps/Uke/metadata.json +++ b/apps/Uke/metadata.json @@ -4,7 +4,7 @@ "icon": "uke.img", "version":"0.01", "description": "Wrist mounted ukulele chords", - "tags": "", + "tags": "uke", "storage": [ {"name":"novadawn999.app.js","url":"app.js"}, {"name":"uke.img","url":"app-icon.js","evaluate":true} From 697b2a85f8a5d504f06d7fe3e50f9b53bdcff866 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 21:56:50 -0500 Subject: [PATCH 22/39] Create README.md --- apps/Uke/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 apps/Uke/README.md diff --git a/apps/Uke/README.md b/apps/Uke/README.md new file mode 100644 index 000000000..49ceea1ed --- /dev/null +++ b/apps/Uke/README.md @@ -0,0 +1,11 @@ +# Uke Chords + +An app that simply describes finger placements on a Ukulele to form common chords. + +## Usage + +Use the button to scroll through the available chords. + +## Creator + +NovaDawn999 From ae8675583dfe02a635ec24ee33c26723e55164aa Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:02:41 -0500 Subject: [PATCH 23/39] Update metadata.json --- apps/Uke/metadata.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/Uke/metadata.json b/apps/Uke/metadata.json index 77ffa4d56..9ea0b0ab3 100644 --- a/apps/Uke/metadata.json +++ b/apps/Uke/metadata.json @@ -5,6 +5,8 @@ "version":"0.01", "description": "Wrist mounted ukulele chords", "tags": "uke", + "supports" : ["BANGLEJS2"], + "readme": "README.md", "storage": [ {"name":"novadawn999.app.js","url":"app.js"}, {"name":"uke.img","url":"app-icon.js","evaluate":true} From 31f34b464fe7eafaab7d2a12bee51be14320b65e Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:03:25 -0500 Subject: [PATCH 24/39] Update metadata.json --- apps/Uke/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Uke/metadata.json b/apps/Uke/metadata.json index 9ea0b0ab3..14f13dfcc 100644 --- a/apps/Uke/metadata.json +++ b/apps/Uke/metadata.json @@ -1,7 +1,7 @@ { "id": "Uke", "name": "Uke Chords", "shortName":"Uke", - "icon": "uke.img", + "icon": "uke.png", "version":"0.01", "description": "Wrist mounted ukulele chords", "tags": "uke", From 19eee06b49b8450d1bc2f643584883a2d020243e Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:10:08 -0500 Subject: [PATCH 25/39] Update app-icon.js --- apps/Uke/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Uke/app-icon.js b/apps/Uke/app-icon.js index 49232b838..9d1f36e26 100644 --- a/apps/Uke/app-icon.js +++ b/apps/Uke/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("mEwwJC/AH4A/AH4AgA==")) +require("heatshrink").decompress(atob("oFAwg74iAfeiMBiIfcDwMRITkBilEIDQaBiNEolBIDJdBHwIABIDZeCIDYcCiRAbD4MRklCkhAZilBMAMhAQIfXboVEoRDBoQfbHwUhD68RfwQ+CiIfWgMSf4g+BYC0RkJADHwIoBHy5ACkRdXHwchEAIeBLq0BDQIdBHoIICICo+EbQgfUPoQABHwZ9ZAAI+EO6IABHwoHCDydEoIbETwI+TeINEAAS6CPqsBDwgfBPoQ+VDwlBHwYDBWyY+HIAT3TLwifCHgJ9UTow+CPqT5DPpA+BD548GXgoDCD54eHHwhJCD5weIfYoNBT5zZFXYZ9EMwR9NPg8RboY+CD5w+IigBCHwYfOHxRACBoYfMLxA+DXgQACX5kBDwofBHwUUAIJpDD5i9JHwJECD65aCHwQMETyJaCbAQ+CD4Y+ND4g8CbAJbBcQQ+QXwaVCiMhiQkCfgg+ND4w6BEAYLDDxpfGMQZhBY4gfTIAagCD7BAFc4gfQKopACFAgfWIAgfVgIWFcQQIFDxzgEIAhIGD61BT4wfQQAwYBE4p+PIBAAFTyBAJLywfCIBI+TMAJAJHyYgKiI+TMIYgEcQIeWEAYADDzAhEDrYAZA==")) From 4db236aa60d9e5e79e567358341922d3b00ae8c5 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:12:23 -0500 Subject: [PATCH 26/39] Delete uke.img --- apps/Uke/uke.img | Bin 972 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 apps/Uke/uke.img diff --git a/apps/Uke/uke.img b/apps/Uke/uke.img deleted file mode 100644 index 0ccffbe611b219c2f6603cd98228e97beb7a9355..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 972 zcma)&F^0di*3Xy}XwMSw*ZFjhX?ta888bAsmPc0LrEyf9GjvJ| z%yBKfw`Z^_b1cvpy@baW7EoAAl(_G;%1Q%xvqDqw?WoFLp#pRw1zh?I2s0Jh7|smC zNC#Y}8+Vz!lSz~*-MtJNZ7*%zp_S*u|&d(=`8nbunk5X>~}*%eMw hk#5ag*>!?2Y`cBh#NK>cVWF3o+@lt&B;jh`{@&lpm@ohU From ff65314d260afdd70de385076a126606c151bd0f Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:17:39 -0500 Subject: [PATCH 27/39] Create ChangeLog --- apps/Uke/ChangeLog | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/Uke/ChangeLog diff --git a/apps/Uke/ChangeLog b/apps/Uke/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/Uke/ChangeLog @@ -0,0 +1 @@ +0.01: New App! From 1499c51e8d43ba946f94a8e544edb3fd6a5d38b7 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:18:16 -0500 Subject: [PATCH 28/39] Update app-icon.js --- apps/Uke/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Uke/app-icon.js b/apps/Uke/app-icon.js index 9d1f36e26..49232b838 100644 --- a/apps/Uke/app-icon.js +++ b/apps/Uke/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("oFAwg74iAfeiMBiIfcDwMRITkBilEIDQaBiNEolBIDJdBHwIABIDZeCIDYcCiRAbD4MRklCkhAZilBMAMhAQIfXboVEoRDBoQfbHwUhD68RfwQ+CiIfWgMSf4g+BYC0RkJADHwIoBHy5ACkRdXHwchEAIeBLq0BDQIdBHoIICICo+EbQgfUPoQABHwZ9ZAAI+EO6IABHwoHCDydEoIbETwI+TeINEAAS6CPqsBDwgfBPoQ+VDwlBHwYDBWyY+HIAT3TLwifCHgJ9UTow+CPqT5DPpA+BD548GXgoDCD54eHHwhJCD5weIfYoNBT5zZFXYZ9EMwR9NPg8RboY+CD5w+IigBCHwYfOHxRACBoYfMLxA+DXgQACX5kBDwofBHwUUAIJpDD5i9JHwJECD65aCHwQMETyJaCbAQ+CD4Y+ND4g8CbAJbBcQQ+QXwaVCiMhiQkCfgg+ND4w6BEAYLDDxpfGMQZhBY4gfTIAagCD7BAFc4gfQKopACFAgfWIAgfVgIWFcQQIFDxzgEIAhIGD61BT4wfQQAwYBE4p+PIBAAFTyBAJLywfCIBI+TMAJAJHyYgKiI+TMIYgEcQIeWEAYADDzAhEDrYAZA==")) +require("heatshrink").decompress(atob("mEwwJC/AH4A/AH4AgA==")) From 02c2d77cff17c8ce665398442c4fb7919c405381 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:18:59 -0500 Subject: [PATCH 29/39] Add files via upload --- apps/Uke/app.png | Bin 0 -> 3343 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/Uke/app.png diff --git a/apps/Uke/app.png b/apps/Uke/app.png new file mode 100644 index 0000000000000000000000000000000000000000..7a6dd67eaefed2489fdefd24a9546971b08458da GIT binary patch literal 3343 zcmV+q4e;`bP)BHNRu=q5E>v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ah5x{b|(4@pfqRj32 zPYFJ5*2(m}Vp9N~>c4z5l(~%&dX+5qHidA8rOykxC8IhC|bGmqsOL1Lq51VeQ=h713Hz+V`2L0_Pi=X~`1g8Al#K$L2o zME{QG6;oEW+5P3fahOtJ3-gDnqQoAal^NfsDS0G#qae{EB4PNIlQBI20bu#^1s@E?xDlyp}iq+Hx!B`!P z7g@p=GhT Date: Wed, 24 May 2023 22:24:05 -0500 Subject: [PATCH 30/39] Update metadata.json --- apps/Uke/metadata.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/Uke/metadata.json b/apps/Uke/metadata.json index 14f13dfcc..10c3b3e79 100644 --- a/apps/Uke/metadata.json +++ b/apps/Uke/metadata.json @@ -1,14 +1,14 @@ { "id": "Uke", "name": "Uke Chords", "shortName":"Uke", - "icon": "uke.png", "version":"0.01", "description": "Wrist mounted ukulele chords", - "tags": "uke", + "icon": "app.png", + "tags": "uke, chords", "supports" : ["BANGLEJS2"], "readme": "README.md", "storage": [ - {"name":"novadawn999.app.js","url":"app.js"}, - {"name":"uke.img","url":"app-icon.js","evaluate":true} + {"name":"Uke.app.js","url":"app.js"}, + {"name":"Uke.img","url":"app-icon.js","evaluate":true} ] } From c18eed606021d73159af7a6a93d83d14b988c16b Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:30:10 -0500 Subject: [PATCH 31/39] Update app-icon.js --- apps/Uke/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Uke/app-icon.js b/apps/Uke/app-icon.js index 49232b838..2709a145e 100644 --- a/apps/Uke/app-icon.js +++ b/apps/Uke/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("mEwwJC/AH4A/AH4AgA==")) +require("heatshrink").decompress(atob("AKBQMIO+IgH3ojAYiH3A8DESE5AYlRCA0GgY1JJJQSAyXQR8CAASA3FKJGp7ISAzEaJQYlLuoQGR8DEaHIkC1pKDFPHQadNA+vAYpQqGQQZHQg+zRKdIZbQlAxET6DQolNPFEQ+tAYlEYn1Kb3ZDoI0PlpEQAiCC3gYCPlpCHwVCCXVx8FoZCYQQ8CXVoCGgYjGhECCAiArES6CPgY0Gww+ovAgACIgT2sPhA+EOkjuGNgYUvASAGHlKJRIjqo1EdCHgh8k8QQ8CIAh4E3QWylAQ8IHwZE3Qx8mHAqFJKCfQR8CQgVsmHQh8EnAV8E90y8IGwh4C+014CHxEyDEZUQAR8gHQWmCPhB4C3gVACHzx4LQqJJC0EAAQGDoF0kAAU6CPggAHJB+cehQ8E+xJCDQU+c+RAEDQR4IAAQUCHzYCPhH0FEaCnAX+EHzz6IXQ4oAQjGEpgg+YPiAECYggaHGi8eMwqEPhBACSAQACvzICnBA+EGwR8MHzT8GNAg2C2ASEGLQqCH0AoE2AiAGSgRWCnkBiDoWsCPAlGESQx8YvhNCGAZEQBNIqwh8avg6IAwT6CQAQAEPgoiPjQ+EFAQGCewhAFEgUDIQ8aXxVGEYQ5IfUQ+LQSAFEjCCHgg+jpKENgR0CQA2OCH0wsCVQyAEiAhAEH0aEQAQECQAx6ECAQ+hCgqCQAQsCPQY0RwgEDQQ8c4A5EwhB+IBQQ+itg5JQU+Cngw+ioBQwE3hKEfjzAIAATEGnQl8iQBjGI3wi8iHwiAGQgh8s4QSAEGgXIFJJFGg8kgQm0GXQQEDER8mYQxAHRJCHlxAFGhECAAQ8wIRA62AGQA==")) From b68d832ff173525840a74e565aa5f0837b5c2299 Mon Sep 17 00:00:00 2001 From: NovaDawn999 <106365882+NovaDawn999@users.noreply.github.com> Date: Wed, 24 May 2023 22:36:07 -0500 Subject: [PATCH 32/39] Update app-icon.js --- apps/Uke/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/Uke/app-icon.js b/apps/Uke/app-icon.js index 2709a145e..17b77ab32 100644 --- a/apps/Uke/app-icon.js +++ b/apps/Uke/app-icon.js @@ -1 +1 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uToIuRgIuDCoUiFxjNCFwq7BC5YWBFoZdDAQIXLCwpdEogXKLYgWBXYZ9BC5SKDCwQYCkIHBC5IuFFQIYBiQhCC5JdFCoIYBBIYXJIwlEFwUUBIYXOLgIYDA4ReJC4i4BI4RODOxj/CAQIyBFwSOMoIYCagQ4BCxQXEigrBiS7CLpRHGAIMiMwYXMQoYwCSogXKU4gwCC6gwCC6ApEUoIFDRxR4Fd4QXReAgcEC5hIFLyAwJFxwwIiIWODATbDCyIYCAAQWSACY")) From f4c301eda937d0fafdfc9c07c3ab272d77e97b78 Mon Sep 17 00:00:00 2001 From: kamilkrz Date: Thu, 25 May 2023 09:09:11 +0200 Subject: [PATCH 33/39] Initial commit --- apps/chargerot/ChangeLog | 1 + apps/chargerot/README.md | 10 ++++++++++ apps/chargerot/boot.js | 13 +++++++++++++ apps/chargerot/icon.png | Bin 0 -> 3588 bytes apps/chargerot/metadata.json | 15 +++++++++++++++ apps/chargerot/settings.js | 28 ++++++++++++++++++++++++++++ 6 files changed, 67 insertions(+) create mode 100644 apps/chargerot/ChangeLog create mode 100644 apps/chargerot/README.md create mode 100644 apps/chargerot/boot.js create mode 100644 apps/chargerot/icon.png create mode 100644 apps/chargerot/metadata.json create mode 100644 apps/chargerot/settings.js diff --git a/apps/chargerot/ChangeLog b/apps/chargerot/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/chargerot/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/chargerot/README.md b/apps/chargerot/README.md new file mode 100644 index 000000000..764a5ffda --- /dev/null +++ b/apps/chargerot/README.md @@ -0,0 +1,10 @@ +# Charge LCD rotation + +This simple app is for handling all types of charging cradles i.e.: +- [Official Bangle.js 2 dock](https://shop.espruino.com/banglejs2-dock) +- [Many more you can 3d print](https://www.thingiverse.com/search?q=banglejs+dock&page=1&type=things&sort=relevant) + +## Setup +In app settings set desired rotation. +App will swap screen rotation when charged and return to default one (you can change this in settings app) when undocked. + diff --git a/apps/chargerot/boot.js b/apps/chargerot/boot.js new file mode 100644 index 000000000..10f7638af --- /dev/null +++ b/apps/chargerot/boot.js @@ -0,0 +1,13 @@ +(() => { + const chargingRotation = 0 | require('Storage').readJSON("chargerot.settings.json").rotate; + const defaultRotation = 0 | require('Storage').readJSON("setting.json").rotate; + Bangle.on('charging', (charging) => { + if (charging) { + g.setRotation(chargingRotation&3,chargingRotation>>2).clear(); + Bangle.showClock(); + } else { + g.setRotation(defaultRotation&3,defaultRotation>>2).clear(); + Bangle.showClock(); + } + }); +})(); diff --git a/apps/chargerot/icon.png b/apps/chargerot/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3347098e5e32398b67f248451bff777605f9d027 GIT binary patch literal 3588 zcmai1S5OlQuuY?eB7`DbX`x9+=^!Q4L^`2L3sMAWkuEi%3L=K0fV2P+BhsaY78Dhv zqgM?|M%wY%-OTEJG=X{A7|68EKFFL`I!L#04oYiU0LY8}2Vm4w-H7w#KVe3WVd!9=ut<*(Z-9Y!KrRZw_m)< zOxf7nt~#e6?||Uwgf%tmk4s{Kqna}_(yw!2p&6IC8R3`vxVeo}3)giHu=6F6oiUV> z(x8n^)Y*%w==sULlE~A&(wNbX)mE}}xGkHFB(aGs4I(+!(aC>$|FFZYD9m5Ca)zu5 z@&V)rEx&VlW=?4-n+Ob00VVqQ*o$b-6wVqS!urj>~V&0wD#0>UWz(p6z|-~JO5;DQ0Xx^e`890W6RXiaiN55Dlo4E;P)7Y z*ELBiOVQUgHJgwqaTui^x{gyGLQ%mxI&YE+CoiZw746_dRBi-;xR7APC;nP_5?-&U zIiSSf|HAkWYf0iOGR(^3BNJKiJH+;4I7m8E6Uc2`f@7|<&`bH>%4h5#<*~Dz-A}oH zA&%^_;6rc>@Fc^x+5twSO{U?<)Ft9rb%`n9H9nonJ0RZYPH(ftPKZG8Ko9dO%JsF3 zslGKVm?OC1MmR+MsU*%$7z&vqB0GsP+^SJ~SpW@_@kV}yBXy(5{<0>wadYNiT$j9W z5&Q*Ro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r(! z-EjnsksmL&y`fh_Qnr76m-i0;HD^`5Nbp|>A6q6+;EOwnI2pIY2KpDIM(AJy5jYYz z895U-E4GaYr-^J6G;ec)AAC|+0Y8sgsjp{&d@{%UlhT)%FF{Y-ATBIxCBqw zZ{L8vnX`z-`Zb9|7W{SJ`tizWI-tt`C)@uIRbO3*vux1sf%EL&rr#{N(So{vyq back(), + 'Rotate': { + value: 0|appSettings.rotate, + min: 0, + max: rotNames.length-1, + format: v=> rotNames[v], + onchange: v => { + appSettings.rotate = 0 | v; + writeSettings(); + } + }, + }); + // If(true) big(); +}) \ No newline at end of file From 367441b333115f209aa03d0c454cb39e768c8153 Mon Sep 17 00:00:00 2001 From: kamilkrz Date: Thu, 25 May 2023 11:17:05 +0200 Subject: [PATCH 34/39] fix typo --- apps/chargerot/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/chargerot/settings.js b/apps/chargerot/settings.js index f7227bd72..eaaa488f1 100644 --- a/apps/chargerot/settings.js +++ b/apps/chargerot/settings.js @@ -11,7 +11,7 @@ E.showMenu({ - "" : { "title" : "Carging rotation" }, + "" : { "title" : "Charging rotation" }, "< Back" : () => back(), 'Rotate': { value: 0|appSettings.rotate, From f8f43914394ee8bb4c7a3847b9b9c9bea9362ab5 Mon Sep 17 00:00:00 2001 From: kamilkrz Date: Thu, 25 May 2023 11:26:03 +0200 Subject: [PATCH 35/39] Handling state of rotation regardless event itself --- apps/chargerot/boot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/chargerot/boot.js b/apps/chargerot/boot.js index 10f7638af..0a4361c50 100644 --- a/apps/chargerot/boot.js +++ b/apps/chargerot/boot.js @@ -1,6 +1,7 @@ (() => { const chargingRotation = 0 | require('Storage').readJSON("chargerot.settings.json").rotate; const defaultRotation = 0 | require('Storage').readJSON("setting.json").rotate; + if (Bangle.isCharging()) g.setRotation(chargingRotation&3,chargingRotation>>2).clear(); Bangle.on('charging', (charging) => { if (charging) { g.setRotation(chargingRotation&3,chargingRotation>>2).clear(); From b784dd9c87b31ee227efc1affd30fedeaaee23e9 Mon Sep 17 00:00:00 2001 From: Romanist Date: Fri, 26 May 2023 13:33:40 +0400 Subject: [PATCH 36/39] Update metadata.json --- apps/pebbled/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pebbled/metadata.json b/apps/pebbled/metadata.json index 9e71a914b..62fabc3e7 100644 --- a/apps/pebbled/metadata.json +++ b/apps/pebbled/metadata.json @@ -2,7 +2,7 @@ "id": "pebbled", "name": "Pebble Clock with distance", "shortName": "Pebble + distance", - "version": "0.03", + "version": "0.04", "description": "Fork of Pebble Clock with distance in KM. Both step count and the distance are on the main screen. Default step length = 0.75m (can be changed in settings).", "readme": "README.md", "icon": "pebbled.png", From ea18926dc86bd61f8f3afa92a1f7cf6c43db0d74 Mon Sep 17 00:00:00 2001 From: Romanist Date: Fri, 26 May 2023 13:34:30 +0400 Subject: [PATCH 37/39] Update ChangeLog --- apps/pebbled/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/pebbled/ChangeLog b/apps/pebbled/ChangeLog index d2f71f908..a0127ffce 100644 --- a/apps/pebbled/ChangeLog +++ b/apps/pebbled/ChangeLog @@ -2,3 +2,4 @@ 0.02: Tell clock widgets to hide. 0.03: Swipe down to see widgets Support for fast loading +0.04: Localisation request: added Miles and AM/PM From 48a2671ff8fd1b4e4a7fe4594590ef686602b6e6 Mon Sep 17 00:00:00 2001 From: Romanist Date: Fri, 26 May 2023 13:37:00 +0400 Subject: [PATCH 38/39] Update pebbled.settings.js --- apps/pebbled/pebbled.settings.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/pebbled/pebbled.settings.js b/apps/pebbled/pebbled.settings.js index d6c84d5d1..f4ca1d394 100644 --- a/apps/pebbled/pebbled.settings.js +++ b/apps/pebbled/pebbled.settings.js @@ -2,7 +2,7 @@ const SETTINGS_FILE = "pebbleDistance.json"; // initialize with default settings... - let s = {'bg': '#0f0', 'color': 'Green', 'avStep': 0.75}; + let s = {'bg': '#0f0', 'color': 'Green', 'avStep': 0.75, 'localization': 'World'}; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -20,9 +20,10 @@ var color_options = ['Green','Orange','Cyan','Purple','Red','Blue']; var bg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f']; + var local_options = ['World', 'US']; E.showMenu({ - '': { 'title': 'Pebble Clock' }, + '': { 'title': 'PebbleD Clock' }, '< Back': back, 'Color': { value: 0 | color_options.indexOf(s.color), @@ -43,6 +44,15 @@ s.avStep = v; save(); } + }, + 'Localization': { + value: 0 | local_options.indexOf(s.localization), + min: 0, max: 1, + format: v => local_options[v], + onchange: v => { + s.localization = local_options[v]; + save(); + }, } }); }); From 311c35a8b8a684b8de934a37cb3d09438585e8a1 Mon Sep 17 00:00:00 2001 From: Romanist Date: Fri, 26 May 2023 13:41:03 +0400 Subject: [PATCH 39/39] Update pebbled.app.js --- apps/pebbled/pebbled.app.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/apps/pebbled/pebbled.app.js b/apps/pebbled/pebbled.app.js index 627a7651c..54b56712c 100644 --- a/apps/pebbled/pebbled.app.js +++ b/apps/pebbled/pebbled.app.js @@ -16,6 +16,15 @@ let drawTimeout; let loadSettings = function() { settings = require("Storage").readJSON(SETTINGS_FILE,1)|| {'bg': '#0f0', 'color': 'Green', 'avStep': 0.75}; }; + +let tConv24 = function(time24) { + var ts = time24; + var H = +ts.substr(0, 2); + var h = (H % 12) || 12; + h = (h < 10)?("0"+h):h; + ts = h + ts.substr(2, 3); + return ts; +} const img = require("heatshrink").decompress(atob("oFAwkEogA/AH4A/AH4A/AH4A/AE8AAAoeXoAfeDQUBmcyD7A+Dh///8QD649CiAfaHwUvD4sEHy0DDYIfEICg+Cn4fHICY+DD4nxcgojOHwgfEIAYfRCIQaDD4ZAFD5r7DH4//kAfRCIZ/GAAnwD5p9DX44fTHgYSBf4ofVDAQEBl4fFUAgfOXoQzBgIfFBAIfPP4RAEAoYAB+cRiK/SG4h/WIBAfXIA7CBAAswD55AHn6fUIBMCD65AHl4gCmcziAfQQJqfQQJpiDgk0IDXxQLRAEECaBM+QgRYRYgUIA0CD4ggSQJiDCiAKBICszAAswD55AHABKBVD7BAFABIqBD5pAFABPxD55AOD6BADiIAJQAyxLABwf/gaAPAH4A/AH4ARA==")); @@ -30,16 +39,19 @@ let batteryWarning = false; let draw = function() { let date = new Date(); let da = date.toString().split(" "); - let timeStr = da[4].substr(0,5); + let timeStr = settings.localization === "US" ? tConv24(da[4].substr(0,5)) : da[4].substr(0,5); const t = 6; let stps = Bangle.getHealthStatus("day").steps; + const distInKm = (stps / 1000 * settings.avStep).toFixed(2); + const distance = settings.localization === "US" ? (distInKm / 1.609).toFixed(2) : distInKm; + const distanceStr = settings.localization === "US" ? distance + ' MI' : distance + ' KM'; - // turn the warning on once we have dipped below 15% - if (E.getBattery() < 15) + // turn the warning on once we have dipped below 25% + if (E.getBattery() < 25) batteryWarning = true; - // turn the warning off once we have dipped above 20% - if (E.getBattery() > 20) + // turn the warning off once we have dipped above 30% + if (E.getBattery() > 30) batteryWarning = false; g.reset(); @@ -88,7 +100,7 @@ let draw = function() { g.setColor('#fff'); // white on blue or red best contrast else g.setColor('#000'); // otherwise black regardless of theme - g.drawString((stps / 1000 * settings.avStep).toFixed(2) + ' KM', w/2, ha + 107); + g.drawString(distanceStr, w/2, ha + 107); // queue next draw if (drawTimeout) clearTimeout(drawTimeout);