nrf52: hodiny přežijí warm reset v .noinit (#5)

VolatileRTCClock ukládá čas do g_retained_clock (sekce .noinit, linker
ji dá hned za .bss) a při prvním čtení po warm resetu ho obnoví; po
power-on (RESETREAS 0) ne. Dřívější pokus 7. 8. na vrcholu RAM selhal,
protože tam sahá zásobník bootloaderu — střed RAM přežije: x1 (XIAO,
companion) nastaven +30 dní, reboot, hodiny zpět +30 dní.

BaseChatMesh::bootstrapRTCfromContacts posouvá hodiny už jen dopředu:
bezpodmínečný set vracel čas pod build epoch a rušil obnovu, která
ještě neproběhla (první test proto vyšel negativně).

Repeater: mrtvý mechanismus s pevnou RETAINED_CLOCK_ADDR nahrazen
výpisem stavu obnovy při bootu; ukládání obstarává tick().
Podle weebl2000/meshcore 9a561fd7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-18 22:17:40 +02:00
1 parent 26c0f46ee5
commit 7261865583
5 files changed
+94 -114

No files matched your search

+6 -1
View File
@@ -64,7 +64,12 @@ void BaseChatMesh::bootstrapRTCfromContacts() {
latest = contacts[i].lastmod;
}
}
if (latest != 0) {
// CUSTOM (TeTeHacko): only ever forward. Upstream sets this unconditionally,
// which was harmless while the clock started in 2024; ours starts at the build
// epoch (or a time retained across a warm reset, read by getCurrentTime()
// here), and an old contact would otherwise pull the clock back -- and, on
// nRF52, cancel the retained-clock restore it ran ahead of.
if (latest != 0 && latest + 1 > getRTCClock()->getCurrentTime()) {
getRTCClock()->setCurrentTime(latest + 1);
}
}