Skip to content

Commit 4557b39

Browse files
committed
Add setMessageRateOnPort. Requires LG290p firmware v4
For updated firmware see: https://github.com/sparkfun/SparkFun_RTK_Postcard/tree/main/Firmware
1 parent 74825ff commit 4557b39

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

src/SparkFun_LG290P_GNSS.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,30 @@ bool LG290P::setMessageRate(const char *msgName, int rate, int msgVer)
628628
return ret;
629629
}
630630

631+
// Set a message on a given port. Available in v4 and above.
632+
// $PQTMCFGMSGRATE,W,1,2,GGA,1* - <PortType>,<PortID>,<MsgName>,<Rate>[,MsgVersion/Offset]
633+
// Set port type (1 = UART), UART number (2 = UART2), message, rate
634+
bool LG290P::setMessageRateOnPort(const char *msgName, int rate, int portNumber, int msgVer)
635+
{
636+
char parms[50];
637+
snprintf(parms, sizeof parms, msgVer == -1 ? ",W,1,%d,%s,%d" : ",W,1,%d,%s,%d,%d", portNumber, msgName, rate, msgVer);
638+
bool ret = sendOkCommand("PQTMCFGMSGRATE", parms);
639+
640+
// We internally track whether certain important sentences are enabled
641+
if (ret)
642+
{
643+
std::string str = msgName;
644+
if (str == "GGA") devState.ggaRate = rate;
645+
else if (str == "RMC") devState.rmcRate = rate;
646+
else if (str == "PQTMPVT") devState.pvtRate = rate;
647+
else if (str == "PQTMPL") devState.plRate = rate;
648+
else if (str == "PQTMSVINSTATUS") devState.svinstatusRate = rate;
649+
else if (str == "PQTMEPE") devState.epeRate = rate;
650+
else if (str == "GSV") devState.gsvRate = rate;
651+
}
652+
return ret;
653+
}
654+
631655
bool LG290P::getMessageRate(const char *msgName, int &rate, int msgVer)
632656
{
633657
char parms[50];
@@ -1380,7 +1404,7 @@ NmeaPacket NmeaPacket::FromString(const std::string &str)
13801404
size_t start = 0;
13811405
size_t delimiterPos = str.find_first_of(",*");
13821406
unsigned long calculatedChksum = 0;
1383-
log_d("Parsing sentence %s", str.c_str());
1407+
//log_d("Parsing sentence %s", str.c_str());
13841408

13851409
while (true)
13861410
{

src/SparkFun_LG290P_GNSS.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,18 @@ class LG290P
425425
*/
426426
bool setMessageRate(const char *msgName, int rate, int msgver = -1);
427427

428+
/**
429+
* @brief Enables or sets the rate for a specific message on a specific port.
430+
* @details Use 0 to disable the message or N for 1 message every N fixes.
431+
* @details Uses the PQTMCFGMSGRATE command to set message rate.
432+
* @param msgName The name of the message, e.g. "GGA", "RTCM3-1005", "RTCM2-107X".
433+
* @param rate The rate at which to send the message.
434+
* @param portNumber The port on which to send the message (UART 1/2/3).
435+
* @param msgver (Optional) The message version for PQTM messages, default is -1.
436+
* @return true if successful, false otherwise.
437+
*/
438+
bool setMessageRateOnPort(const char *msgName, int rate, int portNumber, int msgver = -1);
439+
428440
/**
429441
* @brief Queries the broadcast rate for the specific message.
430442
* @details Returns rate of 0 to indicated a disabled message or N for 1 message every N fixes.

0 commit comments

Comments
 (0)