From 30b81b6d51c984d47e2623be7a626144afc29a7e Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Mon, 25 May 2026 10:19:47 +0200 Subject: [PATCH] =?UTF-8?q?feat(ui):=20Trail=20phase=205=20=E2=80=94=20Set?= =?UTF-8?q?tings=20=E2=80=BA=20GPS=20gains=20trail=20interval=20+=20min-de?= =?UTF-8?q?lta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../companion_radio/ui-new/SettingsScreen.h | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/examples/companion_radio/ui-new/SettingsScreen.h b/examples/companion_radio/ui-new/SettingsScreen.h index 77652e13..4498d559 100644 --- a/examples/companion_radio/ui-new/SettingsScreen.h +++ b/examples/companion_radio/ui-new/SettingsScreen.h @@ -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; }