-
• #2
Hi,
The microcontroller itself has an RTC built in. While there's no external low-speed oscillator, there is a high speed oscillator and the microcontroller uses that to calibrate the internal low-speed oscillator.
Bluetooth Low Energy demands a certain level of accuracy of the microcontroller, and that tends to be more than good enough for a clock.
But... since there's a GPS receiver, that itself has a very accurate clock in it too, so while Bangle.js doesn't request the time from it (unless it's had a cold reboot and lost the time) it'd be pretty easy to poll it every so often.
... also if you're using Gadgetbridge you can sync the time automatically with that too, but it's really not needed
-
• #3
There is also GPS Time app that can sync time from GPS on request.
-
• #4
Cool, thanks!
-
• #5
On a BTN1+BTN2 reset / boot there is a message 'getting GPS time'. What is happening when this message comes up ?
-
• #6
When you do a hard reset like that, Bangle.js loses the time.
However, if you'd ever had a GPS lock in the past, as long as the battery didn't go flat the GPS receiver has the current time on it.
So when Bangle.js starts it sees the time isn't set, then it asks the GPS receiver if it has the time, and if it does, it uses it.
-
• #7
Really nice feature.
-
• #9
You can use all the methods of the Javascript Date object I believe, but obviously you need to know what the actual time is. Since a Pico does neither have a battery-buffered RTC nor a GPS it has no way to set the time automatically or store it permanently. Bangle only does it as long as the battery is connected.
The only (simple) way is to synchronize the time from a PC that it is connected to, but you would need some software on that PC that does it. The Espruino Web IDE does that I believe, but again, the time would be lost once your Pico is unplugged.
-
• #10
When you upload code via the IDE it should attempt to set the time with
setTime
and timezone withE.setTimeZone()
using your PC's settings (unless it's been disabled in the IDE settings) - you could do the same yourself. Especially when you're uploading code, nothing stops you from stickingE.setTimeZone(4);
to the top of your code to ensure the date functions all use the correct timezone.
So, while waiting for my Bangle to arrive, I am wondering how it actually keeps track of the time.
I don't see an RTC in the specs. Does the micro have sufficiently precise oscillators to keep an accurate time without too much drift? Or does it actually need to get a GPS fix every couple of hours to get its time from space? Or is using a smartwatch to show the time just too crazy an idea? :D