I'm not sure a global power option is a good idea - surely if a watch face needs GPS it should just call Bangle.setGPSPower(1) to turn it on? There's no problem calling Bangle.setGPSPower(1) twice.
For now, if you need to check for GPS, how about something like:
var hasGPSData = false;
Bangle.on('GPS',fix => {
hasGPSData = true;
// ...
});
setTimeout(function() {
// if no GPS data in 2 seconds, turn it on
if (!hasGPSData) Bangle.setGPSPower(1);
}, 2000);
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'm not sure a global power option is a good idea - surely if a watch face needs GPS it should just call
Bangle.setGPSPower(1)
to turn it on? There's no problem callingBangle.setGPSPower(1)
twice.For now, if you need to check for GPS, how about something like: