-
• #2
Great! Yes, I'd say that looks good.
I guess what might be happening is the widget gets
Bangle.on('lcdPower'
called before the multiclock face is called, so it's not turned on then. You could add a little delay to it?Bangle.on('lcdPower', function(on) { if (on) { setTimeout(function() { WIDGETS.gps.draw(); }, 100); // <-- here if (!timerInterval) timerInterval = setInterval(()=>WIDGETS["gps"].draw(), 2000); } else { if (timerInterval) { clearInterval(timerInterval); timerInterval = undefined; } } });
or you could just overwrite the function when the widget is loaded so you respond immediately:
Bangle._setGPSPower = Bangle.setGPSPower; Bangle.setGPSPower = function(on,appid) { Bangle._setGPSPower(op,appid); WIDGETS["gps"].draw(); };
-
• #3
Now that I have checked the GPSsetup app in, I am wondering if I should check widgps in OR wait until 2.09 comes out that supports isGPSOn() ?
-
• #4
I'd check widgps in - maybe with a comment in the description and
if (Bangle.isGPSOn) return
check at the top just to ensure it doesn't crash on old firmwares. We can always add theBangle.on('GPS',_=>setGPSisOn)
code to make it work on older firmware
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