mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 23:26:38 +00:00
fix(sim): add sim_test_disable_screen_timeout() -- no auto-off in the demo
NodePrefs::auto_off_secs defaults to 15 -- real power-saving behaviour a battery-powered board needs (screen off, optionally locked, 15s after the last input). UITask::autoOffMillis() treats 0 as "never" and skips that whole branch in UITask::loop() entirely, so there's no separate flag to touch. A demo running on a visitor's screen has no battery to save and no reason to go dark while they're reading it. sim_test_disable_screen_timeout() is a new sim-only hook, same shape as the other sim_test_* boot-time hooks: meshcore-solo-site calls it once after boot. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018iubftDmKNWmkNnhJRz8UH
This commit is contained in:
@@ -466,6 +466,22 @@ extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_set_timezone_hours(int hours) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// auto_off_secs (NodePrefs.h) defaults to 15 -- a real device's screen
|
||||
// (and, if auto_lock is also set, the UI itself) turns off/locks 15s
|
||||
// after the last input, real power-saving behaviour a battery-powered
|
||||
// board actually needs. UITask::autoOffMillis() (ui-new/UITask.h) treats
|
||||
// 0 as "never" and skips the whole turnOff()/auto_lock branch in
|
||||
// UITask::loop() entirely -- there's no separate flag to touch. A demo
|
||||
// running on a visitor's screen has no battery to save and no reason to
|
||||
// go dark or lock itself while they're reading it.
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_disable_screen_timeout() {
|
||||
if (!g_sim_ready) return 0;
|
||||
NodePrefs* prefs = the_mesh.getNodePrefs();
|
||||
if (!prefs) return 0;
|
||||
prefs->auto_off_secs = 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
|
||||
|
||||
Reference in New Issue
Block a user