Skip to content

Add RAK12501 L76K GPS support for RAK3401#2927

Open
mathisono wants to merge 115 commits into
meshcore-dev:mainfrom
mathisono:rak3401-rak12501-l76k-gps
Open

Add RAK12501 L76K GPS support for RAK3401#2927
mathisono wants to merge 115 commits into
meshcore-dev:mainfrom
mathisono:rak3401-rak12501-l76k-gps

Conversation

@mathisono

Copy link
Copy Markdown

Summary

Adds RAK12501 / Quectel L76K UART GPS initialization for the RAK3401 1W target.

This keeps the change scoped to the RAK3401 variant by:

  • wrapping the existing MicroNMEALocationProvider in variants/rak3401/target.cpp
  • sending the L76K PCAS init sequence after GPS reset
  • updating the RAK3401 GPS pin macros so MeshCore's existing Serial1.setPins(PIN_GPS_TX, PIN_GPS_RX) call maps to MCU RX/TX correctly
  • avoiding use of WB_IO2 / PIN_3V3_EN as a GPS enable pin, because that rail is shared with the RAK13302 1W PA support rail

GPS init behavior

The RAK12501/L76K wrapper sends:

$PCAS04,7
$PCAS03,1,0,0,0,1,0,0,0,0,0,,,0,0
$PCAS11,3

Quency-D and others added 30 commits January 22, 2026 15:03
This reverts commit ca047fe, reversing
changes made to ddedb3c.
Co-authored-by: Copilot <copilot@github.com>
…on-parse-failure

Fix: CMD_SEND_RAW_PACKET not freeing packet on parse failure
fdlamotte and others added 12 commits July 6, 2026 08:02
…off-to-uA-202607

Fixed hibernate / poweroff for BLE companions and repeaters to stay at uA
fix misspelled RF switch pin macros in SX1268/LLCC68/SX1276 radio wrappers
Previously load() returned true unconditionally on file-open success,
masking truncated or corrupt /regions2 files. Additionally, the first
field of each entry record (r->id) used the same success-chaining
pattern as subsequent fields, so a clean EOF at a record boundary set
success=false and would have been indistinguishable from real
corruption once the return value was fixed.

The r->id read is now split out: n==0 is a clean EOF (break, success
retains its prior value from the header read), n!=sizeof(r->id) is a
partial read or corruption (break, success=false). load() now returns
success instead of an unconditional true, so its return value reflects
the actual parse outcome.

Companion fix to meshcore-dev#2372, which fixed the same return-true hardcoding
in save(). (meshcore-dev#1891 originally reported this on load() but was closed
when meshcore-dev#2372 landed — that PR only touched save(); this addresses the
load() side.)
External watchdog support was added (but never merged) for MeshTower V1. The update's V2's #defines to follow the conventions set there and piggy back off the support already written for V1.
The M6 is the only board whose simple_repeater env ships with MESH_DEBUG=1
and GPS_NMEA_DEBUG=1 enabled. MESH_DEBUG=1 adds a 5-second boot delay
(examples/simple_repeater/main.cpp) plus verbose per-packet serial prints on
the hot RX/TX path; GPS_NMEA_DEBUG=1 echoes every GPS UART character to the
serial console (MicroNMEALocationProvider.h). Every sibling repeater env
(M1, M3, t1000-e, RAK, Heltec) ships these off, and the M6 room_server env
in this same file already has them commented. Comment them out to match.
next_check and next_gps_update stored a future millis() value in a signed
long and compared with a naive '>'. After the ~24.8-day millis() sign flip
the deadline sits above the wrapped millis(), so the block never runs again
and GPS->RTC time-sync (and the location cache refresh) stall permanently
until reboot. Switch to unsigned deadlines with the wrap-safe signed-
difference compare '(long)(millis() - deadline) > 0', matching the idiom in
Dispatcher::millisHasNowPassed.

Also: reorder the MicroNMEALocationProvider ctor init-list to declaration
order (silences -Wreorder) and drop the always-true 'if (_claims > 0)' guard
in claim() (claim() always runs after _claims++, so it is >= 1).
Without ROOM_PASSWORD the guest password defaults to empty, and a client
sending a blank password is granted read+write access (can post). Every
other board's room_server env sets ROOM_PASSWORD; the ThinkNode M6 and M1
were the only two shipping an open room. Default them to "hello" to match
the rest of the tree; operators can still change it at runtime with
'set guest.password'.
@Avamander

Copy link
Copy Markdown

You might also want to enable Glonass and if your board has known time, inject that too for a quicker fix. (In theory you could also provide approximate location as well or entire almanac, but that's harder to ship.)

liamcottle and others added 9 commits July 13, 2026 12:54
…-default-password

ThinkNode M6/M1 room_server: set ROOM_PASSWORD default
…-debug-flags

ThinkNode M6 repeater: disable leftover MESH_DEBUG/GPS_NMEA_DEBUG
…d_watchdog_2

Feed external hardware watchdog on Heltec Tower V2 (aka MeshTower V2) Implementation 2
…c-millis-overflow

sensors: fix millis() rollover that stalls GPS time-sync on long-uptime nodes
@ripplebiz

Copy link
Copy Markdown
Member

Looks good, but need you to change the base branch to 'dev'

@liamcottle

liamcottle commented Jul 13, 2026

Copy link
Copy Markdown
Member

Please make sure to rebase it on the dev branch too, and not just change to dev branch in GitHub UI ;) Otherwise it will pull in all the commits from your main base branch.

…eof-handling

fix(RegionMap): load() returns actual read success instead of hardcoded true
@disq

disq commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Heads up that this overlaps with #2640, which already includes the same PIN_GPS_RX/PIN_GPS_TX swap for the RAK3401 plus the shared-rail power handling (including RAK12501 support).
One thing to note: #2640 routes the RAK3401 through the RAK_WISBLOCK_GPS init path, where reset() is never called, so the PCAS init here would become dead code if both merge. Might be cleanest to land #2640 first and rebase the L76K PCAS config on top, hooked into that path. The config itself would be a nice addition. Happy to help coordinate.

@mathisono mathisono force-pushed the rak3401-rak12501-l76k-gps branch from 9d251c4 to ecbd327 Compare July 14, 2026 07:24
@mathisono

Copy link
Copy Markdown
Author

@liamcottle I rebased my RAK3401/RAK12501 GPS branch onto dev and narrowed it to L76K-specific config work: enabling GPS+BeiDou+GLONASS, reducing NMEA output to RMC+GGA for companion-radio responsiveness, set vehicle mode, and optionally injecting known RTC time with PMTK740 for faster TTFF if its past 2020-01-01.

Thanks for the heads up that this overlaps with #2640 on the RAK3401 pin swap/shared-rail handling, I will yield to let #2640 merge first. @disq after that lands, I’ll rebase my branch on top of the updated dev and move/adjust the L76K PCAS/PMTK config into the RAK_WISBLOCK_GPS serial path introduced there, so the PR becomes a clean follow-up rather than duplicating #2640. I will rebuild and test on my HW and submit a new PR. 73

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.