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:
Jakub
2026-09-03 22:17:08 +02:00
co-authored by Claude Sonnet 5
parent 3e7e9e349a
commit 718dbdbe74
2 changed files with 26 additions and 0 deletions
+16
View File
@@ -409,6 +409,22 @@ extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_get_num_contacts() {
return the_mesh.getNumContacts();
}
// Real hardware ships with NodePrefs::HP_DEFAULT -- a curated 5-page Home
// carousel (Clock/Tools/Shutdown/Favourites/Map) -- so a first-time user
// isn't handed 13 pages to joystick through; the rest (Recent/Radio/
// Bluetooth/Advert/GPS/Sensors) are opt-in via Settings > Home Pages. The
// demo site exists specifically to show off the whole feature set, so it
// calls this once right after boot to opt every instance into all of them
// instead -- 0 means "all visible" (see the home_pages_mask comment in
// NodePrefs.h), same as an as-yet-unset field on a factory-fresh device.
extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_show_all_home_pages() {
if (!g_sim_ready) return 0;
NodePrefs* prefs = the_mesh.getNodePrefs();
if (!prefs) return 0;
prefs->home_pages_mask = 0;
return 1;
}
#ifdef DISPLAY_CLASS
// Jumps the on-device UI straight to the DM thread with the first known
// ADV_TYPE_CHAT contact (UITask::openContactDM() -- the exact same real