mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-05 03:36:13 +00:00
feat(companion): GPS averaging for waypoint marking (Mark avg)
Add a "Mark avg" trail setting (Off/5/10/30 s). When set, Tools › Trail › Mark here samples the GPS fix once a second for the chosen window and stores the mean position instead of one instantaneous fix — a steadier, more accurate mark for a precise spot. A progress screen shows time left + sample count; Cancel aborts; the window then opens the label keyboard as usual. Off (default) keeps marking instant. Sampling runs in WaypointsView::poll() (forwarded from TrailScreen::poll()) so it ticks on the main loop, independent of the slow e-ink render cadence; int64 accumulators avoid overflow over 30 samples. Persisted as NodePrefs::gps_avg_idx (schema 0xC0DE0016): struct field + option table, DataStore rd/write/clamp in lockstep. sizeof unchanged (the uint8_t fits existing tail padding) so the 2488 tripwire still holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
35622b7693
commit
c60a7a7f64
@@ -264,6 +264,12 @@ struct NodePrefs { // persisted to file
|
||||
// discrete arrive/leave alert (locator_mode).
|
||||
uint8_t locator_beeper; // 0=off (default), 1=on
|
||||
|
||||
// GPS averaging for waypoint marking — when set, "Mark here" samples the GPS
|
||||
// fix for this many seconds and stores the mean position, for a more accurate
|
||||
// mark than a single instantaneous fix. 0 = off (instant mark, the default).
|
||||
// Index into gpsAvgSecs(). [Tools › Trail › Settings › Mark avg]
|
||||
uint8_t gps_avg_idx;
|
||||
|
||||
// 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;
|
||||
@@ -295,6 +301,17 @@ struct NodePrefs { // persisted to file
|
||||
return L[m < LOCATOR_MODE_COUNT ? m : 0];
|
||||
}
|
||||
|
||||
// GPS-averaging durations for waypoint marking (seconds). 0 = off (instant).
|
||||
static const uint8_t GPS_AVG_COUNT = 4;
|
||||
static uint16_t gpsAvgSecs(uint8_t idx) {
|
||||
static const uint16_t S[GPS_AVG_COUNT] = { 0, 5, 10, 30 };
|
||||
return S[idx < GPS_AVG_COUNT ? idx : 0];
|
||||
}
|
||||
static const char* gpsAvgLabel(uint8_t idx) {
|
||||
static const char* L[GPS_AVG_COUNT] = { "Off", "5s", "10s", "30s" };
|
||||
return L[idx < GPS_AVG_COUNT ? idx : 0];
|
||||
}
|
||||
|
||||
// Trail auto-pause delays (seconds). 0 = off.
|
||||
static const uint8_t TRAIL_AUTOPAUSE_COUNT = 4;
|
||||
static uint16_t trailAutoPauseSecs(uint8_t idx) {
|
||||
@@ -315,7 +332,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 = 0xC0DE0015;
|
||||
static const uint32_t SCHEMA_SENTINEL = 0xC0DE0016;
|
||||
|
||||
// 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