ESP-Now BATMAN Real-time clock

I'm still slowly adding features to my retro computer terminal props and one of the things they lacked was a real-time clock.

So far I've been using 'mesh time' a millisecond uptime value that syncs across the mesh network.

I've now added the option for one or more nodes in the mesh network to share real-time clock information. This leverages the built in libraries for time that are included in the ESP8266/ESP32 SDK. It's just an offset from the mesh uptime with some simple logic to pick a preferred real-time source. Much like the mesh uptime it's not millisecond accurate, but good enough for human scale time, eg. the timestamps on chat messages. It also shares timezone information to correctly handle daylight saving.

At the moment I'm testing with SNTP (which is supported directly in the SDK) but my plan is it can take any RTC source. My code just checks "is the time set?" before sharing time so this should be trivial. this could include manually setting the clock from a watch, but I suspect it would drift fairly quickly. I'll attach some GPS modules onto a couple of my nodes for a time source in the field.

No comments: