Skip to content

Commit e3b786a

Browse files
authored
Merge pull request #683 from sparkfun/pcUpdates_Resolve_#679
Resolve #679:
2 parents be0e2c0 + 3d5896c commit e3b786a

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

Firmware/RTK_Everywhere/menuPP.ino

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,14 @@ const PP_Service ppServices[] = {
7979
// "ZTP-LBand+IP" profile deprecated
8080
};
8181

82-
enum PP_NickName
83-
{
84-
PP_NICKNAME_DISABLED = 0,
85-
PP_NICKNAME_FLEX_RTCM,
86-
PP_NICKNAME_FLEX_LBAND_NA,
87-
PP_NICKNAME_GLOBAL,
88-
PP_NICKNAME_LIVE,
89-
PP_NICKNAME_IP_MQTT,
90-
PP_NICKNAME_MAX,
91-
};
92-
9382
const int ppServiceCount = sizeof(ppServices) / sizeof(ppServices[0]);
9483

9584
// Provision device on ThingStream
9685
// Download keys
9786
void menuPointPerfect()
9887
{
88+
uint8_t pointPerfectServiceOnEntry = settings.pointPerfectService;
89+
9990
while (1)
10091
{
10192
systemPrintln();
@@ -304,6 +295,10 @@ void menuPointPerfect()
304295
gnss->applyPointPerfectKeys();
305296
}
306297

298+
// If, on entry, we needed NTRIP, and now we don't, then disable settings.enableNtripClient
299+
if ((pointPerfectNtripNeeded(pointPerfectServiceOnEntry)) && (!pointPerfectNtripNeeded()))
300+
settings.enableNtripClient = false;
301+
307302
clearBuffer(); // Empty buffer of any newline chars
308303
}
309304

@@ -343,7 +338,7 @@ void menuPointPerfectSelectService()
343338
settings.pointPerfectService = incoming - 1; // Align incoming to array
344339

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

348343
break; // Exit menu once selected
349344
}
@@ -816,7 +811,7 @@ void pointPerfectVerifyTables()
816811

817812
bool pointPerfectIsEnabled()
818813
{
819-
if (settings.pointPerfectService > PP_NICKNAME_DISABLED)
814+
if (settings.pointPerfectService != PP_NICKNAME_DISABLED)
820815
return true;
821816
return false;
822817
}
@@ -849,7 +844,13 @@ bool pointPerfectLbandNeeded()
849844
// Determine if this service type uses NTRIP for corrections
850845
bool pointPerfectNtripNeeded()
851846
{
852-
if (settings.pointPerfectService == PP_NICKNAME_FLEX_RTCM || settings.pointPerfectService == PP_NICKNAME_LIVE)
847+
return pointPerfectNtripNeeded(settings.pointPerfectService);
848+
}
849+
850+
// Determine if this service type uses NTRIP for corrections
851+
bool pointPerfectNtripNeeded(uint8_t pointPerfectService)
852+
{
853+
if (pointPerfectService == PP_NICKNAME_FLEX_RTCM || pointPerfectService == PP_NICKNAME_LIVE)
853854
return true;
854855
return false;
855856
}

Firmware/RTK_Everywhere/settings.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,17 @@ enum
617617
typedef uint8_t NETCONSUMER_t;
618618
typedef uint16_t NETCONSUMER_MASK_t;
619619

620+
enum PP_NickName
621+
{
622+
PP_NICKNAME_DISABLED = 0,
623+
PP_NICKNAME_FLEX_RTCM,
624+
PP_NICKNAME_FLEX_LBAND_NA,
625+
PP_NICKNAME_GLOBAL,
626+
PP_NICKNAME_LIVE,
627+
PP_NICKNAME_IP_MQTT,
628+
PP_NICKNAME_MAX,
629+
};
630+
620631
// This is all the settings that can be set on RTK Product. It's recorded to NVM and the config file.
621632
// Avoid reordering. The order of these variables is mimicked in NVM/record/parse/create/update/get
622633
struct Settings
@@ -865,7 +876,7 @@ struct Settings
865876
"",
866877
"",
867878
};
868-
uint8_t pointPerfectService = 0; // See ppServices[]. Records which PointPerfect service the user has chosen.
879+
uint8_t pointPerfectService = PP_NICKNAME_DISABLED; // See ppServices[]. Records which PointPerfect service the user has chosen.
869880

870881
// Profiles
871882
char profileName[50] = "";

0 commit comments

Comments
 (0)