mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
feat(prefs): v2.0 settings file -- the struct as it is, behind a CRC
/prefs holds a header (magic, format version, size, CRC-32), the node's position and NodePrefs as it is in memory, in place of /new_prefs' two hand-kept field lists and 0xC0DE00xx schema bumps. A new field goes at the end of the struct; moving one bumps PREFS_VERSION. sanitize() keeps every value in range. The first boot after an update from before 2.0 imports only the first block of the old file, laid out the same in upstream MeshCore and Solo (name, position, radio, BLE PIN, scope), then deletes it; everything else starts from the defaults. Contacts, channels, scopes, waypoints and trails are untouched. Gone: the page-order and GPS-interval migrations, the unused trail_interval_idx / trail_units_idx / repeat_extra_scopes; fav_sort_off and msg_wake_screen_off become fav_sort and msg_wake (on by default). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -512,9 +512,8 @@ extern "C" EMSCRIPTEN_KEEPALIVE void sim_radio_get_params(float* out_freq, float
|
||||
// A brand-new device's home_pages_mask defaults to 0 = all pages visible
|
||||
// (see NodePrefs.h and MyMesh.cpp) -- this is now a no-op on a freshly
|
||||
// booted sim instance, but is kept for a saved-prefs instance whose mask
|
||||
// was narrowed by an actual Settings > Home Pages visit (an upgrader whose
|
||||
// IDBFS identity predates this default, or a visitor who toggled some
|
||||
// pages off before this hook runs on a later boot).
|
||||
// was narrowed by an actual Settings > Home Pages visit (a visitor who
|
||||
// toggled some pages off before this hook runs on a later boot).
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_show_all_home_pages() {
|
||||
if (!g_sim_ready) return 0;
|
||||
NodePrefs* prefs = the_mesh.getNodePrefs();
|
||||
@@ -581,7 +580,7 @@ extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_disable_screen_timeout() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Sets NodePrefs::msg_wake_screen_off directly (the same field Settings >
|
||||
// Sets NodePrefs::msg_wake directly (the same field Settings >
|
||||
// Display > "Msg wake" toggles -- SettingsScreen.h's MSG_WAKE item), so a test
|
||||
// harness can verify UITask::newMsg()'s wake-gating without scripting the
|
||||
// on-device Settings accordion navigation key-by-key.
|
||||
@@ -589,7 +588,7 @@ extern "C" EMSCRIPTEN_KEEPALIVE int sim_test_set_msg_wake_disabled(int disabled)
|
||||
if (!g_sim_ready) return 0;
|
||||
NodePrefs* prefs = the_mesh.getNodePrefs();
|
||||
if (!prefs) return 0;
|
||||
prefs->msg_wake_screen_off = disabled ? 1 : 0;
|
||||
prefs->msg_wake = disabled ? 0 : 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user