Skip to content

GPS: GPS_BAUD_PROBE_LIST as a build flag for any NmeaGpsDriver; enable on Station G2/G3 - #5

Closed
AlexandrTyshchenko wants to merge 1 commit into
fdlamotte:gps_refactorfrom
AlexandrTyshchenko:feature/gps-baud-probe-common
Closed

AlexandrTyshchenko wants to merge 1 commit into
fdlamotte:gps_refactorfrom
AlexandrTyshchenko:feature/gps-baud-probe-common

Conversation

@AlexandrTyshchenko

Copy link
Copy Markdown

Follow-up to #3 (baud autodetect), as discussed with @cwichura in meshcore-dev#3729.

What

  • GPS_BAUD_PROBE_LIST is now handled in NmeaGpsDriver.h instead of variants/promicro/target.cpp. When the flag is set, every NmeaGpsDriver that does not pass its own list gets it as the default, so a variant enables autodetection with only a build flag, no target.cpp change.
  • variants/promicro/target.cpp goes back to plain NmeaGpsDriver gps_driver(Serial1); (same behaviour as before).
  • Station G2 and Station G3: -D GPS_BAUD_PROBE_LIST=9600,115200,38400. Their Grove UART connector is commonly used with M5Stack Unit GPS modules, which default to 115200 and are not seen at the 9600 default.

The explicit NmeaGpsDriver(serial, probeBauds, count) constructor stays for boards that want their own list.

Not done

Autodetection stays opt-in per variant. Turning it on for all boards by default would add up to ~2 s per wrong rate to GPS detection at boot, and nobody can test every board / GPS chip combination. Happy to change if you prefer opt-out.

Testing

  • Builds OK: Station_G3_ESP32_repeater, Station_G2_repeater, ProMicro_repeater, ProMicro_companion_radio_ble. The probe table is linked only where the flag is set (checked with nm).
  • Station_G3_ESP32_companion_radio_ble is over the 1280K app partition, but already on the base commit 544514f5 (1326841 bytes; with this PR 1326849, +8 bytes). Not caused by this change.
  • Hardware: pending, @cwichura will test on Station G3 + M5Stack Unit GPS v1.1.

…e on Station G2/G3

The probe list was wired only in variants/promicro/target.cpp. It is now the
default list of NmeaGpsDriver when GPS_BAUD_PROBE_LIST is set, so a variant
enables baud autodetection with a build flag alone.

Station G2 and G3 enable it: their Grove UART connector is used with M5Stack
Unit GPS modules, which default to 115200.
@cwichura

Copy link
Copy Markdown

This appears to be working on my G3 with M5Stack GPS 1.1 GROVE module. It hasn't gotten a fix, since I am indoors and GPS units typically can't get a fix in my computer room. But the various gps CLI commands all indicate that it has recognized the receiver module.

gps
  -> > off, continuous
gps on
  -> OK
gps
  -> > on, active, no fix, continuous
gps diag
  -> > req:1 en:1 ub:31157 ua:916 ok:756 bad:2 na:916 sat:0 fix:0 fa:never bc:2 sc:2
gps
  -> > on, active, no fix, continuous
gps diag
  -> > req:1 en:1 ub:38557 ua:364 ok:936 bad:2 na:364 sat:0 fix:0 fa:never bc:2 sc:2
gps diag
  -> > req:1 en:1 ub:60017 ua:396 ok:1458 bad:2 na:396 sat:0 fix:0 fa:never bc:2 sc:2

@fdlamotte

Copy link
Copy Markdown
Owner

@AlexandrTyshchenko you should now directly do your PR against dev, as the GPS refactor PR has been merged today !

But looks good, thanks !

@AlexandrTyshchenko

Copy link
Copy Markdown
Author

Thanks @cwichura for testing and @fdlamotte for the review. Reopened against dev as meshcore-dev#3798, closing this one.

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.

3 participants