From 6b9c955dc580bf71abcaebd6869bc006f02b2f11 Mon Sep 17 00:00:00 2001 From: paul-arg Date: Sat, 8 Jun 2024 17:54:19 +0200 Subject: [PATCH 1/7] fix(astrocalc): handle when the moon rise or set don't occur on the current day --- apps/astrocalc/astrocalc-app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/astrocalc/astrocalc-app.js b/apps/astrocalc/astrocalc-app.js index cd1965290..02bcefc43 100644 --- a/apps/astrocalc/astrocalc-app.js +++ b/apps/astrocalc/astrocalc-app.js @@ -180,8 +180,8 @@ function drawMoonTimesPage(gps, title) { const moonColor = g.theme.dark ? {r: 1, g: 1, b: 1} : {r: 0, g: 0, b: 0}; const pageData = { - Rise: dateToTimeString(times.rise), - Set: dateToTimeString(times.set), + Rise: times.rise ? dateToTimeString(times.rise) : "Not today", + Set: times.set ? dateToTimeString(times.set) : "Not today", }; drawData(title, pageData, null, g.getHeight()/2 - Object.keys(pageData).length/2*20 + 5); From 507dafc8b4b1eb7364894a38f16fc8a7e135aa58 Mon Sep 17 00:00:00 2001 From: paul-arg Date: Sat, 8 Jun 2024 22:28:05 +0200 Subject: [PATCH 2/7] astrocalc: Update metadata.json --- apps/astrocalc/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/astrocalc/metadata.json b/apps/astrocalc/metadata.json index a43534325..d88037d09 100644 --- a/apps/astrocalc/metadata.json +++ b/apps/astrocalc/metadata.json @@ -1,7 +1,7 @@ { "id": "astrocalc", "name": "Astrocalc", - "version": "0.08", + "version": "0.09", "description": "Calculates interesting information on the sun like sunset and sunrise and moon cycles for the current day based on your location from MyLocation app", "icon": "astrocalc.png", "tags": "app,sun,moon,cycles,tool,outdoors", From db4ce65672fc94bd38ad0aa3c3031e9212b3cd27 Mon Sep 17 00:00:00 2001 From: paul-arg Date: Sat, 8 Jun 2024 22:29:21 +0200 Subject: [PATCH 3/7] astrocalc: Update ChangeLog --- apps/astrocalc/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/astrocalc/ChangeLog b/apps/astrocalc/ChangeLog index ee9c7bbe4..df039ba0e 100644 --- a/apps/astrocalc/ChangeLog +++ b/apps/astrocalc/ChangeLog @@ -6,3 +6,4 @@ 0.06: Fix azimuth (bug #2651), only show degrees 0.07: Minor code improvements 0.08: Minor code improvements +0.09: Fix: Handle when the moon rise/set do not occur on the current day From fe3142355b6733cfa0bcf4ef672d87fa96488d6c Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Sun, 9 Jun 2024 15:36:03 +0200 Subject: [PATCH 4/7] astrocalc: fix lint warnings - Comment out an unused function - move initialization, `let m;` further up in the file. --- apps/astrocalc/astrocalc-app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/astrocalc/astrocalc-app.js b/apps/astrocalc/astrocalc-app.js index 02bcefc43..987470351 100644 --- a/apps/astrocalc/astrocalc-app.js +++ b/apps/astrocalc/astrocalc-app.js @@ -232,6 +232,8 @@ function drawSunShowPage(gps, key, date) { return null; } +let m; + function sunIndexPageMenu(gps) { const sunTimes = SunCalc.getTimes(new Date(), gps.lat, gps.lon); @@ -300,9 +302,9 @@ function indexPageMenu(gps) { return E.showMenu(menu); } -function getCenterStringX(str) { - return (g.getWidth() - g.stringWidth(str)) / 2; -} +//function getCenterStringX(str) { +// return (g.getWidth() - g.stringWidth(str)) / 2; +//} function init() { let location = require("Storage").readJSON("mylocation.json",1)||{"lat":51.5072,"lon":0.1276,"location":"London"}; @@ -311,5 +313,4 @@ function init() { Bangle.drawWidgets(); } -let m; init(); From 4ef353326468de47309afc2e9251efb8a579b77c Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Sun, 9 Jun 2024 15:50:50 +0200 Subject: [PATCH 5/7] astrocalc: fix lint warning - remove the variable `m` that was repeatedly assigned the return value of `E.showMenu` but never used. --- apps/astrocalc/astrocalc-app.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/astrocalc/astrocalc-app.js b/apps/astrocalc/astrocalc-app.js index 987470351..283c5aab7 100644 --- a/apps/astrocalc/astrocalc-app.js +++ b/apps/astrocalc/astrocalc-app.js @@ -232,8 +232,6 @@ function drawSunShowPage(gps, key, date) { return null; } -let m; - function sunIndexPageMenu(gps) { const sunTimes = SunCalc.getTimes(new Date(), gps.lat, gps.lon); @@ -242,7 +240,7 @@ function sunIndexPageMenu(gps) { "title": "-- Sun --", }, "Current Pos": () => { - m = E.showMenu(); + E.showMenu(); drawSunShowPage(gps, "Current Pos", new Date()); }, }; @@ -250,13 +248,13 @@ function sunIndexPageMenu(gps) { Object.keys(sunTimes).sort().reduce((menu, key) => { const title = titlizeKey(key); menu[title] = () => { - m = E.showMenu(); + E.showMenu(); drawSunShowPage(gps, key, sunTimes[key]); }; return menu; }, sunMenu); - sunMenu["< Back"] = () => m = indexPageMenu(gps); + sunMenu["< Back"] = () => indexPageMenu(gps); return E.showMenu(sunMenu); } @@ -268,18 +266,18 @@ function moonIndexPageMenu(gps) { "title": "-- Moon --", }, "Times": () => { - m = E.showMenu(); + E.showMenu(); drawMoonTimesPage(gps, /*LANG*/"Times"); }, "Position": () => { - m = E.showMenu(); + E.showMenu(); drawMoonPositionPage(gps, /*LANG*/"Position"); }, "Illumination": () => { - m = E.showMenu(); + E.showMenu(); drawMoonIlluminationPage(gps, /*LANG*/"Illumination"); }, - "< Back": () => m = indexPageMenu(gps), + "< Back": () => indexPageMenu(gps), }; return E.showMenu(moonMenu); @@ -291,10 +289,10 @@ function indexPageMenu(gps) { "title": /*LANG*/"Select", }, /*LANG*/"Sun": () => { - m = sunIndexPageMenu(gps); + sunIndexPageMenu(gps); }, /*LANG*/"Moon": () => { - m = moonIndexPageMenu(gps); + moonIndexPageMenu(gps); }, "< Back": () => { load(); } }; From 5b785bc5d14ea62f7e74c118daf1336c9dae4a8c Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Sun, 9 Jun 2024 17:21:58 +0200 Subject: [PATCH 6/7] run: add hint re runplus in description --- apps/run/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/run/metadata.json b/apps/run/metadata.json index 99296180d..126d8fcf0 100644 --- a/apps/run/metadata.json +++ b/apps/run/metadata.json @@ -1,7 +1,7 @@ { "id": "run", "name": "Run", "version": "0.19", - "description": "Displays distance, time, steps, cadence, pace and more for runners.", + "description": "Displays distance, time, steps, cadence, pace and more for runners. The **Run+** app for Bangle.js 2 provides additional features.", "icon": "app.png", "tags": "run,running,fitness,outdoors,gps", "supports" : ["BANGLEJS","BANGLEJS2"], From 13e25279b92c5395ce82add263da9459f2970e03 Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Sun, 9 Jun 2024 17:23:37 +0200 Subject: [PATCH 7/7] run: add to readme hint re runplus --- apps/run/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/run/README.md b/apps/run/README.md index 7f645b518..452549856 100644 --- a/apps/run/README.md +++ b/apps/run/README.md @@ -6,6 +6,8 @@ shows distance, time, steps, cadence, pace and more. To use it, start the app and press the middle button so that the red `STOP` in the bottom right turns to a green `RUN`. +The separate **Run+** app for Bangle.js 2 provides additional features. + ## Display * `DIST` - the distance travelled based on the GPS (if you have a GPS lock).