t5s3 standalone clock sync over serial

This commit is contained in:
pelgraine
2026-03-13 21:39:48 +11:00
parent 120c0a739b
commit a6f0052b89
6 changed files with 233 additions and 3 deletions

View File

@@ -56,6 +56,14 @@ void BaseChatMesh::sendAckTo(const ContactInfo& dest, uint32_t ack_hash) {
}
void BaseChatMesh::bootstrapRTCfromContacts() {
// If the RTC already has a sane time (e.g. hardware RTC like PCF8563, or
// GPS-synced), don't overwrite it with a potentially stale contact lastmod.
// This bootstrap is only useful for boards with no hardware RTC at all.
uint32_t current = getRTCClock()->getCurrentTime();
if (current > 1704067200UL) { // Jan 1 2024 — matches EPOCH_MIN_SANE
return;
}
uint32_t latest = 0;
for (int i = 0; i < num_contacts; i++) {
if (contacts[i].lastmod > latest) {