@@ -1574,6 +1574,7 @@ void GNSS_LG290P::menuMessages()
15741574 systemPrintln (" 1) Set NMEA Messages" );
15751575 systemPrintln (" 2) Set Rover RTCM Messages" );
15761576 systemPrintln (" 3) Set Base RTCM Messages" );
1577+ systemPrintln (" 4) Set PQTM Messages" );
15771578
15781579 systemPrintln (" 10) Reset to Defaults" );
15791580
@@ -1587,6 +1588,8 @@ void GNSS_LG290P::menuMessages()
15871588 menuMessagesSubtype (settings.lg290pMessageRatesRTCMRover , " RTCMRover" );
15881589 else if (incoming == 3 )
15891590 menuMessagesSubtype (settings.lg290pMessageRatesRTCMBase , " RTCMBase" );
1591+ else if (incoming == 4 )
1592+ menuMessagesSubtype (settings.lg290pMessageRatesPQTM , " PQTM" );
15901593 else if (incoming == 10 )
15911594 {
15921595 // Reset rates to defaults
@@ -1601,6 +1604,10 @@ void GNSS_LG290P::menuMessages()
16011604 for (int x = 0 ; x < MAX_LG290P_RTCM_MSG; x++)
16021605 settings.lg290pMessageRatesRTCMBase [x] = lgMessagesRTCM[x].msgDefaultRate ;
16031606
1607+ // Reset PQTM rates to defaults
1608+ for (int x = 0 ; x < MAX_LG290P_PQTM_MSG; x++)
1609+ settings.lg290pMessageRatesPQTM [x] = lgMessagesPQTM[x].msgDefaultRate ;
1610+
16041611 systemPrintln (" Reset to Defaults" );
16051612 }
16061613
@@ -1638,7 +1645,7 @@ void GNSS_LG290P::menuMessagesSubtype(int *localMessageRate, const char *message
16381645 {
16391646 endOfBlock = MAX_LG290P_NMEA_MSG;
16401647
1641- for (int x = 0 ; x < MAX_LG290P_NMEA_MSG ; x++)
1648+ for (int x = 0 ; x < endOfBlock ; x++)
16421649 {
16431650 if (lg290pFirmwareVersion <= lgMessagesNMEA[x].firmwareVersionSupported )
16441651 systemPrintf (" %d) Message %s: %d - Requires firmware update\r\n " , x + 1 ,
@@ -1652,7 +1659,7 @@ void GNSS_LG290P::menuMessagesSubtype(int *localMessageRate, const char *message
16521659 {
16531660 endOfBlock = MAX_LG290P_RTCM_MSG;
16541661
1655- for (int x = 0 ; x < MAX_LG290P_RTCM_MSG ; x++)
1662+ for (int x = 0 ; x < endOfBlock ; x++)
16561663 {
16571664 if (lg290pFirmwareVersion <= lgMessagesRTCM[x].firmwareVersionSupported )
16581665 systemPrintf (" %d) Message %s: %d - Requires firmware update\r\n " , x + 1 ,
@@ -1666,16 +1673,30 @@ void GNSS_LG290P::menuMessagesSubtype(int *localMessageRate, const char *message
16661673 {
16671674 endOfBlock = MAX_LG290P_RTCM_MSG;
16681675
1669- for (int x = 0 ; x < MAX_LG290P_RTCM_MSG ; x++)
1676+ for (int x = 0 ; x < endOfBlock ; x++)
16701677 {
16711678 if (lg290pFirmwareVersion <= lgMessagesRTCM[x].firmwareVersionSupported )
1672- systemPrintf (" %d) Message %s: %d - Requires firmware update\r\n " , x + 1 , lgMessagesRTCM[x]. msgTextName ,
1673- settings.lg290pMessageRatesRTCMBase [x]);
1679+ systemPrintf (" %d) Message %s: %d - Requires firmware update\r\n " , x + 1 ,
1680+ lgMessagesRTCM[x]. msgTextName , settings.lg290pMessageRatesRTCMBase [x]);
16741681 else
16751682 systemPrintf (" %d) Message %s: %d\r\n " , x + 1 , lgMessagesRTCM[x].msgTextName ,
16761683 settings.lg290pMessageRatesRTCMBase [x]);
16771684 }
16781685 }
1686+ else if (strcmp (messageType, " PQTM" ) == 0 )
1687+ {
1688+ endOfBlock = MAX_LG290P_PQTM_MSG;
1689+
1690+ for (int x = 0 ; x < endOfBlock; x++)
1691+ {
1692+ if (lg290pFirmwareVersion <= lgMessagesPQTM[x].firmwareVersionSupported )
1693+ systemPrintf (" %d) Message %s: %d - Requires firmware update\r\n " , x + 1 ,
1694+ lgMessagesPQTM[x].msgTextName , settings.lg290pMessageRatesPQTM [x]);
1695+ else
1696+ systemPrintf (" %d) Message %s: %d\r\n " , x + 1 , lgMessagesPQTM[x].msgTextName ,
1697+ settings.lg290pMessageRatesPQTM [x]);
1698+ }
1699+ }
16791700
16801701 systemPrintln (" x) Exit" );
16811702
@@ -1698,6 +1719,11 @@ void GNSS_LG290P::menuMessagesSubtype(int *localMessageRate, const char *message
16981719 sprintf (messageString, " Enter number of fixes required before %s is reported (0 to disable)" ,
16991720 lgMessagesRTCM[incoming].msgTextName );
17001721 }
1722+ else if (strcmp (messageType, " PQTM" ) == 0 )
1723+ {
1724+ sprintf (messageString, " Enter number of fixes required before %s is reported (0 to disable)" ,
1725+ lgMessagesPQTM[incoming].msgTextName );
1726+ }
17011727
17021728 int newSetting = 0 ;
17031729
@@ -1718,6 +1744,11 @@ void GNSS_LG290P::menuMessagesSubtype(int *localMessageRate, const char *message
17181744 if (getNewSetting (messageString, 0 , 1200 , &newSetting) == INPUT_RESPONSE_VALID)
17191745 settings.lg290pMessageRatesRTCMBase [incoming] = newSetting;
17201746 }
1747+ if (strcmp (messageType, " PQTM" ) == 0 )
1748+ {
1749+ if (getNewSetting (messageString, 0 , 1 , &newSetting) == INPUT_RESPONSE_VALID)
1750+ settings.lg290pMessageRatesPQTM [incoming] = newSetting;
1751+ }
17211752 }
17221753 else if (incoming == INPUT_RESPONSE_GETNUMBER_EXIT)
17231754 break ;
@@ -2134,3 +2165,56 @@ void lg290pReset()
21342165{
21352166 digitalWrite (pin_GNSS_Reset, LOW);
21362167}
2168+
2169+ // Given a NMEA or PQTM sentence, determine if it is enabled in settings
2170+ // This is used to signal to the processUart1Message() task to remove messages that are needed
2171+ // by the library to function (ie, PQTMEPE, PQTMPVT, GNGSV) but should not be logged or passed to other consumers
2172+ // If unknown, allow messages through. Filtering and suppression should be selectively added in.
2173+ bool lg290pMessageEnabled (char *nmeaSentence, int sentenceLength)
2174+ {
2175+ // Identify message type: PQTM or NMEA
2176+ char messageType[strlen (" PQTM" ) + 1 ] = {0 };
2177+ strncpy (messageType, &nmeaSentence[1 ],
2178+ 4 ); // Copy four letters, starting in spot 1. Null terminated from array initializer.
2179+
2180+ if (strncmp (messageType, " PQTM" , sizeof (messageType)) == 0 )
2181+ {
2182+ // Identify sentence type
2183+ char sentenceType[strlen (" EPE" ) + 1 ] = {0 };
2184+ strncpy (sentenceType, &nmeaSentence[5 ],
2185+ 3 ); // Copy three letters, starting in spot 5. Null terminated from array initializer.
2186+
2187+ // Find this sentence type in the settings array
2188+ for (int messageNumber = 0 ; messageNumber < MAX_LG290P_PQTM_MSG; messageNumber++)
2189+ {
2190+ if (strncmp (lgMessagesPQTM[messageNumber].msgTextName , sentenceType, sizeof (sentenceType)) == 0 )
2191+ {
2192+ if (settings.lg290pMessageRatesPQTM [messageNumber] > 0 )
2193+ return (true );
2194+ return (false );
2195+ }
2196+ }
2197+ }
2198+
2199+ else // We have to assume $G????
2200+ {
2201+ // Identify sentence type
2202+ char sentenceType[strlen (" GSV" ) + 1 ] = {0 };
2203+ strncpy (sentenceType, &nmeaSentence[3 ],
2204+ 3 ); // Copy three letters, starting in spot 3. Null terminated from array initializer.
2205+
2206+ // Find this sentence type in the settings array
2207+ for (int messageNumber = 0 ; messageNumber < MAX_LG290P_NMEA_MSG; messageNumber++)
2208+ {
2209+ if (strncmp (lgMessagesNMEA[messageNumber].msgTextName , sentenceType, sizeof (sentenceType)) == 0 )
2210+ {
2211+ if (settings.lg290pMessageRatesNMEA [messageNumber] > 0 )
2212+ return (true );
2213+ return (false );
2214+ }
2215+ }
2216+ }
2217+
2218+ // If we can't ID this message, allow it by default. The device configuration should control most message flow.
2219+ return (true );
2220+ }
0 commit comments