Compare commits

...

6 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 5026bc5f84 Remove dead UINT32_MAX branch from searchedTooLong
Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/6dad5b56-902e-4d0e-90c1-038a9c2df364

Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
2026-04-25 11:50:18 +00:00
Ben Meadors 30db82ea50 Merge branch 'master' into jp-bennett-patch-2 2026-04-25 06:39:45 -05:00
Ben Meadors 45ccb2ce1f Update src/gps/GPSUpdateScheduling.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-25 06:39:36 -05:00
copilot-swe-agent[bot] b6a5171357 Fix searchedTooLong: move 15-min cap before UINT32_MAX check, cache elapsed, add constexpr
Agent-Logs-Url: https://github.com/meshtastic/firmware/sessions/b7f74430-9e7e-4a6f-8095-6176c1eee972

Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
2026-04-25 11:06:35 +00:00
Jonathan Bennett 5e76f637bb trunk 2026-04-24 19:53:47 -05:00
Jonathan Bennett 85f8179aaf Add search duration check for exceeding 15 minutes
Added a condition to check if the search duration exceeds 15 minutes, indicating too long of a search.
2026-04-24 19:50:48 -05:00
+11 -6
View File
@@ -70,20 +70,25 @@ bool GPSUpdateScheduling::isUpdateDue()
// Have we been searching for a GPS position for too long?
bool GPSUpdateScheduling::searchedTooLong()
{
constexpr uint32_t oneMinuteMs = 60UL * 1000UL;
constexpr uint32_t maxSearchClampMs = 15UL * oneMinuteMs; // Hard cap: 15 minutes is always too long
uint32_t elapsed = elapsedSearchMs();
// Anything over 15 minutes is too long, regardless of the broadcast interval.
// TODO: Make a smarter algorithm that backs off the search dwell time when not getting a lock.
if (elapsed > maxSearchClampMs)
return true;
uint32_t minimumOrConfiguredSecs =
Default::getConfiguredOrMinimumValue(config.position.position_broadcast_secs, default_broadcast_interval_secs);
uint32_t maxSearchMs = Default::getConfiguredOrDefaultMs(minimumOrConfiguredSecs, default_broadcast_interval_secs);
// If broadcast interval set to max, no such thing as "too long"
if (maxSearchMs == UINT32_MAX)
return false;
// If we've been searching longer than our position broadcast interval: that's too long
else if (elapsedSearchMs() > maxSearchMs)
if (elapsed > maxSearchMs)
return true;
// Otherwise, not too long yet!
else
return false;
return false;
}
// Updates the predicted time-to-get-lock, by exponentially smoothing the latest observation