GPS widget: show fix status
parent
fa18794eba
commit
4cb847fa11
|
|
@ -1,3 +1,4 @@
|
||||||
0.01: First version
|
0.01: First version
|
||||||
0.02: Don't break if running on 2v08 firmware (just don't display anything)
|
0.02: Don't break if running on 2v08 firmware (just don't display anything)
|
||||||
0.03: Fix positioning
|
0.03: Fix positioning
|
||||||
|
0.04: Show GPS fix status
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,17 @@
|
||||||
# GPS Power Status Widget
|
# 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
|
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.
|
it is useful to know if it has been switched on or not.
|
||||||
|
|
||||||
- Uses Bangle.isGPSOn()
|
- Uses Bangle.isGPSOn()
|
||||||
- Shows in grey when the GPS is off
|
- 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
|
Written by: [Hugh Barney](https://github.com/hughbarney) For support
|
||||||
and discussion please post in the [Bangle JS
|
and discussion please post in the [Bangle JS
|
||||||
Forum](http://forum.espruino.com/microcosms/1424/)
|
Forum](http://forum.espruino.com/microcosms/1424/)
|
||||||
|
|
||||||
|
Extended by Marco ([myxor](https://github.com/myxor))
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"id": "widgps",
|
"id": "widgps",
|
||||||
"name": "GPS Widget",
|
"name": "GPS Widget",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "Tiny widget to show the power on/off status of the GPS",
|
"description": "Tiny widget to show the power and fix status of the GPS",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
"tags": "widget,gps",
|
"tags": "widget,gps",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,12 @@
|
||||||
function draw() {
|
function draw() {
|
||||||
g.reset();
|
g.reset();
|
||||||
if (Bangle.isGPSOn()) {
|
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 {
|
} else {
|
||||||
g.setColor("#888"); // off = grey
|
g.setColor("#888"); // off = grey
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +20,7 @@
|
||||||
Bangle.on('lcdPower', function(on) {
|
Bangle.on('lcdPower', function(on) {
|
||||||
if (on) {
|
if (on) {
|
||||||
WIDGETS.gps.draw();
|
WIDGETS.gps.draw();
|
||||||
if (!timerInterval) timerInterval = setInterval(()=>WIDGETS["gps"].draw(), 2000);
|
if (!timerInterval) timerInterval = setInterval(()=>WIDGETS.gps.draw(), 2000);
|
||||||
} else {
|
} else {
|
||||||
if (timerInterval) {
|
if (timerInterval) {
|
||||||
clearInterval(timerInterval);
|
clearInterval(timerInterval);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue