diff --git a/apps/widgps/ChangeLog b/apps/widgps/ChangeLog index 57bb53bb7..3d47b8a0c 100644 --- a/apps/widgps/ChangeLog +++ b/apps/widgps/ChangeLog @@ -1,3 +1,4 @@ 0.01: First version 0.02: Don't break if running on 2v08 firmware (just don't display anything) 0.03: Fix positioning +0.04: Show GPS fix status diff --git a/apps/widgps/README.md b/apps/widgps/README.md index 82aaf7d2f..37e088bcf 100644 --- a/apps/widgps/README.md +++ b/apps/widgps/README.md @@ -1,14 +1,17 @@ # GPS Power Status Widget -A simple widget that shows the on/off status of the GPS. +A simple widget that shows the on/off and fix status of the GPS. The GPS can quickly run the battery down if it is on all the time so it is useful to know if it has been switched on or not. - Uses Bangle.isGPSOn() - Shows in grey when the GPS is off -- Shows in amber when the GPS is on +- Shows in amber when the GPS is on but has no fix +- Shows in green when the GPS is on and has a fix Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/) + +Extended by Marco ([myxor](https://github.com/myxor)) diff --git a/apps/widgps/metadata.json b/apps/widgps/metadata.json index 87790a895..2f59aa82a 100644 --- a/apps/widgps/metadata.json +++ b/apps/widgps/metadata.json @@ -1,8 +1,8 @@ { "id": "widgps", "name": "GPS Widget", - "version": "0.03", - "description": "Tiny widget to show the power on/off status of the GPS", + "version": "0.04", + "description": "Tiny widget to show the power and fix status of the GPS", "icon": "widget.png", "type": "widget", "tags": "widget,gps", diff --git a/apps/widgps/widget.js b/apps/widgps/widget.js index 6ef55e27b..25df2178a 100644 --- a/apps/widgps/widget.js +++ b/apps/widgps/widget.js @@ -4,7 +4,12 @@ function draw() { g.reset(); if (Bangle.isGPSOn()) { - g.setColor("#FD0"); // on = amber + const gpsObject = Bangle.getGPSFix(); + if (gpsObject && gpsObject.fix > 0) { + g.setColor("#0F0"); // on and has fix = green + } else { + g.setColor("#FD0"); // on but no fix = amber + } } else { g.setColor("#888"); // off = grey } @@ -15,7 +20,7 @@ Bangle.on('lcdPower', function(on) { if (on) { WIDGETS.gps.draw(); - if (!timerInterval) timerInterval = setInterval(()=>WIDGETS["gps"].draw(), 2000); + if (!timerInterval) timerInterval = setInterval(()=>WIDGETS.gps.draw(), 2000); } else { if (timerInterval) { clearInterval(timerInterval);