meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
3.3k stars 800 forks source link

Occasionally reset the time based on GPS #540

Closed geeksville closed 3 years ago

geeksville commented 3 years ago

Many boards (in particular TBEAMs) don't have a 32khz xtal. Therefore they are just using an RC clock for timekeeping and that drifts pretty fast.

So the time of day clock (not millis() though) should be reset occasionally if !defined(HAS_HIGH_ACCURACY_CLOCK) when we receive GPS time.

geeksville commented 3 years ago

This issue has been mentioned on Meshtastic. There might be relevant details there:

https://meshtastic.discourse.group/t/settime-command-periodically-via-bluetooth/1807/6

mc-hamster commented 3 years ago

The esp32 has internal methods to improve clock accuracy:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html

geeksville commented 3 years ago

Most of this is fixed by #584 (though we should still reset the clock based on GPS occasionally (once a day?)