Thought I would add some comments to help understanding the code.
I also added a couple of console.log() calls to print messages to the IDE.
If you connect to the IDE you should be able to see some messages when the code runs
This will tell you if it was able to extract the time from the GPS chip real time clock circuit.
setInterval(function() {
// this is defines the GPS call back function
Bangle.on("GPS",function cb(g) {
Bangle.setGPSPower(0,"time"); // we got a response so turn off GPS power
Bangle.removeListener("GPS",cb); // unregister the callback function
if (!g.time || (g.time.getFullYear()<2000) ||
(g.time.getFullYear()>2200)) {
// GPS receiver's time not set
console.log("GPS real time clock is not set, use GPS info and get a fix");
} else {
// We have a GPS time. Set time
var t = g.time.getTime()/1000;
setTime(t);
console.log("time set to " + t);
}
}); // this is the end of the GPS callback funtion
Bangle.setGPSPower(1,"time"); // power the GPS on, when GPS responds, callback is called
}, 60*60*1000); // run this once per hour, 3600 seconds in milli-seconds
But I can see that you added this code to your app ages ago.
Really interesting discussion regarding the accuracy of the RTC chip verses the one in the GPS.
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.
Thought I would add some comments to help understanding the code.
I also added a couple of console.log() calls to print messages to the IDE.
If you connect to the IDE you should be able to see some messages when the code runs
This will tell you if it was able to extract the time from the GPS chip real time clock circuit.
But I can see that you added this code to your app ages ago.
Really interesting discussion regarding the accuracy of the RTC chip verses the one in the GPS.