From 7c25aa1ad4e36b9558e5343dc287abaa26e0f86a Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Thu, 4 Jun 2026 00:16:28 +0200 Subject: [PATCH] refactor(trail): route gpsHasFix through ownPos/currentLocation The last stray getLocationProvider/isValid duplicate (with its own ENV_INCLUDE_GPS guard). Fold it into ownPos so every GPS lookup in the nav screens goes through UITask::currentLocation. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/ui-new/TrailScreen.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/examples/companion_radio/ui-new/TrailScreen.h b/examples/companion_radio/ui-new/TrailScreen.h index bc9bbc36..58c35fdd 100644 --- a/examples/companion_radio/ui-new/TrailScreen.h +++ b/examples/companion_radio/ui-new/TrailScreen.h @@ -218,15 +218,8 @@ public: return false; } - // True when the global SensorManager has a usable GPS fix. - static bool gpsHasFix() { -#if ENV_INCLUDE_GPS == 1 - LocationProvider* loc = sensors.getLocationProvider(); - return loc && loc->isValid(); -#else - return false; -#endif - } + // True when there's a usable GPS fix (same source as ownPos). + bool gpsHasFix() const { int32_t lat, lon; return ownPos(lat, lon); } private: void handleToggle() {