Skip to content

Commit d5edc78

Browse files
committed
Remove signatures. Change gnssConfiguredOnce/Base/Rover back to bool
1 parent f914513 commit d5edc78

File tree

7 files changed

+47
-102
lines changed

7 files changed

+47
-102
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 = 0; // On the next boot, reapply all settings
2446-
settings.gnssConfiguredRover = 0;
2445+
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
2446+
settings.gnssConfiguredRover = false;
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: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,6 @@ 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-
0 \
397-
)
398392
bool GNSS_MOSAIC::configureBase()
399393
{
400394
/*
@@ -412,7 +406,7 @@ bool GNSS_MOSAIC::configureBase()
412406
return (false);
413407
}
414408

415-
if (settings.gnssConfiguredBase == (0x01 | GNSS_MOSAIC_BASE_SIGNATURE))
409+
if (settings.gnssConfiguredBase)
416410
{
417411
systemPrintln("Skipping mosaic Base configuration");
418412
setLoggingType(); // Needed because logUpdate exits early and never calls setLoggingType
@@ -441,10 +435,7 @@ bool GNSS_MOSAIC::configureBase()
441435
systemPrintln("mosaic-X5 Base failed to configure");
442436
}
443437

444-
if (response)
445-
settings.gnssConfiguredBase = 0x01 | GNSS_MOSAIC_BASE_SIGNATURE;
446-
else
447-
settings.gnssConfiguredBase = 0;
438+
settings.gnssConfiguredBase = response;
448439

449440
return (response);
450441
}
@@ -548,12 +539,6 @@ bool GNSS_MOSAIC::configureLBand(bool enableLBand, uint32_t LBandFreq)
548539
// Outputs:
549540
// Returns true if successfully configured and false upon failure
550541
//----------------------------------------
551-
// If any of the settings in the signature have changed, reapply the configuration
552-
// See GNSS_MOSAIC_ROVER_SIGNATURE as an example
553-
#define GNSS_MOSAIC_ONCE_SIGNATURE \
554-
( \
555-
0 \
556-
)
557542
bool GNSS_MOSAIC::configureOnce()
558543
{
559544
/*
@@ -566,7 +551,7 @@ bool GNSS_MOSAIC::configureOnce()
566551
RTCMv3 messages are enabled by enableRTCMRover / enableRTCMBase
567552
*/
568553

569-
if (settings.gnssConfiguredOnce == (0x01 | GNSS_MOSAIC_ONCE_SIGNATURE))
554+
if (settings.gnssConfiguredOnce)
570555
{
571556
systemPrintln("mosaic configuration maintained");
572557
return (true);
@@ -624,10 +609,7 @@ bool GNSS_MOSAIC::configureOnce()
624609
else
625610
online.gnss = false; // Take it offline
626611

627-
if (response)
628-
settings.gnssConfiguredOnce = 0x01 | GNSS_MOSAIC_ONCE_SIGNATURE;
629-
else
630-
settings.gnssConfiguredOnce = 0;
612+
settings.gnssConfiguredOnce = response;
631613

632614
return (response);
633615
}
@@ -656,15 +638,6 @@ bool GNSS_MOSAIC::configureGNSS()
656638
// Outputs:
657639
// Returns true if successfully configured and false upon failure
658640
//----------------------------------------
659-
// If any of the settings in the signature have changed, reapply the Rover configuration
660-
// E.g. ((settings.enablePointPerfectCorrections & 0x01) << 1)
661-
// | ((settings.enableGnssToUsbSerial & 0x01) << 2)
662-
// But most of this is taken care of by restartRover and restartBase
663-
// You should only use the signature to trap any exceptions not covered by restartRover/Base
664-
#define GNSS_MOSAIC_ROVER_SIGNATURE \
665-
( \
666-
0 \
667-
)
668641
bool GNSS_MOSAIC::configureRover()
669642
{
670643
/*
@@ -680,7 +653,7 @@ bool GNSS_MOSAIC::configureRover()
680653
}
681654

682655
// If our settings haven't changed, trust GNSS's settings
683-
if (settings.gnssConfiguredRover == (0x01 | GNSS_MOSAIC_ROVER_SIGNATURE))
656+
if (settings.gnssConfiguredRover)
684657
{
685658
systemPrintln("Skipping mosaic Rover configuration");
686659
setLoggingType(); // Needed because logUpdate exits early and never calls setLoggingType
@@ -711,10 +684,7 @@ bool GNSS_MOSAIC::configureRover()
711684
systemPrintln("mosaic-X5 Rover failed to configure");
712685
}
713686

714-
if (response)
715-
settings.gnssConfiguredRover = 0x01 | GNSS_MOSAIC_ROVER_SIGNATURE;
716-
else
717-
settings.gnssConfiguredRover = 0;
687+
settings.gnssConfiguredRover = response;
718688

719689
return (response);
720690
}
@@ -1754,8 +1724,8 @@ void GNSS_MOSAIC::menuMessagesNMEA()
17541724
printUnknown(incoming);
17551725
}
17561726

1757-
settings.gnssConfiguredBase = 0; // Update the GNSS config at the next boot
1758-
settings.gnssConfiguredRover = 0;
1727+
settings.gnssConfiguredBase = false; // Update the GNSS config at the next boot
1728+
settings.gnssConfiguredRover = false;
17591729

17601730
clearBuffer(); // Empty buffer of any newline chars
17611731
}
@@ -1826,8 +1796,8 @@ void GNSS_MOSAIC::menuMessagesRTCM(bool rover)
18261796
printUnknown(incoming);
18271797
}
18281798

1829-
settings.gnssConfiguredBase = 0; // Update the GNSS config at the next boot
1830-
settings.gnssConfiguredRover = 0;
1799+
settings.gnssConfiguredBase = false; // Update the GNSS config at the next boot
1800+
settings.gnssConfiguredRover = false;
18311801

18321802
clearBuffer(); // Empty buffer of any newline chars
18331803
}

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -322,18 +322,12 @@ 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-
)
331325
bool GNSS_ZED::configureBase()
332326
{
333327
if (online.gnss == false)
334328
return (false);
335329

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

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

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

432423
return (success);
433424
}
@@ -526,12 +517,6 @@ bool GNSS_ZED::configureNtpMode()
526517
// In general we check if the setting is incorrect before writing it. Otherwise, the set commands have, on rare
527518
// occasion, become corrupt. The worst is when the I2C port gets turned off or the I2C address gets borked.
528519
//----------------------------------------
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-
)
535520
bool GNSS_ZED::configureGNSS()
536521
{
537522
if (online.gnss == false)
@@ -593,7 +578,7 @@ bool GNSS_ZED::configureGNSS()
593578
// Configuring the ZED can take more than 2000ms. Configuration is saved to
594579
// ZED RAM+BBR so there is no need to update settings unless user has modified
595580
// the settings file or internal settings.
596-
if (settings.gnssConfiguredOnce == (0x01 | GNSS_ZED_ONCE_SIGNATURE))
581+
if (settings.gnssConfiguredOnce)
597582
{
598583
systemPrintln("ZED-F9x configuration maintained");
599584
return (true);
@@ -771,10 +756,9 @@ bool GNSS_ZED::configureGNSS()
771756
if (success)
772757
{
773758
systemPrintln("ZED-F9x configuration updated");
774-
settings.gnssConfiguredOnce = 0x01 | GNSS_ZED_ONCE_SIGNATURE;
775759
}
776-
else
777-
settings.gnssConfiguredOnce = 0;
760+
761+
settings.gnssConfiguredOnce = success;
778762

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

@@ -784,12 +768,6 @@ bool GNSS_ZED::configureGNSS()
784768
//----------------------------------------
785769
// Configure specific aspects of the receiver for rover mode
786770
//----------------------------------------
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-
)
793771
bool GNSS_ZED::configureRover()
794772
{
795773
if (online.gnss == false)
@@ -799,7 +777,7 @@ bool GNSS_ZED::configureRover()
799777
}
800778

801779
// If our settings haven't changed, trust GNSS's settings
802-
if (settings.gnssConfiguredRover == (0x01 | GNSS_ZED_ROVER_SIGNATURE))
780+
if (settings.gnssConfiguredRover)
803781
{
804782
systemPrintln("Skipping ZED Rover configuration");
805783
return (true);
@@ -873,10 +851,7 @@ bool GNSS_ZED::configureRover()
873851
if (!success)
874852
systemPrintln("Rover config fail");
875853

876-
if (success)
877-
settings.gnssConfiguredRover = 0x01 | GNSS_ZED_ROVER_SIGNATURE;
878-
else
879-
settings.gnssConfiguredRover = 0;
854+
settings.gnssConfiguredRover = success;
880855

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

Firmware/RTK_Everywhere/NVM.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,28 +1573,28 @@ void loadProfileNumber()
15731573
else
15741574
{
15751575
systemPrintln("profileNumber.txt not found");
1576-
settings.gnssConfiguredOnce = 0; // On the next boot, reapply all settings
1577-
settings.gnssConfiguredBase = 0;
1578-
settings.gnssConfiguredRover = 0;
1576+
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
1577+
settings.gnssConfiguredBase = false;
1578+
settings.gnssConfiguredRover = false;
15791579
recordProfileNumber(0); // Record profile
15801580
}
15811581
}
15821582
else
15831583
{
15841584
systemPrintln("profileNumber.txt not found");
1585-
settings.gnssConfiguredOnce = 0; // On the next boot, reapply all settings
1586-
settings.gnssConfiguredBase = 0;
1587-
settings.gnssConfiguredRover = 0;
1585+
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
1586+
settings.gnssConfiguredBase = false;
1587+
settings.gnssConfiguredRover = false;
15881588
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 = 0; // On the next boot, reapply all settings
1596-
settings.gnssConfiguredBase = 0;
1597-
settings.gnssConfiguredRover = 0;
1595+
settings.gnssConfiguredOnce = false; // On the next boot, reapply all settings
1596+
settings.gnssConfiguredBase = false;
1597+
settings.gnssConfiguredRover = false;
15981598
recordProfileNumber(0); // Record profile
15991599
}
16001600

Firmware/RTK_Everywhere/States.ino

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

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

@@ -248,7 +248,7 @@ void stateUpdate()
248248
if (tasksStartGnssUart() && gnss->configureBase())
249249
{
250250
// settings.gnssConfiguredBase is set by gnss->configureBase()
251-
settings.gnssConfiguredRover = 0; // When the mode changes, reapply all settings
251+
settings.gnssConfiguredRover = false; // 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,7 +261,7 @@ void stateUpdate()
261261
}
262262
else
263263
{
264-
settings.gnssConfiguredBase = 0; // On the next boot, reapply all settings
264+
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
265265
recordSystemSettings(); // Record this state for next POR
266266

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

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

494494
// Clear buffer
@@ -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 = 0; // On the next boot, reapply all settings
613-
settings.gnssConfiguredRover = 0;
612+
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
613+
settings.gnssConfiguredRover = false;
614614
recordSystemSettings();
615615

616616
if (online.ethernetNTPServer)

Firmware/RTK_Everywhere/menuMain.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,14 @@ void menuMain()
280280
if (restartBase == true && inBaseMode() == true)
281281
{
282282
restartBase = false;
283-
settings.gnssConfiguredBase = 0; // Reapply configuration
283+
settings.gnssConfiguredBase = false; // Reapply configuration
284284
requestChangeState(STATE_BASE_NOT_STARTED); // Restart base upon exit for latest changes to take effect
285285
}
286286

287287
if (restartRover == true && inRoverMode() == true)
288288
{
289289
restartRover = false;
290-
settings.gnssConfiguredRover = 0; // Reapply configuration
290+
settings.gnssConfiguredRover = false; // Reapply configuration
291291
requestChangeState(STATE_ROVER_NOT_STARTED); // Restart rover upon exit for latest changes to take effect
292292
}
293293

@@ -458,8 +458,8 @@ void menuUserProfiles()
458458
// Change the active profile number, without unit reset
459459
void changeProfileNumber(byte newProfileNumber)
460460
{
461-
settings.gnssConfiguredBase = 0; // On the next boot, reapply all settings
462-
settings.gnssConfiguredRover = 0;
461+
settings.gnssConfiguredBase = false; // On the next boot, reapply all settings
462+
settings.gnssConfiguredRover = false;
463463
recordSystemSettings(); // Before switching, we need to record the current settings to LittleFS and SD
464464

465465
recordProfileNumber(newProfileNumber);

Firmware/RTK_Everywhere/settings.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,9 @@ struct Settings
659659
// Bit 0 indicates if the GNSS has been configured previously.
660660
// Bits 1 onwards record the state of critical settings. E.g. settings.enablePointPerfectCorrections
661661
// Configuration is reapplied if any of those critical settings have changed
662-
uint16_t gnssConfiguredOnce = 0;
663-
uint16_t gnssConfiguredBase = 0;
664-
uint16_t gnssConfiguredRover = 0;
662+
bool gnssConfiguredOnce = false;
663+
bool gnssConfiguredBase = false;
664+
bool gnssConfiguredRover = false;
665665

666666
// GNSS UART
667667
uint16_t serialGNSSRxFullThreshold = 50; // RX FIFO full interrupt. Max of ~128. See pinUART2Task().
@@ -1254,9 +1254,9 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
12541254
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.enablePrintPosition, "enablePrintPosition", },
12551255
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, _uint16_t, 0, & settings.measurementRateMs, "measurementRateMs", },
12561256
{ 0, 1, 0, 1, 1, 1, 1, 1, 1, _uint16_t, 0, & settings.navigationRate, "navigationRate", },
1257-
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _uint16_t, 0, & settings.gnssConfiguredOnce, "gnssConfiguredOnce", },
1258-
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _uint16_t, 0, & settings.gnssConfiguredBase, "gnssConfiguredBase", },
1259-
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _uint16_t, 0, & settings.gnssConfiguredRover, "gnssConfiguredRover", },
1257+
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.gnssConfiguredOnce, "gnssConfiguredOnce", },
1258+
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.gnssConfiguredBase, "gnssConfiguredBase", },
1259+
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, _bool, 0, & settings.gnssConfiguredRover, "gnssConfiguredRover", },
12601260

12611261
// Hardware
12621262
{ 1, 1, 0, 1, 1, 1, 0, 1, 0, _bool, 0, & settings.enableExternalHardwareEventLogging, "enableExternalHardwareEventLogging", },

0 commit comments

Comments
 (0)