Skip to content

Commit 31da201

Browse files
committed
Block LBand hardware access unless online and needed
Fix #681. Rename lbandCorrections to pointPerfectKeysApplied.
1 parent 9f9eb13 commit 31da201

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ void GNSS_ZED::applyPointPerfectKeys()
7171
{
7272
if (settings.debugCorrections)
7373
systemPrintln("PointPerfect keys applied");
74-
online.lbandCorrections = true;
74+
75+
online.pointPerfectKeysApplied = true;
7576
}
7677
}
7778
else

Firmware/RTK_Everywhere/menuPP.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const int ppServiceCount = sizeof(ppServices) / sizeof(ppServices[0]);
8686
void menuPointPerfect()
8787
{
8888
uint8_t pointPerfectServiceOnEntry = settings.pointPerfectService;
89-
89+
9090
while (1)
9191
{
9292
systemPrintln();
@@ -290,7 +290,7 @@ void menuPointPerfect()
290290
printUnknown(incoming);
291291
}
292292

293-
if (strlen(settings.pointPerfectClientID) > 0)
293+
if ((strlen(settings.pointPerfectClientID) > 0) && (pointPerfectServiceUsesKeys() == true))
294294
{
295295
gnss->applyPointPerfectKeys();
296296
}
@@ -338,7 +338,8 @@ void menuPointPerfectSelectService()
338338
settings.pointPerfectService = incoming - 1; // Align incoming to array
339339

340340
restartRover = true; // Require a rover restart to enable / disable RTCM for PPL
341-
settings.requestKeyUpdate = settings.pointPerfectService != PP_NICKNAME_DISABLED; // Force a key update - or don't
341+
settings.requestKeyUpdate =
342+
settings.pointPerfectService != PP_NICKNAME_DISABLED; // Force a key update - or don't
342343

343344
break; // Exit menu once selected
344345
}
@@ -627,7 +628,7 @@ void updateLBand()
627628
if (strncmp(previousKey, settings.pointPerfectCurrentKey, 33) != 0)
628629
{
629630
strncpy(previousKey, settings.pointPerfectCurrentKey, 33);
630-
gnss->applyPointPerfectKeys(); // Apply keys now. This sets online.lbandCorrections
631+
gnss->applyPointPerfectKeys(); // Apply keys now.
631632
if (settings.debugCorrections == true)
632633
systemPrintln("ZED-F9P PointPerfect keys applied");
633634
}
@@ -741,7 +742,7 @@ void updateLBandCorrections()
741742
static unsigned long lbandTimeFloatStarted; // Monitors the ZED during L-Band reception if a fix takes too long
742743

743744
#ifdef COMPILE_L_BAND
744-
if (online.lbandCorrections == true)
745+
if ((online.lband_neo == true) && (pointPerfectLbandNeeded() == true) && (online.pointPerfectKeysApplied == true))
745746
{
746747
i2cLBand.checkUblox(); // Check for the arrival of new PMP data and process it.
747748
i2cLBand.checkCallbacks(); // Check if any L-Band callbacks are waiting to be processed.
@@ -1129,7 +1130,7 @@ void pointperfectCreateTokenString(char *tokenBuffer, uint8_t *tokenArray, int t
11291130
for (int x = 0; x < tokenArrayLength; x++)
11301131
{
11311132
char temp[3];
1132-
snprintf(temp, sizeof(temp), "%02x", tokenArray[x]); //Tokens are case sensitive. Must be lower case.
1133+
snprintf(temp, sizeof(temp), "%02x", tokenArray[x]); // Tokens are case sensitive. Must be lower case.
11331134
strcat(tokenBuffer, temp);
11341135
if (x == 3 || x == 5 || x == 7 || x == 9)
11351136
strcat(tokenBuffer, "-");

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void menuSystem()
6565
else
6666
systemPrintln("Offline - ");
6767

68-
if (online.lbandCorrections == true)
68+
if (online.pointPerfectKeysApplied == true)
6969
systemPrint("Keys Good");
7070
else
7171
systemPrint("No Keys");

Firmware/RTK_Everywhere/settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ struct struct_online
18281828
bool i2c = false;
18291829
bool lband_gnss = false;
18301830
bool lband_neo = false;
1831-
bool lbandCorrections = false;
1831+
bool pointPerfectKeysApplied = false;
18321832
bool logging = false;
18331833
bool loraRadio = false;
18341834
bool microSD = false;

0 commit comments

Comments
 (0)