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.06: Periodically update so the always on display does show current GPS fix
|
||||
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
|
||||
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
|
||||
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 khromov ([khromov](https://github.com/khromov))
|
||||
|
||||
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",
|
||||
"name": "GPS Widget",
|
||||
"version": "0.07",
|
||||
"version": "0.08",
|
||||
"description": "Tiny widget to show the power and fix status of the GPS/GNSS",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
|||
|
|
@ -20,9 +20,13 @@ var mainmenu = {
|
|||
'' : {'title' : 'GPS widget'},
|
||||
'< Back' : back,
|
||||
"Cross icon" : {
|
||||
value : !!settings.crossIcon ,
|
||||
value : settings.crossIcon ,
|
||||
onchange : v => { writeSettings("crossIcon", v); }
|
||||
},
|
||||
"Hide icon when GPS off" : {
|
||||
value : settings.hideWhenGpsOff ,
|
||||
onchange : v => { writeSettings("hideWhenGpsOff", v); }
|
||||
},
|
||||
};
|
||||
E.showMenu(mainmenu);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
(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;
|
||||
|
||||
|
|
@ -35,13 +38,23 @@ WIDGETS.gps = {
|
|||
} else {
|
||||
g.setColor("#FD0"); // on but no fix = amber
|
||||
}
|
||||
} else {
|
||||
g.setColor("#888"); // off = grey
|
||||
}
|
||||
g.drawImage(
|
||||
|
||||
g.drawImage(
|
||||
atob(
|
||||
"GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="),
|
||||
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
|
||||
if (Bangle.isGPSOn()) {
|
||||
const gpsObject = Bangle.getGPSFix();
|
||||
|
|
@ -59,9 +72,11 @@ WIDGETS.gps = {
|
|||
}
|
||||
} else {
|
||||
// GNSS off
|
||||
g.drawImage(
|
||||
atob("GBiBAAAAAAAAAAB+ABj/ABxDgA4AwAcAwAeMYAfEYAbgYAZwYAM4wAMcQAOOAAGHAAHDgADDwABm4AB+cAA8OAAYGAAAAAAAAAAAAA=="),
|
||||
this.x, 2 + this.y);
|
||||
if(!settings.hideWhenGpsOff) {
|
||||
g.drawImage(
|
||||
atob("GBiBAAAAAAAAAAB+ABj/ABxDgA4AwAcAwAeMYAfEYAbgYAZwYAM4wAMcQAOOAAGHAAHDgADDwABm4AB+cAA8OAAYGAAAAAAAAAAAAA=="),
|
||||
this.x, 2 + this.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue