Skip to content

Commit

Permalink
Merge pull request #4 from sparkfun/release_candidate
Browse files Browse the repository at this point in the history
Version 1.5
  • Loading branch information
PaulZC authored Feb 6, 2025
2 parents f0f5cf2 + 5ea54f9 commit d2609c8
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-for-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
env:
FILENAME_PREFIX: GNSSDO_Firmware
FIRMWARE_VERSION_MAJOR: 1
FIRMWARE_VERSION_MINOR: 4
FIRMWARE_VERSION_MINOR: 5
CORE_VERSION: 3.0.7

jobs:
Expand Down
4 changes: 4 additions & 0 deletions Firmware/GNSSDO_Firmware/Begin.ino
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ void beginTCXO(TwoWire *i2cBus)
}

systemPrintln("Using STP3593LF OCXO");
strncpy(oscillatorType, "STP3593LF OCXO", sizeof(oscillatorType));
}
else if (presentSIT5811)
{
Expand All @@ -553,6 +554,7 @@ void beginTCXO(TwoWire *i2cBus)
}

systemPrintln("Using SiT5811 OCXO");
strncpy(oscillatorType, "SiT5811 OCXO", sizeof(oscillatorType));
}
else if (presentSIT5358)
{
Expand All @@ -571,10 +573,12 @@ void beginTCXO(TwoWire *i2cBus)
}

systemPrintln("Using SiT5358 TCXO");
strncpy(oscillatorType, "SiT5358 TCXO", sizeof(oscillatorType));
}
else
{
// No TCXO present!
strncpy(oscillatorType, "NONE", sizeof(oscillatorType));
return;
}

Expand Down
2 changes: 2 additions & 0 deletions Firmware/GNSSDO_Firmware/Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ void beginDisplay(TwoWire *i2cBus)

delay(50); // Give display time to startup before attempting again
}

systemPrintln("ERROR: Failed to detect or initialize the display! Continuing...\r\n");
}

// Given the system state, display the appropriate information
Expand Down
12 changes: 6 additions & 6 deletions Firmware/GNSSDO_Firmware/GNSS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ bool sendWithResponse(String message, const char *reply, unsigned long timeout,
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Begin GNSS
// Ensure GNSS is communicating on COM4. Request IPStatus
// Ensure GNSS is communicating on COM4. Request IPStatus+ReceiverSetup
void beginGNSS()
{
if (!inMainMenu)
systemPrintln("Begin GNSS - requesting IPStatus");
systemPrintln("Begin GNSS - requesting IPStatus+ReceiverSetup");

int retries = 20; // The mosaic takes a few seconds to wake up after power on

while (!sendWithResponse("esoc, COM1, IPStatus\n\r", "SBFOnce") && (retries > 0))
while (!sendWithResponse("esoc, COM1, IPStatus+ReceiverSetup\n\r", "SBFOnce") && (retries > 0))
{
systemPrintln("No response from mosaic. Retrying - with escape sequence...");
sendWithResponse("SSSSSSSSSSSSSSSSSSSS\n\r", "COM4>"); // Send escape sequence
Expand All @@ -106,9 +106,9 @@ void beginGNSS()
// Module could be stuck in "Ready for SUF Download ...". Send a soft reset to unstick it
sendWithResponse("erst,soft,none\n\r", "ResetReceiver");

retries = 20;
retries = 30;

while (!sendWithResponse("esoc, COM1, IPStatus\n\r", "SBFOnce") && (retries > 0))
while (!sendWithResponse("esoc, COM1, IPStatus+ReceiverSetup\n\r", "SBFOnce") && (retries > 0))
{
systemPrintln("No response from mosaic. Retrying - with escape sequence...");
sendWithResponse("SSSSSSSSSSSSSSSSSSSS\n\r", "COM4>"); // Send escape sequence
Expand All @@ -123,7 +123,7 @@ void beginGNSS()
}

if (!inMainMenu)
systemPrintln("GNSS online. IPStatus requested");
systemPrintln("GNSS online. IPStatus+ReceiverSetup requested");
online.gnss = true;
}

Expand Down
21 changes: 18 additions & 3 deletions Firmware/GNSSDO_Firmware/GNSSDO_Firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
mosaic COM3 TX (TX3) to ESP32 GPIO 34
mosaic COM3 RX (RX3) to ESP32 GPIO 23
1.2: Add support for SiT5811 and STP3593LF oscillators
1.3: Enable Ethernet by default
1.4: Include a soft reset to work around "Ready for SUF Download"
1.5: Print an ERROR if the display is not detected, but allow firmware to continue
Print mosaic-T version, S/N, Ethernet MAC + IP in menuMain
Store previousIP in NVM - updated once per hour
Print oscillator type in menuMain
*/

// This is passed in from compiler extra flags
Expand Down Expand Up @@ -136,8 +142,14 @@ uint8_t gnssError = 255; // Unknown
double gnssClockBias_ms = 0.0;

// IPStatus 4058
uint8_t ethernetMACAddress[6] = { 0,0,0,0,0,0 }; // Display this address in the system menu
IPAddress gnssIP = IPAddress((uint32_t)0);

// ReceiverSetup 5902
char RxSerialNumber[21] = {0};
char RxVersion[21] = {0};
char ProductName[41] = {0};

// FugroTimeOffset 4255
// fugroTimeSystem fugroTimeSystems[] is in settings.h

Expand Down Expand Up @@ -209,6 +221,8 @@ DisplayType displayType = DISPLAY_MAX_NONE;
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GNSSDO_TCXO *myTCXO;

char oscillatorType[20] = {0};

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Low frequency tasks
Expand All @@ -230,8 +244,8 @@ const int buttonTaskStackSize = 2000;

// Global variables
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
uint8_t wifiMACAddress[6]; // Display this address in the system menu
char deviceName[70]; // The serial string that is broadcast. Ex: 'Surveyor Base-BC61'
uint8_t wifiMACAddress[6] = { 0,0,0,0,0,0 }; // Display this address in the system menu
char deviceName[70];
const uint16_t menuTimeout = 60 * 10; // Menus will exit/timeout after this number of seconds
int systemTime_minutes = 0; // Used to test if logging is less than max minutes
bool inMainMenu = false; // Set true when in the serial config menu system.
Expand Down Expand Up @@ -391,7 +405,8 @@ void setup()
systemPrintf("Boot time: %d\r\n", millis());

if (settings.enableTCPServer)
systemPrintf("TCP Server is enabled. Please connect on port %d to view the console\r\n", settings.tcpServerPort);
systemPrintf("TCP Server is enabled. Please connect on port %d to view the console\r\n",
settings.tcpServerPort);

beginConsole(115200, true); // Swap to Alt pins if TCP is enabled
}
Expand Down
3 changes: 3 additions & 0 deletions Firmware/GNSSDO_Firmware/NVM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ void recordSystemSettingsToFile(File *settingsFile)
settingsFile->printf("%s=%d\r\n", "preferNonCompositeGalileoBias", settings.preferNonCompositeGalileoBias);
settingsFile->printf("%s=%d\r\n", "enableTCPServer", settings.enableTCPServer);
settingsFile->printf("%s=%d\r\n", "tcpServerPort", settings.tcpServerPort);
settingsFile->printf("%s=%d\r\n", "previousIP", settings.previousIP);


//settingsFile->printf("%s=%d\r\n", "", settings.);
Expand Down Expand Up @@ -376,6 +377,8 @@ bool parseLine(char *str, Settings *settings)
settings->enableTCPServer = d;
else if (strcmp(settingName, "tcpServerPort") == 0)
settings->tcpServerPort = d;
else if (strcmp(settingName, "previousIP") == 0)
settings->previousIP = d;

//else if (strcmp(settingName, "") == 0)
// settings-> = d;
Expand Down
3 changes: 3 additions & 0 deletions Firmware/GNSSDO_Firmware/States.ino
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ void updateSystemState()
{
tcxoUpdates = 0;
settings.tcxoControl = getFrequencyControlWord();

settings.previousIP = gnssIP;

recordSystemSettings();

systemPrint("TCXO Control Word saved to LFS: ");
Expand Down
8 changes: 8 additions & 0 deletions Firmware/GNSSDO_Firmware/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,20 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
}
else if ((parse->message & 0x1FFF) == 4058) // IPStatus
{
for (int i = 0; i < 6; i++)
ethernetMACAddress[i] = parse->buffer[i + 14];
uint32_t theIP = ((uint32_t)parse->buffer[32]) << 0;
theIP |= ((uint32_t)parse->buffer[33]) << 8;
theIP |= ((uint32_t)parse->buffer[34]) << 16;
theIP |= ((uint32_t)parse->buffer[35]) << 24;
gnssIP = IPAddress(theIP);
}
else if ((parse->message & 0x1FFF) == 5902) // ReceiverSetup
{
strncpy(RxSerialNumber, (const char *)&parse->buffer[156], sizeof(RxSerialNumber));
strncpy(RxVersion, (const char *)&parse->buffer[196], sizeof(RxVersion));
strncpy(ProductName, (const char *)&parse->buffer[328], sizeof(ProductName));
}
else if ((parse->message & 0x1FFF) == 4255) // FugroTimeOffset
{
int N = parse->buffer[14]; // Number of FugroTOSub sub-blocks in this block
Expand Down
25 changes: 21 additions & 4 deletions Firmware/GNSSDO_Firmware/menuMain.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@ void menuMain()
systemPrintln();
char versionString[21];
getFirmwareVersion(versionString, sizeof(versionString));
systemPrintf("SparkPNT %s %s\r\n", platformPrefix, versionString);
systemPrintf("SparkPNT %s Firmware %s\r\n", platformPrefix, versionString);

systemPrint("ESP32 WiFi MAC Address: ");
systemPrintf("%02X:%02X:%02X:%02X:%02X:%02X\r\n", wifiMACAddress[0], wifiMACAddress[1], wifiMACAddress[2],
wifiMACAddress[3], wifiMACAddress[4], wifiMACAddress[5]);

systemPrintf("Oscillator: %s\r\n", oscillatorType);

systemPrintf("GNSS: %s version %s S/N %s\r\n", ProductName, RxVersion, RxSerialNumber);

systemPrint("Ethernet MAC Address: ");
systemPrintf("%02X:%02X:%02X:%02X:%02X:%02X\r\n", ethernetMACAddress[0], ethernetMACAddress[1], ethernetMACAddress[2],
ethernetMACAddress[3], ethernetMACAddress[4], ethernetMACAddress[5]);

systemPrintf("Previous IP address: %s\r\n", IPAddress(settings.previousIP).toString().c_str());

systemPrintf("Current IP address: %s\r\n", gnssIP.toString().c_str());

if (settings.enableTCPServer)
systemPrintf("TCP Server is enabled: TCP Port %d\r\n", settings.tcpServerPort);

// Display the uptime
uint64_t uptimeMilliseconds = millis();
uint32_t uptimeDays = 0;
Expand All @@ -46,13 +61,14 @@ void menuMain()
uptimeSeconds = uptimeMilliseconds / MILLISECONDS_IN_A_SECOND;
uptimeMilliseconds %= MILLISECONDS_IN_A_SECOND;

systemPrint("System Uptime: ");
systemPrint("System Uptime: ");
systemPrintf("%d %02d:%02d:%02d.%03lld\r\n", uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds,
uptimeMilliseconds);

systemPrintf("Rejected by parser: %d NMEA / %d RTCM / %d SBF\r\n", failedParserMessages_NMEA,
systemPrintf("Rejected by parser: %d NMEA / %d RTCM / %d SBF\r\n", failedParserMessages_NMEA,
failedParserMessages_RTCM, failedParserMessages_SBF);

systemPrintln();
systemPrintln("Menu: Main");

systemPrintln("c) Configure operation");
Expand Down Expand Up @@ -94,7 +110,8 @@ void menuMain()
configureGNSSTCPServer(); // Configure TCP

if (settings.enableTCPServer)
systemPrintf("TCP Server is enabled. Please connect on port %d to view the console\r\n", settings.tcpServerPort);
systemPrintf("TCP Server is enabled. Please connect on %s:%d to view the console\r\n",
gnssIP.toString().c_str(), settings.tcpServerPort);

beginConsole(115200, true); // Swap to Alt pins if TCP is enabled

Expand Down
1 change: 1 addition & 0 deletions Firmware/GNSSDO_Firmware/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ typedef struct
bool preferNonCompositeGalileoBias = false; // Prefer non-composite Galileo bias - if available. Mutex with preferNonCompositeGPSBias
bool enableTCPServer = false; // Enable and configure mosaic-T IPS1 for TCP2way for the ESP32 console
uint16_t tcpServerPort = 28785;
uint32_t previousIP = 0; // Store the previous IP address

// Add new settings above <------------------------------------------------------------>

Expand Down

0 comments on commit d2609c8

Please sign in to comment.