Skip to content

Display: Add productDisplayNames table and display product name #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions Firmware/RTK_Surveyor/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@ void beginBoard()
// Bug in ZED-F9P v1.13 firmware causes RTK LED to not light when RTK Floating with SBAS on.
// The following changes the POR default but will be overwritten by settings in NVM or settings file
settings.ubxConstellations[1].enabled = false;

strncpy(platformFilePrefix, "SFE_Surveyor", sizeof(platformFilePrefix) - 1);
strncpy(platformPrefix, "Surveyor", sizeof(platformPrefix) - 1);
}
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
{
Expand All @@ -198,17 +195,6 @@ void beginBoard()
pinMode(pin_setupButton, INPUT_PULLUP);

setMuxport(settings.dataPortChannel); // Set mux to user's choice: NMEA, I2C, PPS, or DAC

if (productVariant == RTK_EXPRESS)
{
strncpy(platformFilePrefix, "SFE_Express", sizeof(platformFilePrefix) - 1);
strncpy(platformPrefix, "Express", sizeof(platformPrefix) - 1);
}
else if (productVariant == RTK_EXPRESS_PLUS)
{
strncpy(platformFilePrefix, "SFE_Express_Plus", sizeof(platformFilePrefix) - 1);
strncpy(platformPrefix, "Express Plus", sizeof(platformPrefix) - 1);
}
}
else if (productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND ||
productVariant == RTK_FACET_LBAND_DIRECT)
Expand Down Expand Up @@ -247,21 +233,8 @@ void beginBoard()
pinMode(pin_radio_cts, OUTPUT);
digitalWrite(pin_radio_cts, LOW);

if (productVariant == RTK_FACET)
if (productVariant == RTK_FACET_LBAND_DIRECT)
{
strncpy(platformFilePrefix, "SFE_Facet", sizeof(platformFilePrefix) - 1);
strncpy(platformPrefix, "Facet", sizeof(platformPrefix) - 1);
}
else if (productVariant == RTK_FACET_LBAND)
{
strncpy(platformFilePrefix, "SFE_Facet_LBand", sizeof(platformFilePrefix) - 1);
strncpy(platformPrefix, "Facet L-Band", sizeof(platformPrefix) - 1);
}
else if (productVariant == RTK_FACET_LBAND_DIRECT)
{
strncpy(platformFilePrefix, "SFE_Facet_LBand_Direct", sizeof(platformFilePrefix) - 1);
strncpy(platformPrefix, "Facet L-Band Direct", sizeof(platformPrefix) - 1);

// Override the default setting if a user has not explicitly configured the setting
if (settings.useI2cForLbandCorrectionsConfigured == false)
settings.useI2cForLbandCorrections = false;
Expand All @@ -272,9 +245,6 @@ void beginBoard()
// No powerOnCheck

settings.enablePrintBatteryMessages = false; // No pesky battery messages

strncpy(platformFilePrefix, "SFE_Reference_Station", sizeof(platformFilePrefix) - 1);
strncpy(platformPrefix, "Reference Station", sizeof(platformPrefix) - 1);
}

char versionString[21];
Expand Down
30 changes: 1 addition & 29 deletions Firmware/RTK_Surveyor/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -605,35 +605,7 @@ void displaySplash()
printTextCenter("RTK", yPos, QW_FONT_8X16, 1, false);

yPos = yPos + fontHeight + 5;

if (productVariant == RTK_SURVEYOR)
{
printTextCenter("Surveyor", yPos, QW_FONT_8X16, 1, false);
}
else if (productVariant == RTK_EXPRESS)
{
printTextCenter("Express", yPos, QW_FONT_8X16, 1, false);
}
else if (productVariant == RTK_EXPRESS_PLUS)
{
printTextCenter("Express+", yPos, QW_FONT_8X16, 1, false);
}
else if (productVariant == RTK_FACET)
{
printTextCenter("Facet", yPos, QW_FONT_8X16, 1, false);
}
else if (productVariant == RTK_FACET_LBAND)
{
printTextCenter("Facet LB", yPos, QW_FONT_8X16, 1, false);
}
else if (productVariant == RTK_FACET_LBAND_DIRECT)
{
printTextCenter("Facet LB", yPos, QW_FONT_8X16, 1, false); //Same as L-Band at boot
}
else if (productVariant == REFERENCE_STATION)
{
printTextCenter("Ref Stn", yPos, QW_FONT_8X16, 1, false);
}
printTextCenter(productDisplayNames[productVariant], yPos, QW_FONT_8X16, 1, false);

yPos = yPos + fontHeight + 7;
char unitFirmware[50];
Expand Down
10 changes: 5 additions & 5 deletions Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ SdFat *sd;

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

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

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

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

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

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

DMW_c("verifyTables");
verifyTables (); // Verify the consistency of the internal tables

DMW_c("identifyBoard");
identifyBoard(); // Determine what hardware platform we are running on

Expand Down Expand Up @@ -904,9 +907,6 @@ void setup()
DMW_c("beginLEDs");
beginLEDs(); // LED and PWM setup

DMW_c("verifyTables");
verifyTables (); // Verify the consistency of the internal tables

DMW_c("beginSD");
beginSD(); // Test if SD is present

Expand Down
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/System.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ void reportFatalError(const char *errorMsg)
{
while (1)
{
systemPrint("ERROR: ");
systemPrint("HALTED: ");
systemPrint(errorMsg);
systemPrintln();
sleep(15);
Expand Down
43 changes: 43 additions & 0 deletions Firmware/RTK_Surveyor/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,53 @@ typedef enum
RTK_FACET_LBAND,
REFERENCE_STATION,
RTK_FACET_LBAND_DIRECT,
// Add new values just above this line
RTK_UNKNOWN,
} ProductVariant;
ProductVariant productVariant = RTK_SURVEYOR;

const char * const productDisplayNames[] =
{
"Surveyor",
"Express",
"Facet",
"Express+",
"Facet LB",
"Ref Stn",
"Facet LB",
// Add new values just above this line
"Unknown",
};
const int productDisplayNamesEntries = sizeof (productDisplayNames) / sizeof(productDisplayNames[0]);

const char * const platformFilePrefixTable[] =
{
"SFE_Surveyor",
"SFE_Express",
"SFE_Facet",
"SFE_Express_Plus",
"SFE_Facet_LBand",
"SFE_Reference_Station",
"SFE_Facet_LBand_Direct",
// Add new values just above this line
"SFE_Unknown",
};
const int platformFilePrefixTableEntries = sizeof (platformFilePrefixTable) / sizeof(platformFilePrefixTable[0]);

const char * const platformPrefixTable[] =
{
"Surveyor",
"Express",
"Facet",
"Express Plus",
"Facet L-Band",
"Reference Station",
"Facet L-Band Direct",
// Add new values just above this line
"Unknown",
};
const int platformPrefixTableEntries = sizeof (platformPrefixTable) / sizeof(platformPrefixTable[0]);

// Macros to show if the GNSS is I2C or SPI
#define USE_SPI_GNSS (productVariant == REFERENCE_STATION)
#define USE_I2C_GNSS (!USE_SPI_GNSS)
Expand Down
10 changes: 9 additions & 1 deletion Firmware/RTK_Surveyor/support.ino
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,16 @@ void printUbloxInvalidData(PARSE_STATE *parse)
}

// Verify table sizes match enum definitions
void verifyTables ()
void verifyTables()
{
// Verify the product name table
if (productDisplayNamesEntries != (RTK_UNKNOWN + 1))
reportFatalError("Fix productDisplayNames to match ProductVariant");
if (platformFilePrefixTableEntries != (RTK_UNKNOWN + 1))
reportFatalError("Fix platformFilePrefixTable to match ProductVariant");
if (platformPrefixTableEntries != (RTK_UNKNOWN + 1))
reportFatalError("Fix platformPrefixTable to match ProductVariant");

// Verify the consistency of the internal tables
ethernetVerifyTables();
networkVerifyTables();
Expand Down