@@ -494,13 +494,29 @@ void commandSplitName(const char *settingName, char *truncatedName, int truncate
494
494
}
495
495
496
496
// Using the settingName string, return the index of the setting within command array
497
+ int commandLookupSettingNameAfterPriority (bool inCommands, const char *settingName, char *truncatedName, int truncatedNameLen,
498
+ char *suffix, int suffixLen)
499
+ {
500
+ return commandLookupSettingNameSelective (inCommands, settingName, truncatedName, truncatedNameLen, suffix, suffixLen, true );
501
+ }
497
502
int commandLookupSettingName (bool inCommands, const char *settingName, char *truncatedName, int truncatedNameLen,
498
503
char *suffix, int suffixLen)
504
+ {
505
+ return commandLookupSettingNameSelective (inCommands, settingName, truncatedName, truncatedNameLen, suffix, suffixLen, false );
506
+ }
507
+ int commandLookupSettingNameSelective (bool inCommands, const char *settingName, char *truncatedName, int truncatedNameLen,
508
+ char *suffix, int suffixLen, bool usePrioritySettingsEnd)
499
509
{
500
510
const char *command;
501
511
502
- // Loop through the valid command entries
503
- for (int i = 0 ; i < commandCount; i++)
512
+ int prioritySettingsEnd = 0 ;
513
+ if (usePrioritySettingsEnd)
514
+ // Find "endOfPrioritySettings"
515
+ prioritySettingsEnd = findEndOfPrioritySettings ();
516
+ // If "endOfPrioritySettings" is not found, prioritySettingsEnd will be zero
517
+
518
+ // Loop through the valid command entries - starting at prioritySettingsEnd
519
+ for (int i = prioritySettingsEnd; i < commandCount; i++)
504
520
{
505
521
// Verify that this command does not get split
506
522
if ((commandIndex[i] >= 0 ) && (!rtkSettingsEntries[commandIndex[i]].useSuffix ) &&
@@ -520,9 +536,10 @@ int commandLookupSettingName(bool inCommands, const char *settingName, char *tru
520
536
commandSplitName (settingName, truncatedName, truncatedNameLen, suffix, suffixLen);
521
537
522
538
// Loop through the settings entries
539
+ // This could be speeded up by
523
540
// E.g. by storing the previous value of i and starting there.
524
541
// Most of the time, the match will be i+1.
525
- for (int i = 0 ; i < commandCount; i++)
542
+ for (int i = prioritySettingsEnd ; i < commandCount; i++)
526
543
{
527
544
// Verify that this command gets split
528
545
if ((commandIndex[i] >= 0 ) && rtkSettingsEntries[commandIndex[i]].useSuffix )
@@ -2364,8 +2381,8 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
2364
2381
bool settingIsString = false ; // Goes true when setting needs to be surrounded by quotes during command response.
2365
2382
// Generally char arrays but some others.
2366
2383
2367
- // Loop through the valid command entries
2368
- i = commandLookupSettingName (inCommands, settingName, truncatedName, sizeof (truncatedName), suffix, sizeof (suffix));
2384
+ // Loop through the valid command entries - but skip the priority settings and use the GNSS-specific types
2385
+ i = commandLookupSettingNameAfterPriority (inCommands, settingName, truncatedName, sizeof (truncatedName), suffix, sizeof (suffix));
2369
2386
2370
2387
// Determine if settingName is in the command table
2371
2388
if (i >= 0 )
@@ -2489,23 +2506,18 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
2489
2506
}
2490
2507
break ;
2491
2508
2492
- case tCmnCnst: {
2493
-
2494
- #ifdef COMPILE_MOSAICX5
2495
- for (int x = 0 ; x < MAX_MOSAIC_CONSTELLATIONS; x++)
2496
- {
2497
- if ((suffix[0 ] == mosaicSignalConstellations[x].configName [0 ]) &&
2498
- (strcmp (suffix, mosaicSignalConstellations[x].configName ) == 0 ))
2499
- {
2500
- writeToString (settingValueStr, settings.mosaicConstellations [x]);
2501
- knownSetting = true ;
2502
- break ;
2503
- }
2504
- }
2505
- #endif // COMPILE_MOSAICX5
2509
+ case tCmnCnst:
2510
+ break ; // Nothing to do here. Let each GNSS add its settings
2511
+ case tCmnRtNm:
2512
+ break ; // Nothing to do here. Let each GNSS add its settings
2513
+ case tCnRtRtB:
2514
+ break ; // Nothing to do here. Let each GNSS add its settings
2515
+ case tCnRtRtR:
2516
+ break ; // Nothing to do here. Let each GNSS add its settings
2506
2517
2507
2518
#ifdef COMPILE_ZED
2508
- for (int x = 0 ; x < MAX_UBX_CONSTELLATIONS; x++)
2519
+ case tUbxConst: {
2520
+ for (int x = 0 ; x < qualifier; x++)
2509
2521
{
2510
2522
if ((suffix[0 ] == settings.ubxConstellations [x].textName [0 ]) &&
2511
2523
(strcmp (suffix, settings.ubxConstellations [x].textName ) == 0 ))
@@ -2515,42 +2527,8 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
2515
2527
break ;
2516
2528
}
2517
2529
}
2518
- #endif // COMPILE_ZED
2519
-
2520
- #ifdef COMPILE_UM980
2521
- for (int x = 0 ; x < MAX_UM980_CONSTELLATIONS; x++)
2522
- {
2523
- if ((suffix[0 ] == um980ConstellationCommands[x].textName [0 ]) &&
2524
- (strcmp (suffix, um980ConstellationCommands[x].textName ) == 0 ))
2525
- {
2526
- writeToString (settingValueStr, settings.um980Constellations [x]);
2527
- knownSetting = true ;
2528
- break ;
2529
- }
2530
- }
2531
- #endif // COMPILE_UM980
2532
-
2533
- #ifdef COMPILE_LG290P
2534
- for (int x = 0 ; x < qualifier; x++)
2535
- {
2536
- if ((suffix[0 ] == lg290pConstellationNames[x][0 ]) && (strcmp (suffix, lg290pConstellationNames[x]) == 0 ))
2537
- {
2538
- writeToString (settingValueStr, settings.lg290pConstellations [x]);
2539
- knownSetting = true ;
2540
- break ;
2541
- }
2542
- }
2543
- #endif // COMPILE_LG290P
2544
2530
}
2545
- break ; // Nothing to do here. Let each GNSS add its settings
2546
- case tCmnRtNm:
2547
- break ; // Nothing to do here. Let each GNSS add its settings
2548
- case tCnRtRtB:
2549
- break ; // Nothing to do here. Let each GNSS add its settings
2550
- case tCnRtRtR:
2551
- break ; // Nothing to do here. Let each GNSS add its settings
2552
-
2553
- #ifdef COMPILE_ZED
2531
+ break ;
2554
2532
case tUbxMsgRt: {
2555
2533
for (int x = 0 ; x < qualifier; x++)
2556
2534
{
@@ -2719,6 +2697,19 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
2719
2697
}
2720
2698
}
2721
2699
break ;
2700
+ case tUmConst: {
2701
+ for (int x = 0 ; x < qualifier; x++)
2702
+ {
2703
+ if ((suffix[0 ] == um980ConstellationCommands[x].textName [0 ]) &&
2704
+ (strcmp (suffix, um980ConstellationCommands[x].textName ) == 0 ))
2705
+ {
2706
+ writeToString (settingValueStr, settings.um980Constellations [x]);
2707
+ knownSetting = true ;
2708
+ break ;
2709
+ }
2710
+ }
2711
+ }
2712
+ break ;
2722
2713
#endif // COMPILE_UM980
2723
2714
2724
2715
case tCorrSPri: {
@@ -2745,6 +2736,19 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
2745
2736
break ;
2746
2737
2747
2738
#ifdef COMPILE_MOSAICX5
2739
+ case tMosaicConst: {
2740
+ for (int x = 0 ; x < qualifier; x++)
2741
+ {
2742
+ if ((suffix[0 ] == mosaicSignalConstellations[x].configName [0 ]) &&
2743
+ (strcmp (suffix, mosaicSignalConstellations[x].configName ) == 0 ))
2744
+ {
2745
+ writeToString (settingValueStr, settings.mosaicConstellations [x]);
2746
+ knownSetting = true ;
2747
+ break ;
2748
+ }
2749
+ }
2750
+ }
2751
+ break ;
2748
2752
case tMosaicMSNmea: {
2749
2753
for (int x = 0 ; x < qualifier; x++)
2750
2754
{
@@ -2875,7 +2879,18 @@ SettingValueResponse getSettingValue(bool inCommands, const char *settingName, c
2875
2879
}
2876
2880
}
2877
2881
break ;
2878
-
2882
+ case tLgConst: {
2883
+ for (int x = 0 ; x < qualifier; x++)
2884
+ {
2885
+ if ((suffix[0 ] == lg290pConstellationNames[x][0 ]) && (strcmp (suffix, lg290pConstellationNames[x]) == 0 ))
2886
+ {
2887
+ writeToString (settingValueStr, settings.lg290pConstellations [x]);
2888
+ knownSetting = true ;
2889
+ break ;
2890
+ }
2891
+ }
2892
+ }
2893
+ break ;
2879
2894
#endif // COMPILE_LG290P
2880
2895
2881
2896
case tGnssReceiver: {
@@ -3546,6 +3561,22 @@ bool settingPossibleOnPlatform(int i)
3546
3561
return true ;
3547
3562
}
3548
3563
3564
+ int findEndOfPrioritySettings ()
3565
+ {
3566
+ // Find "endOfPrioritySettings"
3567
+ int prioritySettingsEnd = 0 ;
3568
+ for (int i = 0 ; i < numRtkSettingsEntries; i++)
3569
+ {
3570
+ if (strcmp (rtkSettingsEntries[i].name , " endOfPrioritySettings" ) == 0 )
3571
+ {
3572
+ prioritySettingsEnd = i;
3573
+ break ;
3574
+ }
3575
+ }
3576
+ // If "endOfPrioritySettings" is not found, prioritySettingsEnd will be zero
3577
+ return prioritySettingsEnd;
3578
+ }
3579
+
3549
3580
// Allocate and fill the commandIndex table
3550
3581
bool commandIndexFillPossible ()
3551
3582
{
@@ -3619,21 +3650,19 @@ bool commandIndexFill(bool usePossibleSettings)
3619
3650
commandIndex[commandCount++] = -i;
3620
3651
3621
3652
// Find "endOfPrioritySettings"
3622
- int prioritySettingsEnd = 0 ;
3623
- for (i = 0 ; i < numRtkSettingsEntries; i++)
3624
- {
3625
- if (strcmp (rtkSettingsEntries[i].name , " endOfPrioritySettings" ) == 0 )
3626
- {
3627
- prioritySettingsEnd = i;
3628
- if (settings.debugSettings )
3629
- systemPrintf (" endOfPrioritySettings found at entry %d\r\n " , prioritySettingsEnd);
3630
- break ;
3631
- }
3632
- }
3653
+ int prioritySettingsEnd = findEndOfPrioritySettings ();
3633
3654
// If "endOfPrioritySettings" is not found, prioritySettingsEnd will be zero
3634
3655
// and all settings will be sorted. Just like the good old days...
3635
3656
3636
- // Sort the commands - starting at
3657
+ if (settings.debugSettings )
3658
+ {
3659
+ if (prioritySettingsEnd > 0 )
3660
+ systemPrintf (" endOfPrioritySettings found at entry %d\r\n " , prioritySettingsEnd);
3661
+ else
3662
+ systemPrintln (" endOfPrioritySettings not found!" );
3663
+ }
3664
+
3665
+ // Sort the commands - starting at prioritySettingsEnd
3637
3666
for (i = prioritySettingsEnd; i < commandCount - 1 ; i++)
3638
3667
{
3639
3668
iCommandName = commandGetName (0 , commandIndex[i]);
0 commit comments