Skip to content

Commit 5ea54f9

Browse files
committed
Store previousIP. Print previous and current IP in menuMain
Print RX name, version and S/N in menuMain Print oscillatorType in menuMain
1 parent e2cc598 commit 5ea54f9

File tree

8 files changed

+64
-13
lines changed

8 files changed

+64
-13
lines changed

Firmware/GNSSDO_Firmware/Begin.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ void beginTCXO(TwoWire *i2cBus)
535535
}
536536

537537
systemPrintln("Using STP3593LF OCXO");
538+
strncpy(oscillatorType, "STP3593LF OCXO", sizeof(oscillatorType));
538539
}
539540
else if (presentSIT5811)
540541
{
@@ -553,6 +554,7 @@ void beginTCXO(TwoWire *i2cBus)
553554
}
554555

555556
systemPrintln("Using SiT5811 OCXO");
557+
strncpy(oscillatorType, "SiT5811 OCXO", sizeof(oscillatorType));
556558
}
557559
else if (presentSIT5358)
558560
{
@@ -571,10 +573,12 @@ void beginTCXO(TwoWire *i2cBus)
571573
}
572574

573575
systemPrintln("Using SiT5358 TCXO");
576+
strncpy(oscillatorType, "SiT5358 TCXO", sizeof(oscillatorType));
574577
}
575578
else
576579
{
577580
// No TCXO present!
581+
strncpy(oscillatorType, "NONE", sizeof(oscillatorType));
578582
return;
579583
}
580584

Firmware/GNSSDO_Firmware/GNSS.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ bool sendWithResponse(String message, const char *reply, unsigned long timeout,
8484
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8585

8686
// Begin GNSS
87-
// Ensure GNSS is communicating on COM4. Request IPStatus
87+
// Ensure GNSS is communicating on COM4. Request IPStatus+ReceiverSetup
8888
void beginGNSS()
8989
{
9090
if (!inMainMenu)
91-
systemPrintln("Begin GNSS - requesting IPStatus");
91+
systemPrintln("Begin GNSS - requesting IPStatus+ReceiverSetup");
9292

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

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

109-
retries = 20;
109+
retries = 30;
110110

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

125125
if (!inMainMenu)
126-
systemPrintln("GNSS online. IPStatus requested");
126+
systemPrintln("GNSS online. IPStatus+ReceiverSetup requested");
127127
online.gnss = true;
128128
}
129129

Firmware/GNSSDO_Firmware/GNSSDO_Firmware.ino

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
mosaic COM3 TX (TX3) to ESP32 GPIO 34
2121
mosaic COM3 RX (RX3) to ESP32 GPIO 23
2222
1.2: Add support for SiT5811 and STP3593LF oscillators
23+
1.3: Enable Ethernet by default
24+
1.4: Include a soft reset to work around "Ready for SUF Download"
25+
1.5: Print an ERROR if the display is not detected, but allow firmware to continue
26+
Print mosaic-T version, S/N, Ethernet MAC + IP in menuMain
27+
Store previousIP in NVM - updated once per hour
28+
Print oscillator type in menuMain
2329
*/
2430

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

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

148+
// ReceiverSetup 5902
149+
char RxSerialNumber[21] = {0};
150+
char RxVersion[21] = {0};
151+
char ProductName[41] = {0};
152+
141153
// FugroTimeOffset 4255
142154
// fugroTimeSystem fugroTimeSystems[] is in settings.h
143155

@@ -209,6 +221,8 @@ DisplayType displayType = DISPLAY_MAX_NONE;
209221
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
210222
GNSSDO_TCXO *myTCXO;
211223

224+
char oscillatorType[20] = {0};
225+
212226
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
213227

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

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

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

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

Firmware/GNSSDO_Firmware/NVM.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ void recordSystemSettingsToFile(File *settingsFile)
101101
settingsFile->printf("%s=%d\r\n", "preferNonCompositeGalileoBias", settings.preferNonCompositeGalileoBias);
102102
settingsFile->printf("%s=%d\r\n", "enableTCPServer", settings.enableTCPServer);
103103
settingsFile->printf("%s=%d\r\n", "tcpServerPort", settings.tcpServerPort);
104+
settingsFile->printf("%s=%d\r\n", "previousIP", settings.previousIP);
104105

105106

106107
//settingsFile->printf("%s=%d\r\n", "", settings.);
@@ -376,6 +377,8 @@ bool parseLine(char *str, Settings *settings)
376377
settings->enableTCPServer = d;
377378
else if (strcmp(settingName, "tcpServerPort") == 0)
378379
settings->tcpServerPort = d;
380+
else if (strcmp(settingName, "previousIP") == 0)
381+
settings->previousIP = d;
379382

380383
//else if (strcmp(settingName, "") == 0)
381384
// settings-> = d;

Firmware/GNSSDO_Firmware/States.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ void updateSystemState()
147147
{
148148
tcxoUpdates = 0;
149149
settings.tcxoControl = getFrequencyControlWord();
150+
151+
settings.previousIP = gnssIP;
152+
150153
recordSystemSettings();
151154

152155
systemPrint("TCXO Control Word saved to LFS: ");

Firmware/GNSSDO_Firmware/Tasks.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,12 +662,20 @@ void processConsumerMessage(PARSE_STATE *parse, uint8_t type)
662662
}
663663
else if ((parse->message & 0x1FFF) == 4058) // IPStatus
664664
{
665+
for (int i = 0; i < 6; i++)
666+
ethernetMACAddress[i] = parse->buffer[i + 14];
665667
uint32_t theIP = ((uint32_t)parse->buffer[32]) << 0;
666668
theIP |= ((uint32_t)parse->buffer[33]) << 8;
667669
theIP |= ((uint32_t)parse->buffer[34]) << 16;
668670
theIP |= ((uint32_t)parse->buffer[35]) << 24;
669671
gnssIP = IPAddress(theIP);
670672
}
673+
else if ((parse->message & 0x1FFF) == 5902) // ReceiverSetup
674+
{
675+
strncpy(RxSerialNumber, (const char *)&parse->buffer[156], sizeof(RxSerialNumber));
676+
strncpy(RxVersion, (const char *)&parse->buffer[196], sizeof(RxVersion));
677+
strncpy(ProductName, (const char *)&parse->buffer[328], sizeof(ProductName));
678+
}
671679
else if ((parse->message & 0x1FFF) == 4255) // FugroTimeOffset
672680
{
673681
int N = parse->buffer[14]; // Number of FugroTOSub sub-blocks in this block

Firmware/GNSSDO_Firmware/menuMain.ino

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,27 @@ void menuMain()
2121
systemPrintln();
2222
char versionString[21];
2323
getFirmwareVersion(versionString, sizeof(versionString));
24-
systemPrintf("SparkPNT %s %s\r\n", platformPrefix, versionString);
24+
systemPrintf("SparkPNT %s Firmware %s\r\n", platformPrefix, versionString);
2525

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

30+
systemPrintf("Oscillator: %s\r\n", oscillatorType);
31+
32+
systemPrintf("GNSS: %s version %s S/N %s\r\n", ProductName, RxVersion, RxSerialNumber);
33+
34+
systemPrint("Ethernet MAC Address: ");
35+
systemPrintf("%02X:%02X:%02X:%02X:%02X:%02X\r\n", ethernetMACAddress[0], ethernetMACAddress[1], ethernetMACAddress[2],
36+
ethernetMACAddress[3], ethernetMACAddress[4], ethernetMACAddress[5]);
37+
38+
systemPrintf("Previous IP address: %s\r\n", IPAddress(settings.previousIP).toString().c_str());
39+
40+
systemPrintf("Current IP address: %s\r\n", gnssIP.toString().c_str());
41+
42+
if (settings.enableTCPServer)
43+
systemPrintf("TCP Server is enabled: TCP Port %d\r\n", settings.tcpServerPort);
44+
3045
// Display the uptime
3146
uint64_t uptimeMilliseconds = millis();
3247
uint32_t uptimeDays = 0;
@@ -46,13 +61,14 @@ void menuMain()
4661
uptimeSeconds = uptimeMilliseconds / MILLISECONDS_IN_A_SECOND;
4762
uptimeMilliseconds %= MILLISECONDS_IN_A_SECOND;
4863

49-
systemPrint("System Uptime: ");
64+
systemPrint("System Uptime: ");
5065
systemPrintf("%d %02d:%02d:%02d.%03lld\r\n", uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds,
5166
uptimeMilliseconds);
5267

53-
systemPrintf("Rejected by parser: %d NMEA / %d RTCM / %d SBF\r\n", failedParserMessages_NMEA,
68+
systemPrintf("Rejected by parser: %d NMEA / %d RTCM / %d SBF\r\n", failedParserMessages_NMEA,
5469
failedParserMessages_RTCM, failedParserMessages_SBF);
5570

71+
systemPrintln();
5672
systemPrintln("Menu: Main");
5773

5874
systemPrintln("c) Configure operation");
@@ -94,7 +110,8 @@ void menuMain()
94110
configureGNSSTCPServer(); // Configure TCP
95111

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

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

Firmware/GNSSDO_Firmware/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ typedef struct
291291
bool preferNonCompositeGalileoBias = false; // Prefer non-composite Galileo bias - if available. Mutex with preferNonCompositeGPSBias
292292
bool enableTCPServer = false; // Enable and configure mosaic-T IPS1 for TCP2way for the ESP32 console
293293
uint16_t tcpServerPort = 28785;
294+
uint32_t previousIP = 0; // Store the previous IP address
294295

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

0 commit comments

Comments
 (0)