Skip to content

Allow 'gps advert' location policy in builds without GPS support 🤖🤖 - #3800

Closed
blaabjerg wants to merge 1 commit into
meshcore-dev:devfrom
blaabjerg:fix/advert-loc-no-gps
Closed

blaabjerg wants to merge 1 commit into
meshcore-dev:devfrom
blaabjerg:fix/advert-loc-no-gps

Conversation

@blaabjerg

Copy link
Copy Markdown

Fixes #3642 (also reported in #3647).

Problem

Builds without ENV_INCLUDE_GPS (Xiao nRF52/S3/C3, ProMicro, ikoka, some RAK4631 and LilyGo T-LoRa builds, …) compile out every gps … CLI command, including gps advert, the only command that can read or change advert_loc_policy. If the stored policy is none, the node never advertises the position set with set lat/set lon, and nothing can be done about it from the CLI.

This was confirmed on a Xiao nRF52840 + Wio-SX1262 repeater running v1.18.0: lat/lon were set and readable with get lat/lon, but adverts carried no location. With this patch, gps advert reported > none, and after gps advert prefs the location appeared in adverts.

Changes

  • gps advert / gps advert none|prefs is now available in all builds. gps advert share replies Error, no GPS support when GPS isn't compiled in. The other GPS commands are unchanged and still gated.
  • buildAdvertData() only honours ADVERT_LOC_SHARE when GPS is compiled in, so a stale share in a no-GPS build falls back to the configured lat/lon instead of advertising 0,0. This is the "just guard the SHARE branch" shape suggested in the review of Honour advert location policy in builds without GPS #3391, which this supersedes. As f3sty noted there, Honour advert location policy in builds without GPS #3391 alone can't help a node stuck at none.
  • Docs: the policy command moves out of the "When GPS support is compiled in" section of cli_commands.md.

The default (prefs for repeater/room server/sensor) and privacy behaviour are unchanged: setting lat/lon still doesn't turn location sharing on by itself.

Testing

  • pio run passes for Xiao_nrf52_repeater, Xiao_nrf52_room_server, RAK_4631_repeater (no GPS) and Heltec_v3_repeater (GPS).
  • pio test -e native: 64/64 pass.
  • On hardware (Xiao nRF52840 repeater, patch applied on top of repeater-v1.18.0): gps advert → > none; gps advert prefs; the location is then present in adverts.

🤖 Generated with Claude Code

Builds compiled without ENV_INCLUDE_GPS (e.g. Xiao_nrf52) compiled out
the 'gps advert' command, the only way to view or change the advert
location policy. A node whose stored policy was 'none' (or 'share')
could therefore never advertise the lat/lon set via 'set lat'/'set lon'.

- 'gps advert [none|prefs]' is now available in all builds; 'share'
  is rejected without GPS support.
- buildAdvertData() only honours ADVERT_LOC_SHARE when GPS is compiled
  in, so a stale 'share' falls back to the configured lat/lon instead
  of advertising 0,0 (supersedes meshcore-dev#3391).
- Docs: move the policy command out of the GPS-only section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fdlamotte

Copy link
Copy Markdown
Collaborator

Thanks for pointing the issue, it's necessary to fix that

But I think the problem is not with the gps command not being accessible when there is no gps. The problem is that this should not be a gps command ;)

So I've introduced get/set advert.loc in #3815 and I'll close this PR

@fdlamotte fdlamotte closed this Nov 11, 2026
@blaabjerg

Copy link
Copy Markdown
Author

Thanks for pointing the issue, it's necessary to fix that

But I think the problem is not with the gps command not being accessible when there is no gps. The problem is that this should not be a gps command ;)

So I've introduced get/set advert.loc in #3815 and I'll close this PR

Fully agreed, that makes more sense. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants