Skip to content

Commit d735fae

Browse files
authored
Merge pull request #734 from sparkfun/pcUpdates
Add adjustEndOfPrioritySettings
2 parents b3b0492 + a7c41bb commit d735fae

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,10 @@ SparkFunAppleAccessoryDriver *appleAccessory; // Instantiated by beginAuthCoPro
812812

813813
const char *sdp_service_name = "iAP2";
814814

815-
static const uint8_t UUID_IAP2[] = {0x00, 0x00, 0x00, 0x00, 0xDE, 0xCA, 0xFA, 0xDE, 0xDE, 0xCA, 0xDE, 0xAF, 0xDE, 0xCA, 0xCA, 0xFF};
815+
// UUID: Big-Endian
816+
//static const uint8_t UUID_IAP2[] = {0x00, 0x00, 0x00, 0x00, 0xDE, 0xCA, 0xFA, 0xDE, 0xDE, 0xCA, 0xDE, 0xAF, 0xDE, 0xCA, 0xCA, 0xFF};
817+
// UUID: Little-Endian
818+
static const uint8_t UUID_IAP2[] = {0xFF, 0xCA, 0xCA, 0xDE, 0xAF, 0xDE, 0xCA, 0xDE, 0xDE, 0xFA, 0xCA, 0xDE, 0x00, 0x00, 0x00, 0x00};
816819

817820
#endif
818821

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,8 @@ int commandLookupSettingNameSelective(bool inCommands, const char *settingName,
594594
prioritySettingsEnd = findEndOfPrioritySettings();
595595
// If "endOfPrioritySettings" is not found, prioritySettingsEnd will be zero
596596

597-
// Remove one because while rtkSettingsEntries[] contains detectedGnssReceiver, the command table does not
598-
prioritySettingsEnd--;
597+
// Adjust prioritySettingsEnd if needed - depending on platform type
598+
prioritySettingsEnd = adjustEndOfPrioritySettings(prioritySettingsEnd);
599599

600600
// Loop through the valid command entries - starting at prioritySettingsEnd
601601
for (int i = prioritySettingsEnd; i < commandCount; i++)
@@ -3783,6 +3783,25 @@ int findEndOfPrioritySettings()
37833783
return prioritySettingsEnd;
37843784
}
37853785

3786+
int adjustEndOfPrioritySettings(int prioritySettingsEnd)
3787+
{
3788+
// If prioritySettingsEnd is zero, don't adjust
3789+
if (prioritySettingsEnd == 0)
3790+
return 0;
3791+
3792+
int adjustedPrioritySettingsEnd = prioritySettingsEnd;
3793+
3794+
// Check which of the priority settings are possible on this platform
3795+
// Deduct the ones which are not
3796+
for (int i = 0; i < prioritySettingsEnd; i++)
3797+
{
3798+
if (!settingPossibleOnPlatform(i))
3799+
adjustedPrioritySettingsEnd--;
3800+
}
3801+
3802+
return adjustedPrioritySettingsEnd;
3803+
}
3804+
37863805
// Allocate and fill the commandIndex table
37873806
bool commandIndexFillPossible()
37883807
{
@@ -3860,6 +3879,9 @@ bool commandIndexFill(bool usePossibleSettings)
38603879
// If "endOfPrioritySettings" is not found, prioritySettingsEnd will be zero
38613880
// and all settings will be sorted. Just like the good old days...
38623881

3882+
// Adjust prioritySettingsEnd if needed - depending on platform type
3883+
prioritySettingsEnd = adjustEndOfPrioritySettings(prioritySettingsEnd);
3884+
38633885
if (settings.debugSettings || settings.debugCLI)
38643886
{
38653887
systemPrintf("commandCount %d\r\n", commandCount);

Firmware/RTK_Everywhere/settings.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,12 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
12601260
// i d i v V i c n r e X
12611261
// g s x k 2 c h d d x 2 Type Qual Variable Name
12621262

1263-
// Detected GNSS Receiver - for Flex. Save / load first so settingAvailableOnPlatform is correct on Flex
1263+
1264+
// =======================================================================================================
1265+
// Priority Settings which are not alphabetized in commandIndex
1266+
// =======================================================================================================
1267+
1268+
// Detected GNSS Receiver - only for Flex. Save / load first so settingAvailableOnPlatform is correct on Flex
12641269
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, ALL, 0, tGnssReceiver, 0, & settings.detectedGnssReceiver, "detectedGnssReceiver", },
12651270

12661271
// Common settings which use the same name on multiple Flex platforms
@@ -1281,6 +1286,7 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
12811286

12821287
// <--- Insert any new essential "priority" (non-sorted) settings above this line --->
12831288

1289+
// endOfPrioritySettings is a special 'null' entry which does not appear in commandIndex
12841290
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, NON, 0, _bool, 0, nullptr, "endOfPrioritySettings", },
12851291

12861292
// =======================================================================================================

0 commit comments

Comments
 (0)