Skip to content

Commit 36c3962

Browse files
committed
Fix GGA handling on LG290P
1 parent 147401e commit 36c3962

File tree

4 files changed

+51
-55
lines changed

4 files changed

+51
-55
lines changed

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,8 @@ void gnssUpdate()
311311

312312
if (gnssConfigureRequested(GNSS_CONFIG_MESSAGE_RATE_RTCM_ROVER))
313313
{
314-
if (gnss->gnssInRoverMode() == false)
315-
{
314+
if (settings.debugGnssConfig == true && gnss->gnssInRoverMode() == false)
316315
systemPrintln("Warning: Change to RTCM Rover rates requested but not in Rover mode.");
317-
}
318316

319317
if (gnss->setMessagesRTCMRover() == true)
320318
{
@@ -326,10 +324,9 @@ void gnssUpdate()
326324

327325
if (gnssConfigureRequested(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE))
328326
{
329-
if (gnss->gnssInBaseFixedMode() == false && gnss->gnssInBaseSurveyInMode() == false)
330-
{
331-
systemPrintln("Warning: Change to RTCM Base rates requested but not in Base mode.");
332-
}
327+
if (settings.debugGnssConfig == true)
328+
if (gnss->gnssInBaseFixedMode() == false && gnss->gnssInBaseSurveyInMode() == false)
329+
systemPrintln("Warning: Change to RTCM Base rates requested but not in Base mode.");
333330

334331
if (gnss->setMessagesRTCMBase() == true)
335332
{

Firmware/RTK_Everywhere/GNSS_LG290P.ino

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -187,33 +187,11 @@ bool GNSS_LG290P::checkPPPRates()
187187
}
188188

189189
//----------------------------------------
190-
// Setup the GNSS module for any setup (base or rover)
191-
// In general we check if the setting is different than setting stored in NVM before writing it.
190+
// begin() has already established communication. There are no one-time config requirements for the LG290P
192191
//----------------------------------------
193192
bool GNSS_LG290P::configure()
194193
{
195-
for (int x = 0; x < 3; x++)
196-
{
197-
// Wait up to 5 seconds for device to come online
198-
for (int x = 0; x < 5; x++)
199-
{
200-
if (_lg290p->isConnected())
201-
break;
202-
else
203-
systemPrintln("Device still rebooting");
204-
delay(1000); // Wait for device to reboot
205-
}
206-
207-
// If we fail, reset LG290P
208-
systemPrintln("Resetting LG290P to complete configuration");
209-
210-
gnssReset();
211-
delay(500);
212-
gnssBoot();
213-
}
214-
215-
systemPrintln("LG290P failed to configure");
216-
return (false);
194+
return (true);
217195
}
218196

219197
//----------------------------------------
@@ -226,29 +204,19 @@ bool GNSS_LG290P::configureBase()
226204
if (settings.fixedBase == false && gnssInBaseSurveyInMode())
227205
{
228206
if (settings.debugGnssConfig)
229-
systemPrintln("Skipping - LG290P is already in Fixed Base configuration");
207+
systemPrintln("Skipping - LG290P is already in Survey-In Base configuration");
230208
return (true); // No changes needed
231209
}
232210

233211
if (settings.fixedBase == true && gnssInBaseFixedMode())
234212
{
235213
if (settings.debugGnssConfig)
236-
systemPrintln("Skipping - LG290P is already in Survey-in Base configuration");
214+
systemPrintln("Skipping - LG290P is already in Fixed Base configuration");
237215
return (true); // No changes needed
238216
}
239217

240218
// Assume we are changing from Rover to Base, request any additional config changes
241219

242-
// If the device is set to Survey-In, we must allow the device to be configured.
243-
// Otherwise PQTMEPE (estimated position error) is never populated, so the survey
244-
// never starts (Waiting for Horz Accuracy < 2.00m...)
245-
// if (currentMode == 2 && settings.fixedBase == false) // Not a fixed base = Survey-in
246-
// {
247-
// if (settings.debugGnssConfig)
248-
// systemPrintln("Skipping LG290P Survey In Base configuration");
249-
// return true;
250-
// }
251-
252220
// "When set to Base Station mode, the receiver will automatically disable NMEA message output and enable RTCM MSM4
253221
// and RTCM3-1005 message output."
254222
// "Note: After switching the module's working mode, save the configuration and then reset the module. Otherwise, it
@@ -286,11 +254,14 @@ bool GNSS_LG290P::configureBase()
286254

287255
reset();
288256

289-
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE);
290-
291257
// When a device is changed from Rover to Base, NMEA messages are disabled. Turn them back on.
292258
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_NMEA);
293259

260+
// In Survey-In mode, configuring the RTCM Base will trigger a print warning because the survey-in
261+
// takes a few seconds to start during which gnssInBaseSurveyInMode() incorrectly reports false.
262+
// The print warning should be ignored.
263+
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE);
264+
294265
if (settings.debugGnssConfig && response)
295266
systemPrintln("LG290P Base configured");
296267
}
@@ -306,7 +277,7 @@ bool GNSS_LG290P::configureRover()
306277
if (gnssInRoverMode()) // 0 - Unknown, 1 - Rover, 2 - Base
307278
{
308279
if (settings.debugGnssConfig)
309-
systemPrintln("Skipping LG290P Rover configuration");
280+
systemPrintln("Skipping Rover configuration");
310281
return (true); // No changes needed
311282
}
312283

@@ -317,7 +288,6 @@ bool GNSS_LG290P::configureRover()
317288

318289
gnssConfigure(GNSS_CONFIG_FIX_RATE);
319290
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_ROVER);
320-
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_NMEA);
321291
gnssConfigure(GNSS_CONFIG_RESET); // Mode change requires reset
322292

323293
return (response);
@@ -349,9 +319,22 @@ void GNSS_LG290P::createMessageListBase(String &returnText)
349319
//----------------------------------------
350320
uint8_t GNSS_LG290P::getSurveyInMode()
351321
{
322+
// Note: _lg290p->getSurveyMode() returns 0 while a survey-in is *running*
323+
// so we check PQTMSVINSTATUS to see if a survey is in progress.
324+
352325
if (online.gnss)
353-
return (_lg290p->getSurveyMode());
354-
return (false);
326+
{
327+
if (_lg290p->getSurveyMode() == 2)
328+
return (2); // We know we are fixed
329+
else
330+
{
331+
// Determine if a survey is running
332+
int surveyStatus = _lg290p->getSurveyInStatus(); // 0 = Invalid, 1 = In-progress, 2 = Valid
333+
if (surveyStatus == 1 || surveyStatus == 2)
334+
return (1); // We're in survey mode
335+
}
336+
}
337+
return (0);
355338
}
356339

357340
//----------------------------------------
@@ -1939,10 +1922,16 @@ bool GNSS_LG290P::setMessagesNMEA()
19391922
if (pointPerfectServiceUsesKeys() ||
19401923
(settings.enableNtripClient == true && settings.ntripClient_TransmitGGA == true))
19411924
{
1925+
if (settings.debugGnssConfig)
1926+
systemPrintln("Enabling GGA for NTRIP and PointPerfect");
1927+
19421928
// If firmware is 4 or higher, use setMessageRateOnPort, otherwise setMessageRate
19431929
if (lg290pFirmwareVersion >= 4)
1944-
// Enable GGA. On Torch, LG290P connected to ESP32 on UART 2.
1930+
{
1931+
// Enable GGA on a specific port
1932+
// On Torch X2 and Postcard, the LG290P UART 2 is connected to ESP32.
19451933
response &= _lg290p->setMessageRateOnPort("GGA", 1, 2);
1934+
}
19461935
else
19471936
// Enable GGA on all UARTs. It's the best we can do.
19481937
response &= _lg290p->setMessageRate("GGA", 1);
@@ -2384,6 +2373,9 @@ bool GNSS_LG290P::surveyInReset()
23842373
//----------------------------------------
23852374
bool GNSS_LG290P::surveyInStart()
23862375
{
2376+
_autoBaseStartTimer = millis(); // Stamp when averaging began
2377+
2378+
// We may have already started a survey-in from GNSS's previous NVM settings
23872379
if (gnssInBaseSurveyInMode())
23882380
return (true); // No changes needed
23892381

@@ -2398,8 +2390,6 @@ bool GNSS_LG290P::surveyInStart()
23982390
return (false);
23992391
}
24002392

2401-
_autoBaseStartTimer = millis(); // Stamp when averaging began
2402-
24032393
return (response);
24042394
}
24052395

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ bool GNSS_ZED::configureRover()
627627
if (gnssInRoverMode())
628628
{
629629
if (settings.debugGnssConfig)
630-
systemPrintln("Skipping F9P Rover configuration");
630+
systemPrintln("Skipping Rover configuration");
631631
return (true); // No changes needed
632632
}
633633

Firmware/RTK_Everywhere/Tasks.ino

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,17 @@ void processUart1Message(SEMP_PARSE_STATE *parse, uint16_t type)
865865
// Suppress PQTM/NMEA messages as needed
866866
if (lg290pMessageEnabled((char *)parse->buffer, parse->length) == false)
867867
{
868-
parse->buffer[0] = 0;
869-
parse->length = 0;
868+
if (settings.enableNtripClient == true && settings.ntripClient_TransmitGGA == true)
869+
{
870+
// GGA is disabled, but the user has enabled the NTRIP Client.
871+
// Allow GGA to get through, unmodified.
872+
}
873+
else
874+
{
875+
// Remove the contents of this message
876+
parse->buffer[0] = 0;
877+
parse->length = 0;
878+
}
870879
}
871880
}
872881
}

0 commit comments

Comments
 (0)