GPS: poll up to 5s for cold-start detection instead of a single 1s check#2838
Open
benskigomez wants to merge 1 commit into
Open
GPS: poll up to 5s for cold-start detection instead of a single 1s check#2838benskigomez wants to merge 1 commit into
benskigomez wants to merge 1 commit into
Conversation
ViezeVingertjes
suggested changes
Jun 26, 2026
ViezeVingertjes
left a comment
Contributor
There was a problem hiding this comment.
PR targets main instead of dev, approve when fixed. 👍🏼
initBasicGPS() waited a fixed 1 second and then decided the GPS was present only if NMEA data had already arrived. Cold-start GPS modules often need 2-5 seconds before they emit their first sentence, so on a cold boot detection frequently failed. A failed detection sets gps_detected = false, which hides all GPS CLI settings and disables GPS time sync until the next reboot - so the GPS appears permanently dead even though the hardware is fine. Poll for up to ~5 seconds (in 250ms steps) and return as soon as any data appears. Fast modules are detected almost immediately and add no boot delay; slow cold-start modules now get enough time. The ENV_SKIP_GPS_DETECT bypass is unchanged. Fixes meshcore-dev#2258.
c826756 to
27feb73
Compare
ViezeVingertjes
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
EnvironmentSensorManager::initBasicGPS()waits a fixed 1 second, then decides the GPS is present only if NMEA data has already arrived. Cold-start GPS modules often need 2–5 seconds before emitting their first sentence, so on a cold boot detection frequently fails.A failed detection sets
gps_detected = false, which hides all GPS CLI settings and disables GPS time sync until the next reboot — so the GPS appears permanently dead even though the hardware is fine. This affects the ~20 GPS-equipped variants that don't set theENV_SKIP_GPS_DETECT/PERSISTANT_GPSbypass flags.Fix
Poll for up to ~5 seconds (in 250 ms steps) and return as soon as any data appears. Fast modules are detected almost immediately and add no boot delay; slow cold-start modules now get enough time. The
ENV_SKIP_GPS_DETECTbypass is unchanged.Trade-off
Boards that have
ENV_INCLUDE_GPSbut no physical GPS will now wait the full ~5 s at boot (vs. 1 s before), since detection never succeeds. This seemed the right call given the alternative is GPS silently not working, but happy to shorten the cap if preferred.Testing
Builds clean (verified on a ThinkNode M6 companion build). The change is a drop-in replacement for the single check.
Fixes #2258.