Merge pull request #2084 from khromov/gps-widget-configuration
Add option to hide GPS widget when GPS is offmaster
commit
2e8ded053b
|
|
@ -5,3 +5,4 @@
|
||||||
0.05: Don't poll for GPS status, override setGPSPower handler (fix #1456)
|
0.05: Don't poll for GPS status, override setGPSPower handler (fix #1456)
|
||||||
0.06: Periodically update so the always on display does show current GPS fix
|
0.06: Periodically update so the always on display does show current GPS fix
|
||||||
0.07: Alternative marker icon (configurable via settings)
|
0.07: Alternative marker icon (configurable via settings)
|
||||||
|
0.08: Add ability to hide the icon when GPS is off, for a cleaner appearance.
|
||||||
|
|
@ -14,6 +14,7 @@ There are two icons which can be used to visualize the GPS/GNSS status:
|
||||||
- Shows in green when the GPS is on and has a fix
|
- Shows in green when the GPS is on and has a fix
|
||||||
2. Different place markers depending on GPS/GNSS status
|
2. Different place markers depending on GPS/GNSS status
|
||||||
|
|
||||||
|
You can also choose to hide the icon when the GPS is off in the settings.
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -21,4 +22,6 @@ Forum](http://forum.espruino.com/microcosms/1424/)
|
||||||
|
|
||||||
Extended by Marco ([myxor](https://github.com/myxor))
|
Extended by Marco ([myxor](https://github.com/myxor))
|
||||||
|
|
||||||
|
Extended by khromov ([khromov](https://github.com/khromov))
|
||||||
|
|
||||||
Place marker icons from [icons8.com](https://icons8.com/icon/set/maps/material-outlined).
|
Place marker icons from [icons8.com](https://icons8.com/icon/set/maps/material-outlined).
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"crossIcon": "true"}
|
{"crossIcon": true, "hideWhenGpsOff": false}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widgps",
|
"id": "widgps",
|
||||||
"name": "GPS Widget",
|
"name": "GPS Widget",
|
||||||
"version": "0.07",
|
"version": "0.08",
|
||||||
"description": "Tiny widget to show the power and fix status of the GPS/GNSS",
|
"description": "Tiny widget to show the power and fix status of the GPS/GNSS",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,13 @@ var mainmenu = {
|
||||||
'' : {'title' : 'GPS widget'},
|
'' : {'title' : 'GPS widget'},
|
||||||
'< Back' : back,
|
'< Back' : back,
|
||||||
"Cross icon" : {
|
"Cross icon" : {
|
||||||
value : !!settings.crossIcon ,
|
value : settings.crossIcon ,
|
||||||
onchange : v => { writeSettings("crossIcon", v); }
|
onchange : v => { writeSettings("crossIcon", v); }
|
||||||
},
|
},
|
||||||
|
"Hide icon when GPS off" : {
|
||||||
|
value : settings.hideWhenGpsOff ,
|
||||||
|
onchange : v => { writeSettings("hideWhenGpsOff", v); }
|
||||||
|
},
|
||||||
};
|
};
|
||||||
E.showMenu(mainmenu);
|
E.showMenu(mainmenu);
|
||||||
});
|
});
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
(function() {
|
(function() {
|
||||||
let settings =
|
|
||||||
require("Storage").readJSON("widgps.json", 1) || {crossIcon : true};
|
let settings = Object.assign(
|
||||||
|
require('Storage').readJSON("widgps.default.json", true) || {},
|
||||||
|
require('Storage').readJSON("widgps.json", true) || {}
|
||||||
|
);
|
||||||
|
|
||||||
var interval;
|
var interval;
|
||||||
|
|
||||||
|
|
@ -35,13 +38,23 @@ WIDGETS.gps = {
|
||||||
} else {
|
} else {
|
||||||
g.setColor("#FD0"); // on but no fix = amber
|
g.setColor("#FD0"); // on but no fix = amber
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
g.setColor("#888"); // off = grey
|
g.drawImage(
|
||||||
}
|
|
||||||
g.drawImage(
|
|
||||||
atob(
|
atob(
|
||||||
"GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="),
|
"GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="),
|
||||||
this.x, 2 + this.y);
|
this.x, 2 + this.y);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(!settings.hideWhenGpsOff) {
|
||||||
|
g.setColor("#888"); // off = grey
|
||||||
|
|
||||||
|
g.drawImage(
|
||||||
|
atob(
|
||||||
|
"GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="),
|
||||||
|
this.x, 2 + this.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else { // marker icons
|
} else { // marker icons
|
||||||
if (Bangle.isGPSOn()) {
|
if (Bangle.isGPSOn()) {
|
||||||
const gpsObject = Bangle.getGPSFix();
|
const gpsObject = Bangle.getGPSFix();
|
||||||
|
|
@ -59,9 +72,11 @@ WIDGETS.gps = {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// GNSS off
|
// GNSS off
|
||||||
g.drawImage(
|
if(!settings.hideWhenGpsOff) {
|
||||||
atob("GBiBAAAAAAAAAAB+ABj/ABxDgA4AwAcAwAeMYAfEYAbgYAZwYAM4wAMcQAOOAAGHAAHDgADDwABm4AB+cAA8OAAYGAAAAAAAAAAAAA=="),
|
g.drawImage(
|
||||||
this.x, 2 + this.y);
|
atob("GBiBAAAAAAAAAAB+ABj/ABxDgA4AwAcAwAeMYAfEYAbgYAZwYAM4wAMcQAOOAAGHAAHDgADDwABm4AB+cAA8OAAYGAAAAAAAAAAAAA=="),
|
||||||
|
this.x, 2 + this.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue