Skip to content

feat(gps): turn the GPS on by default on the SenseCAP Solar - #23

Merged
Elektr0Vodka merged 1 commit into
Dutch-MeshCore:dmc-devfrom
efiten:feat/sensecap-solar-gps-default-on
Oct 19, 2026
Merged

Elektr0Vodka merged 1 commit into
Dutch-MeshCore:dmc-devfrom
efiten:feat/sensecap-solar-gps-default-on

Conversation

@efiten

@efiten efiten commented Oct 18, 2026

Copy link
Copy Markdown

The SenseCAP Solar P1-Pro has a GNSS module, but every role ships with the GPS off. Its clock stays wrong until someone runs gps on. This PR turns the GPS on once on that board, also on nodes updated over the air. A later gps off stays in place.

Situation

  • A factory unit on v1.14.1 reported 10:53 - 15/5/2024 UTC on 18 October 2026, with gps reporting off.
  • The defaults are _prefs.gps_enabled = 0 (examples/simple_repeater/MyMesh.cpp:924, and the same in the room server, sensor and companion).
  • The GPS hardware itself works on dmc-dev. With NMEA debug on, the module identifies as IC=AT6558R, SW=URANUS5,V5.3.0.0, and sends NMEA at 9600 baud. Boot logs GPS detected, thanks to the 5 s detection window from GPS: poll up to 5s for cold-start detection instead of a single 1s check meshcore-dev/MeshCore#2838.

My changes in this PR

  • Build flag GPS_DEFAULT_ON, set only in variants/sensecap_solar/platformio.ini. Without it nothing changes.
  • New prefs field gps.dflt_on (gps_default_applied) in src/helpers/CommonCLI.h and examples/companion_radio/NodePrefs.h.
  • src/helpers/GpsDefault.h: applyGpsDefaultOn() sets gps_enabled = 1 and the marker when the marker is 0, and reports whether to save.
    • It runs after the prefs load in CommonCLI::loadPrefs (repeater, room server, sensor) and in the companion MyMesh::begin.
    • Prefs written by older firmware lack the field, so an OTA-updated node gets the GPS on once.
    • After that the marker stays 1, so gps off survives reboots.
  • docs/cli_commands.md: the GPS default documented.
  • AGENTS.md: the touched shared files listed.

Verification

On a SenseCAP Solar P1-Pro over USB:

Step gps reply
Build without this change, gps off off
This build flashed on, active, no fix, 0 sats
gps off, 2 reboots off
gps on, reboot on, active, no fix, 0 sats

Outdoors the same node reached on, active, fix, 6 sats, and clock read 11:40 - 18/10/2026 UTC. That ran on dmc-dev without this change, because the clock sync code is not touched here.

  • pio test -e native: 250/250 passed, 4 of them new in test/test_gps_default. The tests cover the helper, and a prefs JSON load and save round trip on the companion NodePrefs.
  • pio test -e native_kiss_modem errors locally with exit code 0xC0000139 on this change and on clean dmc-dev alike. That is a Windows toolchain DLL error, so CI is the check for that suite.
  • Built locally: SenseCap_Solar_repeater, SenseCap_Solar_room_server, SenseCap_Solar_companion_radio_ble, RAK_4631_repeater (no flag).

Not in this PR

  • The room server, sensor and companion paths are built but not flashed.
  • No OTA update tested, only USB flashing.
  • The 30 minute clock re-sync was not observed.
  • The GNSS_WAKEUP pin (D0) is still not driven. The module sends data without it.
  • A matching PR to meshcore-dev/MeshCore dev comes as a separate step.

🤖 Generated with Claude Code

The SenseCAP Solar P1-Pro carries a GNSS module (AT6558R, L76K-compatible),
but every role ships with gps_enabled = 0. Until someone runs "gps on", the
node never syncs its clock: a factory unit on v1.14.1 reported
15/5/2024 UTC on 18 October 2026.

A new build flag GPS_DEFAULT_ON makes the first boot turn the GPS on. A new
prefs field gps.dflt_on records that this happened. Prefs saved by older
firmware lack the field, so nodes updated over the air get the GPS turned
on once as well. A later "gps off" is kept across reboots, because the
marker stays set. Without the flag nothing changes.

The logic is in src/helpers/GpsDefault.h and runs after the prefs load, in
CommonCLI::loadPrefs (repeater, room server, sensor) and in the companion
MyMesh::begin. Only variants/sensecap_solar sets the flag.

Verified on a SenseCAP Solar P1-Pro over USB:
- old build with "gps off", then this build flashed: gps reports on
- "gps off", 2 reboots: stays off
- "gps on", reboot: on
- outdoors with 6 satellites the clock was set to 18/10/2026 UTC
pio test -e native: 250/250 passed, 4 of them new in test_gps_default.
Built SenseCap_Solar repeater, room server, companion_radio_ble and
RAK_4631_repeater (no flag).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Elektr0Vodka
Elektr0Vodka merged commit ecfb2d4 into Dutch-MeshCore:dmc-dev Oct 19, 2026
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