Skip to content

Commit d96768e

Browse files
authored
Merge pull request #724 from LeeLeahy2/display-product
Display: Add productDisplayNames table and display product name
2 parents b27a2b5 + 088d54a commit d96768e

File tree

6 files changed

+60
-67
lines changed

6 files changed

+60
-67
lines changed

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ void beginBoard()
203203
// Bug in ZED-F9P v1.13 firmware causes RTK LED to not light when RTK Floating with SBAS on.
204204
// The following changes the POR default but will be overwritten by settings in NVM or settings file
205205
settings.ubxConstellations[1].enabled = false;
206-
207-
strncpy(platformFilePrefix, "SFE_Surveyor", sizeof(platformFilePrefix) - 1);
208-
strncpy(platformPrefix, "Surveyor", sizeof(platformPrefix) - 1);
209206
}
210207
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
211208
{
@@ -229,17 +226,6 @@ void beginBoard()
229226
pinMode(pin_setupButton, INPUT_PULLUP);
230227

231228
setMuxport(settings.dataPortChannel); // Set mux to user's choice: NMEA, I2C, PPS, or DAC
232-
233-
if (productVariant == RTK_EXPRESS)
234-
{
235-
strncpy(platformFilePrefix, "SFE_Express", sizeof(platformFilePrefix) - 1);
236-
strncpy(platformPrefix, "Express", sizeof(platformPrefix) - 1);
237-
}
238-
else if (productVariant == RTK_EXPRESS_PLUS)
239-
{
240-
strncpy(platformFilePrefix, "SFE_Express_Plus", sizeof(platformFilePrefix) - 1);
241-
strncpy(platformPrefix, "Express Plus", sizeof(platformPrefix) - 1);
242-
}
243229
}
244230
else if (productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND ||
245231
productVariant == RTK_FACET_LBAND_DIRECT)
@@ -278,21 +264,8 @@ void beginBoard()
278264
pinMode(pin_radio_cts, OUTPUT);
279265
digitalWrite(pin_radio_cts, LOW);
280266

281-
if (productVariant == RTK_FACET)
267+
if (productVariant == RTK_FACET_LBAND_DIRECT)
282268
{
283-
strncpy(platformFilePrefix, "SFE_Facet", sizeof(platformFilePrefix) - 1);
284-
strncpy(platformPrefix, "Facet", sizeof(platformPrefix) - 1);
285-
}
286-
else if (productVariant == RTK_FACET_LBAND)
287-
{
288-
strncpy(platformFilePrefix, "SFE_Facet_LBand", sizeof(platformFilePrefix) - 1);
289-
strncpy(platformPrefix, "Facet L-Band", sizeof(platformPrefix) - 1);
290-
}
291-
else if (productVariant == RTK_FACET_LBAND_DIRECT)
292-
{
293-
strncpy(platformFilePrefix, "SFE_Facet_LBand_Direct", sizeof(platformFilePrefix) - 1);
294-
strncpy(platformPrefix, "Facet L-Band Direct", sizeof(platformPrefix) - 1);
295-
296269
// Override the default setting if a user has not explicitly configured the setting
297270
if (settings.useI2cForLbandCorrectionsConfigured == false)
298271
settings.useI2cForLbandCorrections = false;
@@ -303,9 +276,6 @@ void beginBoard()
303276
// No powerOnCheck
304277

305278
settings.enablePrintBatteryMessages = false; // No pesky battery messages
306-
307-
strncpy(platformFilePrefix, "SFE_Reference_Station", sizeof(platformFilePrefix) - 1);
308-
strncpy(platformPrefix, "Reference Station", sizeof(platformPrefix) - 1);
309279
}
310280

311281
char versionString[21];

Firmware/RTK_Surveyor/Display.ino

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -605,35 +605,7 @@ void displaySplash()
605605
printTextCenter("RTK", yPos, QW_FONT_8X16, 1, false);
606606

607607
yPos = yPos + fontHeight + 5;
608-
609-
if (productVariant == RTK_SURVEYOR)
610-
{
611-
printTextCenter("Surveyor", yPos, QW_FONT_8X16, 1, false);
612-
}
613-
else if (productVariant == RTK_EXPRESS)
614-
{
615-
printTextCenter("Express", yPos, QW_FONT_8X16, 1, false);
616-
}
617-
else if (productVariant == RTK_EXPRESS_PLUS)
618-
{
619-
printTextCenter("Express+", yPos, QW_FONT_8X16, 1, false);
620-
}
621-
else if (productVariant == RTK_FACET)
622-
{
623-
printTextCenter("Facet", yPos, QW_FONT_8X16, 1, false);
624-
}
625-
else if (productVariant == RTK_FACET_LBAND)
626-
{
627-
printTextCenter("Facet LB", yPos, QW_FONT_8X16, 1, false);
628-
}
629-
else if (productVariant == RTK_FACET_LBAND_DIRECT)
630-
{
631-
printTextCenter("Facet LB", yPos, QW_FONT_8X16, 1, false); //Same as L-Band at boot
632-
}
633-
else if (productVariant == REFERENCE_STATION)
634-
{
635-
printTextCenter("Ref Stn", yPos, QW_FONT_8X16, 1, false);
636-
}
608+
printTextCenter(productDisplayNames[productVariant], yPos, QW_FONT_8X16, 1, false);
637609

638610
yPos = yPos + fontHeight + 7;
639611
char unitFirmware[50];

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ SdFat *sd;
155155

156156
#include "FileSdFatMMC.h" //Hybrid SdFat and SD_MMC file access
157157

158-
char platformFilePrefix[40] = "SFE_Surveyor"; // Sets the prefix for logs and settings files
158+
#define platformFilePrefix platformFilePrefixTable[productVariant] // Sets the prefix for logs and settings files
159159

160160
FileSdFatMMC *ubxFile; // File that all GNSS ubx messages sentences are written to
161161
unsigned long lastUBXLogSyncTime = 0; // Used to record to SD every half second
@@ -419,7 +419,7 @@ float battChangeRate = 0.0;
419419
#include "bluetoothSelect.h"
420420
#endif // COMPILE_BT
421421

422-
char platformPrefix[55] = "Surveyor"; // Sets the prefix for broadcast names
422+
#define platformPrefix platformPrefixTable[productVariant] // Sets the prefix for broadcast names
423423

424424
#include <driver/uart.h> //Required for uart_set_rx_full_threshold() on cores <v2.0.5
425425
HardwareSerial serialGNSS(2); // TX on 17, RX on 16
@@ -869,6 +869,9 @@ void setup()
869869

870870
Serial.begin(115200); // UART0 for programming and debugging
871871

872+
DMW_c("verifyTables");
873+
verifyTables (); // Verify the consistency of the internal tables
874+
872875
DMW_c("identifyBoard");
873876
identifyBoard(); // Determine what hardware platform we are running on
874877

@@ -904,9 +907,6 @@ void setup()
904907
DMW_c("beginLEDs");
905908
beginLEDs(); // LED and PWM setup
906909

907-
DMW_c("verifyTables");
908-
verifyTables (); // Verify the consistency of the internal tables
909-
910910
DMW_c("beginSD");
911911
beginSD(); // Test if SD is present
912912

Firmware/RTK_Surveyor/System.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ void reportFatalError(const char *errorMsg)
11671167
{
11681168
while (1)
11691169
{
1170-
systemPrint("ERROR: ");
1170+
systemPrint("HALTED: ");
11711171
systemPrint(errorMsg);
11721172
systemPrintln();
11731173
sleep(15);

Firmware/RTK_Surveyor/settings.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,53 @@ typedef enum
8080
RTK_FACET_LBAND,
8181
REFERENCE_STATION,
8282
RTK_FACET_LBAND_DIRECT,
83+
// Add new values just above this line
8384
RTK_UNKNOWN,
8485
} ProductVariant;
8586
ProductVariant productVariant = RTK_SURVEYOR;
8687

88+
const char * const productDisplayNames[] =
89+
{
90+
"Surveyor",
91+
"Express",
92+
"Facet",
93+
"Express+",
94+
"Facet LB",
95+
"Ref Stn",
96+
"Facet LB",
97+
// Add new values just above this line
98+
"Unknown",
99+
};
100+
const int productDisplayNamesEntries = sizeof (productDisplayNames) / sizeof(productDisplayNames[0]);
101+
102+
const char * const platformFilePrefixTable[] =
103+
{
104+
"SFE_Surveyor",
105+
"SFE_Express",
106+
"SFE_Facet",
107+
"SFE_Express_Plus",
108+
"SFE_Facet_LBand",
109+
"SFE_Reference_Station",
110+
"SFE_Facet_LBand_Direct",
111+
// Add new values just above this line
112+
"SFE_Unknown",
113+
};
114+
const int platformFilePrefixTableEntries = sizeof (platformFilePrefixTable) / sizeof(platformFilePrefixTable[0]);
115+
116+
const char * const platformPrefixTable[] =
117+
{
118+
"Surveyor",
119+
"Express",
120+
"Facet",
121+
"Express Plus",
122+
"Facet L-Band",
123+
"Reference Station",
124+
"Facet L-Band Direct",
125+
// Add new values just above this line
126+
"Unknown",
127+
};
128+
const int platformPrefixTableEntries = sizeof (platformPrefixTable) / sizeof(platformPrefixTable[0]);
129+
87130
// Macros to show if the GNSS is I2C or SPI
88131
#define USE_SPI_GNSS (productVariant == REFERENCE_STATION)
89132
#define USE_I2C_GNSS (!USE_SPI_GNSS)

Firmware/RTK_Surveyor/support.ino

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,16 @@ void printUbloxInvalidData(PARSE_STATE *parse)
800800
}
801801

802802
// Verify table sizes match enum definitions
803-
void verifyTables ()
803+
void verifyTables()
804804
{
805+
// Verify the product name table
806+
if (productDisplayNamesEntries != (RTK_UNKNOWN + 1))
807+
reportFatalError("Fix productDisplayNames to match ProductVariant");
808+
if (platformFilePrefixTableEntries != (RTK_UNKNOWN + 1))
809+
reportFatalError("Fix platformFilePrefixTable to match ProductVariant");
810+
if (platformPrefixTableEntries != (RTK_UNKNOWN + 1))
811+
reportFatalError("Fix platformPrefixTable to match ProductVariant");
812+
805813
// Verify the consistency of the internal tables
806814
ethernetVerifyTables();
807815
networkVerifyTables();

0 commit comments

Comments
 (0)