Created
March 4, 2026 13:35
-
-
Save parkerlreed/dcd59655f9db231fa878c1556c2e8e2f to your computer and use it in GitHub Desktop.
Meshtatic firmware patch for AG3335 to keep GPS on and output full messages to USB serial
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
| diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp | |
| index 2beaeb127..ac70a3630 100644 | |
| --- a/src/gps/GPS.cpp | |
| +++ b/src/gps/GPS.cpp | |
| @@ -644,13 +644,14 @@ bool GPS::setup() | |
| // 1 1 1 1 0 0 | |
| } | |
| // Configure NMEA (sentences will output once per fix) | |
| - _serial_gps->write("$PAIR062,0,1*3F\r\n"); // GGA ON | |
| - _serial_gps->write("$PAIR062,1,0*3F\r\n"); // GLL OFF | |
| - _serial_gps->write("$PAIR062,2,0*3C\r\n"); // GSA OFF | |
| - _serial_gps->write("$PAIR062,3,0*3D\r\n"); // GSV OFF | |
| - _serial_gps->write("$PAIR062,4,1*3B\r\n"); // RMC ON | |
| - _serial_gps->write("$PAIR062,5,0*3B\r\n"); // VTG OFF | |
| - _serial_gps->write("$PAIR062,6,0*38\r\n"); // ZDA ON | |
| + // Configure NMEA sentences (all enabled) | |
| + _serial_gps->write("$PAIR062,0,1*3F\r\n"); // GGA | |
| + _serial_gps->write("$PAIR062,1,1*3E\r\n"); // GLL | |
| + _serial_gps->write("$PAIR062,2,1*3D\r\n"); // GSA | |
| + _serial_gps->write("$PAIR062,3,1*3C\r\n"); // GSV | |
| + _serial_gps->write("$PAIR062,4,1*3B\r\n"); // RMC | |
| + _serial_gps->write("$PAIR062,5,1*3A\r\n"); // VTG | |
| + _serial_gps->write("$PAIR062,6,1*39\r\n"); // ZDA | |
| delay(250); | |
| _serial_gps->write("$PAIR513*3D\r\n"); // save configuration | |
| @@ -824,6 +825,9 @@ GPS::~GPS() | |
| // Put the GPS hardware into a specified state | |
| void GPS::setPowerState(GPSPowerState newState, uint32_t sleepTime) | |
| { | |
| + // Prevent GPS from ever sleeping | |
| + if (newState == GPS_SOFTSLEEP || newState == GPS_HARDSLEEP || newState == GPS_OFF) | |
| + return; | |
| // Update the stored GPSPowerstate, and create local copies | |
| GPSPowerState oldState = powerState; | |
| powerState = newState; | |
| @@ -1860,6 +1864,7 @@ bool GPS::whileActive() | |
| #ifdef GPS_DEBUG | |
| debugmsg += vformat("%c", (c >= 32 && c <= 126) ? c : '.'); | |
| #endif | |
| + Serial.write((uint8_t)c); | |
| isValid |= reader.encode(c); | |
| if (charsInBuf > sizeof(UBXscratch) - 10 || c == '\r') { | |
| if (strnstr((char *)UBXscratch, "$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50", charsInBuf)) { |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can remove the prevent sleep and use the position update interval of 8 seconds to keep it on.