I have developed a little widget that works like the bluetooth widget to show the power status of the GPS.
This uses Bangle.isGPSOn() which is in the leading edge formware v2.08.167
I wont check in until that firmware is generally available.
One thing I have found is that when I switch to a multiclock face that switches the GPS On; the widget does not repond and display the status until the LCD has powered off, or I change to a different clock face. To get round this I am poking the widget using.
// poke the gps widget indicator to change
if (WIDGETS.gps !== undefined) {
WIDGETS.gps.draw();
}
Code of widget below:
(function(){
var img = E.toArrayBuffer(atob("GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="));
function draw() {
g.reset();
if (Bangle.isGPSOn()) {
g.setColor(1,0.8,0); // on = amber
} else {
g.setColor(0.3,0.3,0.3); // off = grey
}
g.drawImage(img, 10+this.x, 2+this.y);
}
var timerInterval;
Bangle.on('lcdPower', function(on) {
if (on) {
WIDGETS.gps.draw();
if (!timerInterval) timerInterval = setInterval(()=>WIDGETS["gps"].draw(), 2000);
} else {
if (timerInterval) {
clearInterval(timerInterval);
timerInterval = undefined;
}
}
});
WIDGETS.gps={area:"tr",width:24,draw:draw};
})();
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I have developed a little widget that works like the bluetooth widget to show the power status of the GPS.
This uses Bangle.isGPSOn() which is in the leading edge formware v2.08.167
I wont check in until that firmware is generally available.
One thing I have found is that when I switch to a multiclock face that switches the GPS On; the widget does not repond and display the status until the LCD has powered off, or I change to a different clock face. To get round this I am poking the widget using.
Code of widget below:
1 Attachment