Skip to content

Add search duration check for exceeding 15 minutes#10293

Merged
thebentern merged 6 commits into
masterfrom
jp-bennett-patch-2
Apr 26, 2026
Merged

Add search duration check for exceeding 15 minutes#10293
thebentern merged 6 commits into
masterfrom
jp-bennett-patch-2

Conversation

@jp-bennett

Copy link
Copy Markdown
Collaborator

Added a condition to check if the search duration exceeds 15 minutes, indicating too long of a search.

Received reports that the new 60 minute default was causing battery drain problems. Simple solution is to clamp the search time to 15 minutes.

Added a condition to check if the search duration exceeds 15 minutes, indicating too long of a search.
@github-actions github-actions Bot added the enhancement New feature or request label Apr 25, 2026
@jp-bennett jp-bennett added the bugfix Pull request that fixes bugs label Apr 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a hard upper bound to GPS search dwell time to mitigate battery drain caused by long default search durations.

Changes:

  • Add a 15-minute “searched too long” cutoff in GPSUpdateScheduling::searchedTooLong().

Comment thread src/gps/GPSUpdateScheduling.cpp Outdated
Comment thread src/gps/GPSUpdateScheduling.cpp Outdated
@thebentern

Copy link
Copy Markdown
Contributor

@copilot apply changes based on the comments in this thread

…lapsed, 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>

Copilot AI commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

@copilot apply changes based on the comments in this thread

Applied both changes in b6a5171:

  1. Hard cap is now unconditional: the 15-minute check runs before the UINT32_MAX early-return, so an unlimited broadcast interval can no longer keep GPS searching indefinitely.
  2. Single elapsed call + named constexpr: elapsedSearchMs() is called once into uint32_t elapsed, and the threshold is constexpr uint32_t maxSearchClampMs = 1000UL * 60 * 15.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/gps/GPSUpdateScheduling.cpp Outdated
thebentern and others added 2 commits April 25, 2026 06:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@thebentern

Copy link
Copy Markdown
Contributor

@copilot you did a dumb... the if (maxSearchMs == UINT32_MAX) branch will never be reached now!

Copilot AI commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

@copilot you did a dumb... the if (maxSearchMs == UINT32_MAX) branch will never be reached now!

Fixed in 5026bc5. getConfiguredOrDefaultMs always multiplies by 1000, so it can never produce exactly UINT32_MAX (4,294,967,295 is not divisible by 1000) — the branch was always dead code. Removed it entirely.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread src/gps/GPSUpdateScheduling.cpp
@thebentern thebentern merged commit 4ccdd80 into master Apr 26, 2026
79 of 82 checks passed
@caveman99 caveman99 deleted the jp-bennett-patch-2 branch June 7, 2026 20:56
Evil8it pushed a commit to Evil8it/ME4TACTNK that referenced this pull request Jun 10, 2026
* 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.

* trunk

* 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>

* Update src/gps/GPSUpdateScheduling.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* 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>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants