diff --git a/examples/companion_radio/DataStore.cpp b/examples/companion_radio/DataStore.cpp index fa3c65ad..d2d541d9 100644 --- a/examples/companion_radio/DataStore.cpp +++ b/examples/companion_radio/DataStore.cpp @@ -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 } } diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index d3ab73bf..2e9d9d37 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -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