widgps: move interval check to draw method
parent
d20b52ee79
commit
9fa406450b
|
|
@ -6,14 +6,6 @@
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,6 +21,16 @@
|
||||||
} else {
|
} else {
|
||||||
g.setColor("#888"); // off = grey
|
g.setColor("#888"); // off = grey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if we need to update the widget periodically
|
||||||
|
if (Bangle.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 (!Bangle.isGPSOn() && interval !== undefined) {
|
||||||
|
clearInterval(interval);
|
||||||
|
interval = undefined;
|
||||||
|
}
|
||||||
g.drawImage(atob("GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="), this.x, 2+this.y);
|
g.drawImage(atob("GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="), this.x, 2+this.y);
|
||||||
}};
|
}};
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue