widgps: add intervall to update the widget
Periodically update so the always on display does show current GPS fixmaster
parent
d1873ad166
commit
d20b52ee79
|
|
@ -3,3 +3,4 @@
|
||||||
0.03: Fix positioning
|
0.03: Fix positioning
|
||||||
0.04: Show GPS fix status
|
0.04: Show GPS fix status
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widgps",
|
"id": "widgps",
|
||||||
"name": "GPS Widget",
|
"name": "GPS Widget",
|
||||||
"version": "0.05",
|
"version": "0.06",
|
||||||
"description": "Tiny widget to show the power and fix 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",
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,19 @@
|
||||||
(function(){
|
(function(){
|
||||||
|
var interval;
|
||||||
|
|
||||||
// override setGPSPower so we know if GPS is on or off
|
// override setGPSPower so we know if GPS is on or off
|
||||||
var oldSetGPSPower = Bangle.setGPSPower;
|
var oldSetGPSPower = Bangle.setGPSPower;
|
||||||
Bangle.setGPSPower = function(on,id) {
|
Bangle.setGPSPower = function(on,id) {
|
||||||
var isGPSon = oldSetGPSPower(on,id);
|
var isGPSon = oldSetGPSPower(on,id);
|
||||||
WIDGETS.gps.draw();
|
WIDGETS.gps.draw();
|
||||||
|
if (isGPSon && interval === undefined) {
|
||||||
|
interval = setInterval(function() {
|
||||||
|
WIDGETS.gps.draw(WIDGETS.gps);
|
||||||
|
}, 10*1000); // update every 10 seconds to show gps fix/no fix
|
||||||
|
} else if (!isGPSon && interval !== undefined) {
|
||||||
|
clearInterval(interval);
|
||||||
|
interval = undefined;
|
||||||
|
}
|
||||||
return isGPSon;
|
return isGPSon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue