mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 23:26:38 +00:00
fix(sim): live RTC restore + add sim_test_show_all_home_pages() hook
DataStore::restoreRTCTime() runs on every boot and, if a prior save exists, overwrites RTCClock with that stale timestamp. Correct on real hardware (no other way to know the time before a GPS fix or a phone/CLI sync), but SimRTCClock is already backed by the real host wall clock from construction -- overwriting it with an old IDBFS-persisted save made a returning meshcore-solo-site visitor's on-screen clock drift away from their own real time instead of just showing it. Guarded behind #ifndef SIM_PLATFORM. sim_test_show_all_home_pages() is a new sim-only test hook, same shape as the existing sim_test_* hooks in this file: real hardware ships with a curated 5-page Home carousel (NodePrefs::HP_DEFAULT) so a first-time user isn't handed 13 pages to joystick through, with the rest opt-in via Settings > Home Pages. meshcore-solo-site calls this once after boot to show the whole feature set instead, without touching the real-hardware default. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018iubftDmKNWmkNnhJRz8UH
This commit is contained in:
@@ -862,7 +862,17 @@ void DataStore::restoreRTCTime() {
|
||||
uint32_t t = 0;
|
||||
file.read((uint8_t *)&t, sizeof(t));
|
||||
file.close();
|
||||
#ifndef SIM_PLATFORM
|
||||
// Real hardware has no other way to know the time before a GPS fix or
|
||||
// a phone/CLI sync, so restoring the last-known saved time is the
|
||||
// right call there. The sim's RTCClock (SimRTCClock.h) is already
|
||||
// backed by the real host wall clock (time(NULL)) from the moment it's
|
||||
// constructed -- overwriting that with a stale save from a previous
|
||||
// visit (persisted via IDBFS, see the site's "returning visitor" note)
|
||||
// would make a returning instance's on-screen clock drift away from
|
||||
// the visitor's own real time instead of just showing it.
|
||||
if (t > 1000000000UL) _clock->setCurrentTime(t);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user