Skip to content

Commit 3af1a84

Browse files
committed
Change gnssConfiguredOnce/Base/Rover to signatures
E.g. on the mosaic, the Rover settings must be reapplied when settings.enablePointPerfectCorrections becomes true... Otherwise the required RTCM messages are never enabled...
1 parent bffb223 commit 3af1a84

File tree

7 files changed

+117
-51
lines changed

7 files changed

+117
-51
lines changed

Firmware/RTK_Everywhere/Display.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,8 +2442,8 @@ void paintProfile(uint8_t profileUnit)
24422442

24432443
if (profileNumber >= 0)
24442444
{
2445-
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
2446-
settings.gnssConfiguredRover = false;
2445+
settings.gnssConfiguredBase = 0; // On the next boot, reapply all settings
2446+
settings.gnssConfiguredRover = 0;
24472447
recordSystemSettings(); // Before switching, we need to record the current settings to LittleFS and SD
24482448

24492449
recordProfileNumber(

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,18 @@ bool GNSS_MOSAIC::checkPPPRates()
389389
// Outputs:
390390
// Returns true if successfully configured and false upon failure
391391
//----------------------------------------
392+
// If any of the settings in the signature have changed, reapply the Base configuration
393+
// See GNSS_MOSAIC_ROVER_SIGNATURE as an example
394+
#define GNSS_MOSAIC_BASE_SIGNATURE \
395+
( \
396+
((settings.minElev & 0x01) << 1) \
397+
| ((settings.enableGnssToUsbSerial & 0x01) << 2) \
398+
| ((settings.enablePointPerfectCorrections & 0x01) << 3) \
399+
| ((settings.ntripClient_TransmitGGA & 0x01) << 4) \
400+
| ((settings.enableLogging & 0x01) << 5) \
401+
| ((settings.enableLoggingRINEX & 0x01) << 6) \
402+
| ((settings.enableExternalHardwareEventLogging & 0x01) << 7) \
403+
)
392404
bool GNSS_MOSAIC::configureBase()
393405
{
394406
/*
@@ -406,7 +418,7 @@ bool GNSS_MOSAIC::configureBase()
406418
return (false);
407419
}
408420

409-
if (settings.gnssConfiguredBase)
421+
if (settings.gnssConfiguredBase == 0x01 | GNSS_MOSAIC_BASE_SIGNATURE)
410422
{
411423
systemPrintln("Skipping mosaic Base configuration");
412424
setLoggingType(); // Needed because logUpdate exits early and never calls setLoggingType
@@ -435,7 +447,10 @@ bool GNSS_MOSAIC::configureBase()
435447
systemPrintln("mosaic-X5 Base failed to configure");
436448
}
437449

438-
settings.gnssConfiguredBase = response;
450+
if (response)
451+
settings.gnssConfiguredBase = 0x01 | GNSS_MOSAIC_BASE_SIGNATURE;
452+
else
453+
settings.gnssConfiguredBase = 0;
439454

440455
return (response);
441456
}
@@ -539,6 +554,12 @@ bool GNSS_MOSAIC::configureLBand(bool enableLBand, uint32_t LBandFreq)
539554
// Outputs:
540555
// Returns true if successfully configured and false upon failure
541556
//----------------------------------------
557+
// If any of the settings in the signature have changed, reapply the configuration
558+
// See GNSS_MOSAIC_ROVER_SIGNATURE as an example
559+
#define GNSS_MOSAIC_ONCE_SIGNATURE \
560+
( \
561+
0 \
562+
)
542563
bool GNSS_MOSAIC::configureOnce()
543564
{
544565
/*
@@ -551,7 +572,7 @@ bool GNSS_MOSAIC::configureOnce()
551572
RTCMv3 messages are enabled by enableRTCMRover / enableRTCMBase
552573
*/
553574

554-
if (settings.gnssConfiguredOnce)
575+
if (settings.gnssConfiguredOnce == 0x01 | GNSS_MOSAIC_ONCE_SIGNATURE)
555576
{
556577
systemPrintln("mosaic configuration maintained");
557578
return (true);
@@ -609,7 +630,10 @@ bool GNSS_MOSAIC::configureOnce()
609630
else
610631
online.gnss = false; // Take it offline
611632

612-
settings.gnssConfiguredOnce = response;
633+
if (response)
634+
settings.gnssConfiguredOnce = 0x01 | GNSS_MOSAIC_ONCE_SIGNATURE;
635+
else
636+
settings.gnssConfiguredOnce = 0;
613637

614638
return (response);
615639
}
@@ -638,6 +662,15 @@ bool GNSS_MOSAIC::configureGNSS()
638662
// Outputs:
639663
// Returns true if successfully configured and false upon failure
640664
//----------------------------------------
665+
// If any of the settings in the signature have changed, reapply the Rover configuration
666+
#define GNSS_MOSAIC_ROVER_SIGNATURE \
667+
( \
668+
((settings.enablePointPerfectCorrections & 0x01) << 1) \
669+
| ((settings.enableGnssToUsbSerial & 0x01) << 2) \
670+
| ((settings.ntripClient_TransmitGGA & 0x01) << 3) \
671+
| ((settings.enableLogging & 0x01) << 4) \
672+
| ((settings.enableExternalHardwareEventLogging & 0x01) << 5) \
673+
)
641674
bool GNSS_MOSAIC::configureRover()
642675
{
643676
/*
@@ -653,7 +686,7 @@ bool GNSS_MOSAIC::configureRover()
653686
}
654687

655688
// If our settings haven't changed, trust GNSS's settings
656-
if (settings.gnssConfiguredRover)
689+
if (settings.gnssConfiguredRover == 0x01 | GNSS_MOSAIC_ROVER_SIGNATURE)
657690
{
658691
systemPrintln("Skipping mosaic Rover configuration");
659692
setLoggingType(); // Needed because logUpdate exits early and never calls setLoggingType
@@ -684,7 +717,10 @@ bool GNSS_MOSAIC::configureRover()
684717
systemPrintln("mosaic-X5 Rover failed to configure");
685718
}
686719

687-
settings.gnssConfiguredRover = response;
720+
if (response)
721+
settings.gnssConfiguredRover = 0x01 | GNSS_MOSAIC_ROVER_SIGNATURE;
722+
else
723+
settings.gnssConfiguredRover = 0;
688724

689725
return (response);
690726
}

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,18 @@ bool GNSS_ZED::checkPPPRates()
322322
//----------------------------------------
323323
// Configure specific aspects of the receiver for base mode
324324
//----------------------------------------
325+
// If any of the settings in the signature have changed, reapply the Base configuration
326+
// See GNSS_MOSAIC_ROVER_SIGNATURE as an example
327+
#define GNSS_ZED_BASE_SIGNATURE \
328+
( \
329+
0 \
330+
)
325331
bool GNSS_ZED::configureBase()
326332
{
327333
if (online.gnss == false)
328334
return (false);
329335

330-
if (settings.gnssConfiguredBase)
336+
if (settings.gnssConfiguredBase == 0x01 | GNSS_ZED_BASE_SIGNATURE)
331337
{
332338
if (settings.debugGnss)
333339
systemPrintln("Skipping ZED Base configuration");
@@ -418,7 +424,10 @@ bool GNSS_ZED::configureBase()
418424

419425
// The configuration should be saved to RAM+BBR+FLASH. No need to saveConfiguration here.
420426

421-
settings.gnssConfiguredBase = success;
427+
if (success)
428+
settings.gnssConfiguredBase = 0x01 | GNSS_ZED_BASE_SIGNATURE;
429+
else
430+
settings.gnssConfiguredBase = 0;
422431

423432
return (success);
424433
}
@@ -517,6 +526,12 @@ bool GNSS_ZED::configureNtpMode()
517526
// In general we check if the setting is incorrect before writing it. Otherwise, the set commands have, on rare
518527
// occasion, become corrupt. The worst is when the I2C port gets turned off or the I2C address gets borked.
519528
//----------------------------------------
529+
// If any of the settings in the signature have changed, reapply the configuration
530+
// See GNSS_MOSAIC_ROVER_SIGNATURE as an example
531+
#define GNSS_ZED_ONCE_SIGNATURE \
532+
( \
533+
0 \
534+
)
520535
bool GNSS_ZED::configureGNSS()
521536
{
522537
if (online.gnss == false)
@@ -578,7 +593,7 @@ bool GNSS_ZED::configureGNSS()
578593
// Configuring the ZED can take more than 2000ms. Configuration is saved to
579594
// ZED RAM+BBR so there is no need to update settings unless user has modified
580595
// the settings file or internal settings.
581-
if (settings.gnssConfiguredOnce)
596+
if (settings.gnssConfiguredOnce == 0x01 | GNSS_ZED_ONCE_SIGNATURE)
582597
{
583598
systemPrintln("ZED-F9x configuration maintained");
584599
return (true);
@@ -755,19 +770,26 @@ bool GNSS_ZED::configureGNSS()
755770

756771
if (success)
757772
{
758-
systemPrintln("ZED-F9x configuration update");
773+
systemPrintln("ZED-F9x configuration updated");
774+
settings.gnssConfiguredOnce = 0x01 | GNSS_ZED_ONCE_SIGNATURE;
759775
}
776+
else
777+
settings.gnssConfiguredOnce = 0;
760778

761779
// The configuration should be saved to RAM+BBR+FLASH. No need to saveConfiguration here.
762780

763-
settings.gnssConfiguredOnce = success;
764-
765781
return (success);
766782
}
767783

768784
//----------------------------------------
769785
// Configure specific aspects of the receiver for rover mode
770786
//----------------------------------------
787+
// If any of the settings in the signature have changed, reapply the Base configuration
788+
// See GNSS_MOSAIC_ROVER_SIGNATURE as an example
789+
#define GNSS_ZED_ROVER_SIGNATURE \
790+
( \
791+
0 \
792+
)
771793
bool GNSS_ZED::configureRover()
772794
{
773795
if (online.gnss == false)
@@ -777,7 +799,7 @@ bool GNSS_ZED::configureRover()
777799
}
778800

779801
// If our settings haven't changed, trust GNSS's settings
780-
if (settings.gnssConfiguredRover)
802+
if (settings.gnssConfiguredRover == 0x01 | GNSS_ZED_ROVER_SIGNATURE)
781803
{
782804
systemPrintln("Skipping ZED Rover configuration");
783805
return (true);
@@ -850,11 +872,14 @@ bool GNSS_ZED::configureRover()
850872

851873
if (!success)
852874
systemPrintln("Rover config fail");
875+
876+
if (success)
877+
settings.gnssConfiguredRover = 0x01 | GNSS_ZED_ROVER_SIGNATURE;
878+
else
879+
settings.gnssConfiguredRover = 0;
853880

854881
// The configuration should be saved to RAM+BBR+FLASH. No need to saveConfiguration here.
855882

856-
settings.gnssConfiguredRover = success;
857-
858883
return (success);
859884
}
860885

Firmware/RTK_Everywhere/NVM.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,29 +1573,29 @@ void loadProfileNumber()
15731573
else
15741574
{
15751575
systemPrintln("profileNumber.txt not found");
1576-
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
1577-
settings.gnssConfiguredBase = false;
1578-
settings.gnssConfiguredRover = false;
1579-
recordProfileNumber(0); // Record profile
1576+
settings.gnssConfiguredOnce = 0; // On the next boot, reapply all settings
1577+
settings.gnssConfiguredBase = 0;
1578+
settings.gnssConfiguredRover = 0;
1579+
recordProfileNumber(0); // Record profile
15801580
}
15811581
}
15821582
else
15831583
{
15841584
systemPrintln("profileNumber.txt not found");
1585-
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
1586-
settings.gnssConfiguredBase = false;
1587-
settings.gnssConfiguredRover = false;
1588-
recordProfileNumber(0); // Record profile
1585+
settings.gnssConfiguredOnce = 0; // On the next boot, reapply all settings
1586+
settings.gnssConfiguredBase = 0;
1587+
settings.gnssConfiguredRover = 0;
1588+
recordProfileNumber(0); // Record profile
15891589
}
15901590

15911591
// We have arbitrary limit of user profiles
15921592
if (profileNumber >= MAX_PROFILE_COUNT)
15931593
{
15941594
systemPrintln("ProfileNumber invalid. Going to zero.");
1595-
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
1596-
settings.gnssConfiguredBase = false;
1597-
settings.gnssConfiguredRover = false;
1598-
recordProfileNumber(0); // Record profile
1595+
settings.gnssConfiguredOnce = 0; // On the next boot, reapply all settings
1596+
settings.gnssConfiguredBase = 0;
1597+
settings.gnssConfiguredRover = 0;
1598+
recordProfileNumber(0); // Record profile
15991599
}
16001600

16011601
systemPrintf("Using profile #%d\r\n", profileNumber);

Firmware/RTK_Everywhere/States.ino

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ void stateUpdate()
102102
displayRoverStart(0);
103103
if (gnss->configureRover() == false)
104104
{
105-
settings.gnssConfiguredRover = false; // On the next boot, reapply all settings
106-
recordSystemSettings(); // Record this state for next POR
105+
settings.gnssConfiguredRover = 0; // On the next boot, reapply all settings
106+
recordSystemSettings(); // Record this state for next POR
107107

108108
systemPrintln("Rover config failed");
109109
displayRoverFail(1000);
@@ -123,8 +123,8 @@ void stateUpdate()
123123
displayRoverFail(1000);
124124
else
125125
{
126-
//settings.gnssConfiguredRover is set true by gnss->configureRover()
127-
settings.gnssConfiguredBase = false; // When the mode changes, reapply all settings
126+
//settings.gnssConfiguredRover is set by gnss->configureRover()
127+
settings.gnssConfiguredBase = 0; // When the mode changes, reapply all settings
128128
settings.lastState = STATE_ROVER_NOT_STARTED;
129129
recordSystemSettings(); // Record this state for next POR
130130

@@ -247,8 +247,8 @@ void stateUpdate()
247247
// Start the UART connected to the GNSS receiver for NMEA and UBX data (enables logging)
248248
if (tasksStartGnssUart() && gnss->configureBase())
249249
{
250-
// settings.gnssConfiguredBase is set true by gnss->configureBase()
251-
settings.gnssConfiguredRover = false; // When the mode changes, reapply all settings
250+
// settings.gnssConfiguredBase is set by gnss->configureBase()
251+
settings.gnssConfiguredRover = 0; // When the mode changes, reapply all settings
252252
settings.lastState = STATE_BASE_NOT_STARTED; // Record this state for next POR
253253
recordSystemSettings(); // Record this state for next POR
254254

@@ -261,8 +261,8 @@ void stateUpdate()
261261
}
262262
else
263263
{
264-
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
265-
recordSystemSettings(); // Record this state for next POR
264+
settings.gnssConfiguredBase = 0; // On the next boot, reapply all settings
265+
recordSystemSettings(); // Record this state for next POR
266266

267267
displayBaseFail(1000);
268268
}
@@ -486,10 +486,10 @@ void stateUpdate()
486486
systemPrintln();
487487

488488
parseIncomingSettings();
489-
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
490-
settings.gnssConfiguredBase = false;
491-
settings.gnssConfiguredRover = false;
492-
recordSystemSettings(); // Record these settings to unit
489+
settings.gnssConfiguredOnce = 0; // On the next boot, reapply all settings
490+
settings.gnssConfiguredBase = 0;
491+
settings.gnssConfiguredRover = 0;
492+
recordSystemSettings(); // Record these settings to unit
493493

494494
// Clear buffer
495495
incomingSettingsSpot = 0;
@@ -609,8 +609,8 @@ void stateUpdate()
609609
if (tasksStartGnssUart() && configureUbloxModuleNTP())
610610
{
611611
settings.lastState = STATE_NTPSERVER_NOT_STARTED; // Record this state for next POR
612-
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
613-
settings.gnssConfiguredRover = false;
612+
settings.gnssConfiguredBase = 0; // On the next boot, reapply all settings
613+
settings.gnssConfiguredRover = 0;
614614
recordSystemSettings();
615615

616616
if (online.ethernetNTPServer)

Firmware/RTK_Everywhere/menuMain.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ void menuUserProfiles()
456456
// Change the active profile number, without unit reset
457457
void changeProfileNumber(byte newProfileNumber)
458458
{
459-
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
460-
settings.gnssConfiguredRover = false;
459+
settings.gnssConfiguredBase = 0; // On the next boot, reapply all settings
460+
settings.gnssConfiguredRover = 0;
461461
recordSystemSettings(); // Before switching, we need to record the current settings to LittleFS and SD
462462

463463
recordProfileNumber(newProfileNumber);

Firmware/RTK_Everywhere/settings.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,14 @@ struct Settings
654654
uint16_t measurementRateMs = 250; // Elapsed ms between GNSS measurements. 25ms to 65535ms. Default 4Hz.
655655
uint16_t navigationRate =
656656
1; // Ratio between number of measurements and navigation solutions. Default 1 for 4Hz (with measurementRate).
657-
bool gnssConfiguredOnce = false; // Flags to indicate how the GNSS is configured (Once, Base, Rover, etc.)
658-
bool gnssConfiguredBase = false;
659-
bool gnssConfiguredRover = false;
657+
658+
// Signatures to indicate how the GNSS is configured (Once, Base, Rover, etc.)
659+
// Bit 0 indicates if the GNSS has been configured previously.
660+
// Bits 1 onwards record the state of critical settings. E.g. settings.enable
661+
// If those critical settings have changed
662+
uint8_t gnssConfiguredOnce = 0;
663+
uint8_t gnssConfiguredBase = 0;
664+
uint8_t gnssConfiguredRover = 0;
660665

661666
// GNSS UART
662667
uint16_t serialGNSSRxFullThreshold = 50; // RX FIFO full interrupt. Max of ~128. See pinUART2Task().
@@ -1249,9 +1254,9 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
12491254
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.enablePrintPosition, "enablePrintPosition", },
12501255
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, _uint16_t, 0, & settings.measurementRateMs, "measurementRateMs", },
12511256
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, _uint16_t, 0, & settings.navigationRate, "navigationRate", },
1252-
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.gnssConfiguredOnce, "gnssConfiguredOnce", },
1253-
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.gnssConfiguredBase, "gnssConfiguredBase", },
1254-
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.gnssConfiguredRover, "gnssConfiguredRover", },
1257+
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _uint8_t, 0, & settings.gnssConfiguredOnce, "gnssConfiguredOnce", },
1258+
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _uint8_t, 0, & settings.gnssConfiguredBase, "gnssConfiguredBase", },
1259+
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _uint8_t, 0, & settings.gnssConfiguredRover, "gnssConfiguredRover", },
12551260

12561261
// Hardware
12571262
{ 1, 1, 0, 1, 1, 1, 0, 1, 0, _bool, 0, & settings.enableExternalHardwareEventLogging, "enableExternalHardwareEventLogging", },

0 commit comments

Comments
 (0)