@@ -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// ----------------------------------------
193192bool 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// ----------------------------------------
350320uint8_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// ----------------------------------------
23852374bool 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
0 commit comments