Repository navigation
fix(color): improve GPS model locator QR code and add URI selection - #7931
Merged
Merged
Conversation
Use the RFC 5870-compliant `geo:lat,lon` format by default instead of the Android-specific `geo:0,0?q=lat,lon`, which is not handled correctly by iOS. Also: - add a selector for different QR URI formats: - RFC 5870 geo URI - Android geo URI - Google Maps web - Google Maps app - CoMaps - Guru Maps - regenerate the QR code when the URI type changes - keep the selected URI type for the current power session - preserve full GPS precision using integer formatting instead of float - remove the stale static TelemetryItem reference - resize and reposition the QR code so it does not overlap the label or controls on smaller color displays Fixes #7787 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MM39zfgRqKrtJBoHrTWhpk
The dropdown labels were a hardcoded English array, with a comment claiming they were all app names and so deliberately untranslated. "Standard" is not an app name, and "(web)"/"(app)" are English qualifiers, so the control was the only untranslated text on an otherwise fully translated page. Move the list to a STR_GPS_URI_TYPES array, following the same STRARRAY pattern as the other Choice value lists. Only the generic entry is exposed to translators; the app names stay as literals in the aggregate macro, the way TR_CYC_VSRCRAW already does, so no translator is invited to render a product name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The web and iOS-app entries existed because neither worked everywhere: "comgooglemaps://" is an iOS-only scheme with no Android handler, and the bare maps.google.com link always opened a browser. The entry was labelled "Google Maps (app)", which reads as platform-neutral, so an Android user would reasonably pick it and get a QR their phone cannot open. The Maps URLs API covers both. "?api=1&query=lat,lon" drops a pin, and opens the Google Maps app on iOS and Android when it is installed, falling back to a browser when it is not, so one entry replaces two and no label has to name a platform. The URI grows to 73 bytes at the coordinate extremes, so gps_uri goes to 96. That is still QR version 5 (37 modules) at ECC MEDIUM, leaving a scale factor of 3 at the smallest QR size the layout produces. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fix this page carries was motivated by iOS, but Apple Maps had no entry of its own. Add one using the unified Maps URL "/place" path, which takes the position in a single "coordinate=lat,lon" parameter and so drops straight into the prefix table. It places a pin without a "&name=", and leaving the name off lets Apple resolve and title the locality itself. The legacy "?ll=lat,lon&q=name" form would work on older releases, but it needs text after the coordinates and a label to go with it. The unified path needs iOS 18.4 or macOS 15.4, which no longer excludes much: the oldest hardware pinned to the iOS 18 line (iPhone XR/XS) runs well past 18.4. Being an https URL it degrades to Apple Maps on the web rather than failing outright, unlike a custom scheme. Apple ships localised names for Maps (Karten, Plans, Mappe, Mapas), so unlike the other app names this entry is exposed to translators, to follow Apple's lead and match what the user sees on their own phone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
abs() returns int, so the compiler only knew the arguments were in [0, INT_MAX] and warned that the two directives could write up to 23 bytes into char[16]. Unsigned division and modulo by literal constants give it provable bounds instead -- at most 4 digits before the point and exactly 6 after -- so the 12-character worst case is visible to it. Behaviour is unchanged: output is identical across the whole +-180 degree range and at the int32 extremes. The integer arithmetic is still there to keep all 6 decimals, which a float cannot hold, and to avoid depending on printf float support. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
pfeerick
force-pushed
the
pfeerick/gps-locator-uri-selection
branch
from
October 22, 2026 04:20
e99db2e to
4daf368
Compare
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.
Summary
The 3.0 counterpart of #7794 by @RobertoD91, which carries the same changes against
2.12.Fixes #7787. The GPS model locator encoded its QR code as
geo:0,0?q=lat,lon, an Android-specific search form that iOS does not handle. The default is now a strictly RFC 5870-compliantgeo:lat,lon, with a selector for alternative map targets.Changes
From #7794:
geo:lat,lon%fstatic TelemetryItem&that bound to the first page's sensor index permanentlyAdded on top:
STR_GPS_URI_TYPESarray following the sameSTRARRAYpattern as otherChoicevalue lists. Two entries are exposed to translators —TR_GPS_URI_STANDARDandTR_GPS_URI_APPLE_MAPS; "Android", "Google Maps", "CoMaps" and "Guru Maps" stay as literals in the aggregate macro intranslation_def.h, asTR_CYC_VSRCRAWalready does, so nobody is invited to localise a product name.comgooglemaps://is the iOS-only scheme and has no Android handler, but the entry was labelled "Google Maps (app)", which reads as platform-neutral — an Android user would reasonably pick it and get a QR their phone cannot open. The Maps URLs API form replaces both entries: it opens the native app on iOS and Android when installed and falls back to the browser.-Wformat-truncationwarning in the coordinate formatter.abs()returnsint, so the compiler only knew the arguments were in[0, INT_MAX]and warned that the two directives could write up to 23 bytes intochar[16]. Unsigned division and modulo by literal constants give it provable bounds instead. Output is identical across the whole ±180° range and at theint32extremes.URI types
geo:lat,longeo:0,0?q=lat,lonhttps://www.google.com/maps/search/?api=1&query=lat,lonhttps://maps.apple.com/place?coordinate=lat,loncm://map?ll=lat,longuru://show?place=lat,lonTesting
Jumper T18H7, ELRS receiver with GPS.
Not device-tested: CoMaps and Guru Maps. Those schemes were checked against vendor documentation only (CoMaps API, Guru Maps API). Confirmation from anyone with those apps installed would be welcome.
Notes for reviewers
geo:lat,londoes, and it is the form that makes the QR work on iOS. A query parameter such as?z=or?q=would add zoom or a pin, but RFC 5870's grammar isgeo-path = coordinates pwithpbeing;-delimited parameters — there is no?query component, so appending one would stop this entry being the standards-compliant option it exists to be. The "Android" entry covers the pin case./placepath, which requires iOS 18.4 / macOS 15.4. The floor excludes less than it sounds: the oldest hardware pinned to the iOS 18 line (iPhone XR/XS) runs well past 18.4. Being an https URL it degrades to Apple Maps on the web rather than failing like a custom scheme would, and "Standard" covers anything older.coordinate=places a pin without a&name=, verified with coordinates far from any saved place. Omitting the name is intentional: it lets Apple resolve and title the locality itself rather than stamping a fixed label on every pin.lv_qrcode_updatenever hits itsscale <= 0bail-out. The URI buffer is sized 96 for a 73-byte worst case.