feat(ui): Trail phase 5 — Settings › GPS gains trail interval + min-delta

Two new entries in the existing GPS section of SettingsScreen, gated by
the same ENV_INCLUDE_GPS guard. LEFT/RIGHT cycles through the option
table from Trail.h:
- "Trail int" : 30 s / 10 s / 20 s / 1 min / 5 min / 15 min
- "Trail dist": 5 m / 10 m / 25 m / 100 m

Changes are stored to p->trail_interval_idx / trail_min_delta_idx and
take effect on the next sampling tick in UITask::loop (already gated on
those fields), so no separate apply* helper is needed. _dirty triggers
the normal savePrefs on settings exit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-25 10:19:47 +02:00
parent 81766650cc
commit 30b81b6d51

View File

@@ -60,6 +60,8 @@ class SettingsScreen : public UIScreen {
// GPS section
SECTION_GPS,
GPS_INTERVAL,
TRAIL_INTERVAL,
TRAIL_MIN_DELTA,
#endif
// Contacts section
SECTION_CONTACTS, DM_FILTER, ROOM_FILTER,
@@ -422,6 +424,14 @@ class SettingsScreen : public UIScreen {
display.print("GPS upd");
display.setCursor(display.valCol(), y);
display.print(GPS_INTERVAL_LABELS[gpsIntervalIndex()]);
} else if (item == TRAIL_INTERVAL) {
display.print("Trail int");
display.setCursor(display.valCol(), y);
display.print(TrailStore::intervalLabel(p ? p->trail_interval_idx : 0));
} else if (item == TRAIL_MIN_DELTA) {
display.print("Trail dist");
display.setCursor(display.valCol(), y);
display.print(TrailStore::minDeltaLabel(p ? p->trail_min_delta_idx : 0));
#endif
} else if (item == TIMEZONE) {
display.print("TimeZone");
@@ -659,6 +669,22 @@ public:
return true;
}
}
if (_selected == TRAIL_INTERVAL && p && (left || right)) {
int idx = p->trail_interval_idx;
if (idx >= TrailStore::INTERVAL_COUNT) idx = 0;
idx = (idx + (right ? 1 : TrailStore::INTERVAL_COUNT - 1)) % TrailStore::INTERVAL_COUNT;
p->trail_interval_idx = (uint8_t)idx;
_dirty = true;
return true;
}
if (_selected == TRAIL_MIN_DELTA && p && (left || right)) {
int idx = p->trail_min_delta_idx;
if (idx >= TrailStore::MIN_DELTA_COUNT) idx = 0;
idx = (idx + (right ? 1 : TrailStore::MIN_DELTA_COUNT - 1)) % TrailStore::MIN_DELTA_COUNT;
p->trail_min_delta_idx = (uint8_t)idx;
_dirty = true;
return true;
}
#endif
if (_selected == TIMEZONE && p) {
if (right && p->tz_offset_hours < 14) { p->tz_offset_hours++; _dirty = true; return true; }