Skip to content

Commit a909dd2

Browse files
committed
Add settingPossibleOnPlatform
1 parent f4d6d32 commit a909dd2

File tree

3 files changed

+63
-8
lines changed

3 files changed

+63
-8
lines changed

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,8 @@ void GNSS_MOSAIC::menuConstellations()
17391739

17401740
for (int x = 0; x < MAX_MOSAIC_CONSTELLATIONS; x++)
17411741
{
1742-
systemPrintf("%d) Constellation %s: ", x + 1, mosaicSignalConstellations[x].name);
1742+
const char *ptr = mosaicSignalConstellations[x].configName;
1743+
systemPrintf("%d) Constellation %s: ", x + 1, ptr);
17431744
if (settings.mosaicConstellations[x] > 0)
17441745
systemPrint("Enabled");
17451746
else

Firmware/RTK_Everywhere/RTK_Everywhere.ino

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ unsigned long loraLastIncomingSerial; // Last time a user sent a serial command.
892892

893893
// Display boot times
894894
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
895-
#define MAX_BOOT_TIME_ENTRIES 42
895+
#define MAX_BOOT_TIME_ENTRIES 43
896896
uint8_t bootTimeIndex;
897897
uint32_t bootTime[MAX_BOOT_TIME_ENTRIES];
898898
const char *bootTimeString[MAX_BOOT_TIME_ENTRIES];
@@ -1190,7 +1190,7 @@ void setup()
11901190
identifyBoard(); // Determine what hardware platform we are running on.
11911191

11921192
DMW_b("commandIndexFill");
1193-
if (!commandIndexFill()) // Initialize the command table index
1193+
if (!commandIndexFill(true)) // Initialize the command table index using possible settings
11941194
reportFatalError("Failed to allocate and fill the commandIndex!");
11951195

11961196
DMW_b("beginBoard");
@@ -1238,6 +1238,7 @@ void setup()
12381238
DMW_b("verifyTables");
12391239
verifyTables(); // Verify the consistency of the internal tables
12401240

1241+
DMW_b("beginVersion");
12411242
beginVersion(); // Assemble platform name. Requires settings/LFS.
12421243

12431244
DMW_b("displaySplash");
@@ -1249,8 +1250,14 @@ void setup()
12491250
DMW_b("loadSettings");
12501251
loadSettings(); // Attempt to load settings after SD is started so we can read the settings file if available
12511252

1253+
DMW_b("gnssDetectReceiverType");
12521254
gnssDetectReceiverType(); // If we don't know the receiver from the platform, auto-detect it. Uses settings.
12531255

1256+
DMW_b("commandIndexFill (2)");
1257+
commandIndexFill(false); // Shrink the commandIndex table now we're certain what GNSS we have
1258+
loadSettings();
1259+
recordSystemSettings();
1260+
12541261
DMW_b("beginGnssUart");
12551262
beginGnssUart(); // Requires settings. Start the UART connected to the GNSS receiver on core 0. Start before
12561263
// gnssBegin in case it is needed (Torch).

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3436,8 +3436,33 @@ bool settingAvailableOnPlatform(int i)
34363436
return true;
34373437
}
34383438

3439+
// Determine if the setting is possible on this platform
3440+
bool settingPossibleOnPlatform(int i)
3441+
{
3442+
do
3443+
{
3444+
// Verify that the command is available on the platform
3445+
if ((productVariant == RTK_EVK) && rtkSettingsEntries[i].platEvk)
3446+
break;
3447+
if ((productVariant == RTK_FACET_V2) && rtkSettingsEntries[i].platFacetV2)
3448+
break;
3449+
if ((productVariant == RTK_FACET_V2_LBAND) && rtkSettingsEntries[i].platFacetV2LBand)
3450+
break;
3451+
if ((productVariant == RTK_FACET_MOSAIC) && rtkSettingsEntries[i].platFacetMosaic)
3452+
break;
3453+
if ((productVariant == RTK_TORCH) && rtkSettingsEntries[i].platTorch)
3454+
break;
3455+
if ((productVariant == RTK_POSTCARD) && rtkSettingsEntries[i].platPostcard)
3456+
break;
3457+
if ((productVariant == RTK_FLEX) && (rtkSettingsEntries[i].platFlex > FFN))
3458+
break;
3459+
return false;
3460+
} while (0);
3461+
return true;
3462+
}
3463+
34393464
// Allocate and fill the commandIndex table
3440-
bool commandIndexFill()
3465+
bool commandIndexFill(bool usePossibleSettings)
34413466
{
34423467
int i;
34433468
const char *iCommandName;
@@ -3450,14 +3475,26 @@ bool commandIndexFill()
34503475
commandCount = 0;
34513476
for (i = 0; i < numRtkSettingsEntries; i++)
34523477
{
3453-
if (settingAvailableOnPlatform(i))
3454-
commandCount += 1;
3478+
if (usePossibleSettings)
3479+
{
3480+
// commandIndexFill is called after identifyBoard. On Flex, we don't yet know
3481+
// the detectedGnssReceiver, so we have to use settingPossibleOnPlatform
3482+
if (settingPossibleOnPlatform(i))
3483+
commandCount += 1;
3484+
}
3485+
else
3486+
{
3487+
if (settingAvailableOnPlatform(i))
3488+
commandCount += 1;
3489+
}
34553490
}
34563491
commandCount += COMMAND_COUNT - 1;
34573492

34583493
// Allocate the command array. Never freed
34593494
length = commandCount * sizeof(*commandIndex);
34603495

3496+
if (commandIndex)
3497+
rtkFree(commandIndex, "Command index array (commandIndex)");
34613498
commandIndex = (int16_t *)rtkMalloc(length, "Command index array (commandIndex)");
34623499
if (!commandIndex)
34633500
{
@@ -3469,8 +3506,18 @@ bool commandIndexFill()
34693506
// Initialize commandIndex with index values into rtkSettingsEntries
34703507
commandCount = 0;
34713508
for (i = 0; i < numRtkSettingsEntries; i++)
3472-
if (settingAvailableOnPlatform(i))
3473-
commandIndex[commandCount++] = i;
3509+
{
3510+
if (usePossibleSettings)
3511+
{
3512+
if (settingPossibleOnPlatform(i))
3513+
commandIndex[commandCount++] = i;
3514+
}
3515+
else
3516+
{
3517+
if (settingAvailableOnPlatform(i))
3518+
commandIndex[commandCount++] = i;
3519+
}
3520+
}
34743521

34753522
// Add the man-machine interface commands to the list
34763523
for (i = 1; i < COMMAND_COUNT; i++)

0 commit comments

Comments
 (0)