Skip to content

Commit 147401e

Browse files
committed
Configure ZED when enter/exit Base mode. Enable GGA on UART, not I2C for NTRIP Client.
1 parent ae1d8d6 commit 147401e

File tree

2 files changed

+47
-32
lines changed

2 files changed

+47
-32
lines changed

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -311,35 +311,31 @@ void gnssUpdate()
311311

312312
if (gnssConfigureRequested(GNSS_CONFIG_MESSAGE_RATE_RTCM_ROVER))
313313
{
314-
if (inRoverMode() == false)
314+
if (gnss->gnssInRoverMode() == false)
315315
{
316-
systemPrintln("Error: Change to RTCM Rover rates requested but not in Rover mode. Skipping.");
316+
systemPrintln("Warning: Change to RTCM Rover rates requested but not in Rover mode.");
317317
}
318-
else
318+
319+
if (gnss->setMessagesRTCMRover() == true)
319320
{
320-
if (gnss->setMessagesRTCMRover() == true)
321-
{
322-
gnssConfigureClear(GNSS_CONFIG_MESSAGE_RATE_RTCM_ROVER);
323-
gnssConfigure(GNSS_CONFIG_SAVE); // Request receiver commit this change to NVM
324-
setLoggingType(); // Update Standard, PPP, or custom for icon selection
325-
}
321+
gnssConfigureClear(GNSS_CONFIG_MESSAGE_RATE_RTCM_ROVER);
322+
gnssConfigure(GNSS_CONFIG_SAVE); // Request receiver commit this change to NVM
323+
setLoggingType(); // Update Standard, PPP, or custom for icon selection
326324
}
327325
}
328326

329327
if (gnssConfigureRequested(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE))
330328
{
331-
if (inBaseMode() == false)
329+
if (gnss->gnssInBaseFixedMode() == false && gnss->gnssInBaseSurveyInMode() == false)
332330
{
333-
systemPrintln("Error: Change to RTCM Base rates requested but not in Base mode. Skipping.");
331+
systemPrintln("Warning: Change to RTCM Base rates requested but not in Base mode.");
334332
}
335-
else
333+
334+
if (gnss->setMessagesRTCMBase() == true)
336335
{
337-
if (gnss->setMessagesRTCMBase() == true)
338-
{
339-
gnssConfigureClear(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE);
340-
gnssConfigure(GNSS_CONFIG_SAVE); // Request receiver commit this change to NVM
341-
setLoggingType(); // Update Standard, PPP, or custom for icon selection
342-
}
336+
gnssConfigureClear(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE);
337+
gnssConfigure(GNSS_CONFIG_SAVE); // Request receiver commit this change to NVM
338+
setLoggingType(); // Update Standard, PPP, or custom for icon selection
343339
}
344340
}
345341

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,19 @@ bool GNSS_ZED::configureBase()
516516

517517
// Assume we are changing from Rover to Base, request any additional config changes
518518

519-
gnssConfigure(GNSS_CONFIG_FIX_RATE);
520-
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_NMEA);
521-
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE);
522-
523519
bool response = true;
524520

525521
if (settings.fixedBase == false)
526522
{
527523
// If we are doing a Survey-In (temporary) style Base, change to Rover Mode so our location can settle
524+
// Base config resumes at the end of startSurveyIn()
528525
response &= _zed->setVal8(UBLOX_CFG_TMODE_MODE, 0); // Change to Rover Mode
526+
gnssConfigure(GNSS_CONFIG_FIX_RATE);
527+
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_ROVER);
528+
}
529+
else
530+
{
531+
// If we are doing a Fixed Base, config occurs in fixedBaseStart()
529532
}
530533

531534
if (response == false)
@@ -633,7 +636,6 @@ bool GNSS_ZED::configureRover()
633636
bool response = true;
634637

635638
gnssConfigure(GNSS_CONFIG_FIX_RATE);
636-
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_NMEA);
637639
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_ROVER);
638640

639641
response &= _zed->setVal8(UBLOX_CFG_TMODE_MODE, 0); // Switch to Rover mode
@@ -824,6 +826,10 @@ bool GNSS_ZED::fixedBaseStart()
824826
response &= _zed->sendCfgValset();
825827
}
826828

829+
// Now that the module is set to base mode, complete the base config.
830+
gnssConfigure(GNSS_CONFIG_FIX_RATE);
831+
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE);
832+
827833
return (response);
828834
}
829835

@@ -1210,7 +1216,7 @@ int GNSS_ZED::getSurveyInObservationTime()
12101216
if (online.gnss == false)
12111217
return (0);
12121218

1213-
if(gnssConfigureComplete() == false)
1219+
if (gnssConfigureComplete() == false)
12141220
return (0);
12151221

12161222
// Use a local static so we don't have to request these values multiple times (ZED takes many ms to respond
@@ -2228,18 +2234,18 @@ bool GNSS_ZED::setMessagesNMEA()
22282234
measurementFrequency = 0.2; // 0.2Hz * 5 = 1 measurement every 5 seconds
22292235
if (settings.debugGnssConfig)
22302236
systemPrintf("Adjusting GGA setting to %f\r\n", measurementFrequency);
2231-
_zed->setVal8(UBLOX_CFG_MSGOUT_NMEA_ID_GGA_I2C, measurementFrequency,
2232-
VAL_LAYER_ALL); // Enable GGA over I2C. Tell the module to output GGA every second
2237+
response &= _zed->setVal8(UBLOX_CFG_MSGOUT_NMEA_ID_GGA_UART1, measurementFrequency,
2238+
VAL_LAYER_ALL); // Enable GGA over UART1. Tell the module to output GGA every second
22332239
}
22342240
}
22352241

22362242
// Configure the callback for GGA as needed
22372243
if (settings.enableNtripClient == true && settings.ntripClient_TransmitGGA == true)
2238-
_zed->setNMEAGPGGAcallbackPtr(&zedPushGPGGA);
2244+
response &= _zed->setNMEAGPGGAcallbackPtr(&zedPushGPGGA);
22392245
else
2240-
_zed->setNMEAGPGGAcallbackPtr(nullptr);
2246+
response &= _zed->setNMEAGPGGAcallbackPtr(nullptr);
22412247

2242-
return (success);
2248+
return (response);
22432249
}
22442250

22452251
//----------------------------------------
@@ -2382,8 +2388,13 @@ bool GNSS_ZED::setRate(double secondsBetweenSolutions)
23822388
if (online.gnss == false)
23832389
return (false);
23842390

2385-
if (gnss->gnssInBaseSurveyInMode() || gnss->gnssInBaseFixedMode())
2386-
secondsBetweenSolutions = 1; // In Base mode we force 1Hz
2391+
// In Base mode we force 1Hz, and avoid overwriting the setting
2392+
bool baseOverride = false;
2393+
if (gnssInBaseSurveyInMode() || gnssInBaseFixedMode())
2394+
{
2395+
baseOverride = true;
2396+
secondsBetweenSolutions = 1;
2397+
}
23872398

23882399
// If we have more than an hour between readings, increase mesaurementRate to near max of 65,535
23892400
if (secondsBetweenSolutions > 3600.0)
@@ -2435,7 +2446,8 @@ bool GNSS_ZED::setRate(double secondsBetweenSolutions)
24352446
// If we successfully set rates, only then record to settings
24362447
if (response)
24372448
{
2438-
settings.measurementRateMs = secondsBetweenSolutions * 1000;
2449+
if (baseOverride == false)
2450+
settings.measurementRateMs = secondsBetweenSolutions * 1000;
24392451
}
24402452
else
24412453
{
@@ -2732,6 +2744,13 @@ bool GNSS_ZED::surveyInStart()
27322744
return (false); // Reset of survey failed
27332745
}
27342746

2747+
// The ZED-F9P starts a Survey-in in Rover mode to allow the location fix to settle.
2748+
// Once settle is complete, the survey starts.
2749+
// Here we change the fix rate and enable RTCM messages for base mode.
2750+
// Essentially completing the Base configuration.
2751+
gnssConfigure(GNSS_CONFIG_FIX_RATE);
2752+
gnssConfigure(GNSS_CONFIG_MESSAGE_RATE_RTCM_BASE);
2753+
27352754
return (true);
27362755
}
27372756

0 commit comments

Comments
 (0)