mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 02:36:11 +00:00
feat(trail): auto-save GPS trail on shutdown (Trail settings toggle)
Losing the whole route on a low-battery auto-shutdown was the worst solo-mode failure. New NodePrefs::trail_autosave_lowbatt toggle (Tools > Trail > Settings > Auto-save, default OFF): UITask::shutdown() writes the live trail to /trail when the toggle is on and _trail.count() > 0. The count guard stops an empty trail from wiping a previously saved one; it overwrites the same /trail file the manual Trail > Save uses. Schema bumped 0xC0DE001A -> 0xC0DE001B: append-only tail field with a load clamp, so pre-0x1B saves default to off. sizeof(NodePrefs) is unchanged (the byte fits existing padding after keyboard_type), so the tripwire assert stays 2496. Builds green: WioTrackerL1_companion_solo_dual (RAM 69.9%, Flash 62.8%). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -289,6 +289,12 @@ struct NodePrefs { // persisted to file
|
||||
// (phone-keypad groups, cycled with repeated Enter presses — see KeyboardWidget.h).
|
||||
uint8_t keyboard_type;
|
||||
|
||||
// Auto-save the live GPS trail to /trail on shutdown (covers the low-battery
|
||||
// auto-shutdown, which otherwise loses the whole route). Only writes when the
|
||||
// trail has points and the toggle is on. 0 = off (default), 1 = on.
|
||||
// [Tools › Trail › Settings › Auto-save]
|
||||
uint8_t trail_autosave_lowbatt;
|
||||
|
||||
// Single source of truth for the live-share option tables (shared by the Map
|
||||
// UI labels and the auto-send engine in UITask).
|
||||
static const uint8_t LOC_SHARE_MOVE_COUNT = 4;
|
||||
@@ -351,7 +357,7 @@ struct NodePrefs { // persisted to file
|
||||
// adding/removing/reordering fields in DataStore::savePrefs/loadPrefsInt so
|
||||
// older saves are detected on load and skipped (zero-init defaults kept).
|
||||
// High 24 bits identify the file format; low byte is the schema revision.
|
||||
static const uint32_t SCHEMA_SENTINEL = 0xC0DE001A;
|
||||
static const uint32_t SCHEMA_SENTINEL = 0xC0DE001B;
|
||||
|
||||
// Bit-index for each home page. Used by page_order (entries store bit+1) and
|
||||
// by home_pages_mask. Single source of truth — both HomeScreen::pageBit/bitToPage
|
||||
|
||||
Reference in New Issue
Block a user