Skip to content

Commit 0022b9b

Browse files
committed
Add printGNSSDebugMessages and gnssFactoryDefault
1 parent 0436354 commit 0022b9b

File tree

6 files changed

+65
-3
lines changed

6 files changed

+65
-3
lines changed

Firmware/OpenLog_Artemis/autoDetect.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ bool beginQwiicDevices()
353353
SFE_UBLOX_GNSS *tempDevice = (SFE_UBLOX_GNSS *)temp->classPtr;
354354
struct_uBlox *nodeSetting = (struct_uBlox *)temp->configPtr; //Create a local pointer that points to same spot as node does
355355
if (nodeSetting->powerOnDelayMillis > qwiicPowerOnDelayMillis) qwiicPowerOnDelayMillis = nodeSetting->powerOnDelayMillis; // Increase qwiicPowerOnDelayMillis if required
356+
if(settings.printGNSSDebugMessages == true) tempDevice->enableDebugging(); // Enable debug messages if required
356357
temp->online = tempDevice->begin(qwiic, temp->address); //Wire port, Address
357358
setQwiicPullups(settings.qwiicBusPullUps); //Re-enable pullups.
358359
}
@@ -1206,7 +1207,7 @@ deviceType_e testDevice(uint8_t i2cAddress, uint8_t muxAddress, uint8_t portNumb
12061207
//Confidence: High - Sends/receives CRC checked data response
12071208
setQwiicPullups(0); //Disable pullups to minimize CRC issues
12081209
SFE_UBLOX_GNSS sensor;
1209-
if(settings.printDebugMessages == true) sensor.enableDebugging(); // Enable debug messages if required
1210+
if(settings.printGNSSDebugMessages == true) sensor.enableDebugging(); // Enable debug messages if required
12101211
if (sensor.begin(qwiic, i2cAddress) == true) //Wire port, address
12111212
{
12121213
setQwiicPullups(settings.qwiicBusPullUps); //Re-enable pullups to prevent ghosts at 0x43 onwards

Firmware/OpenLog_Artemis/menuAttachedDevices.ino

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,8 @@ void menuConfigure_uBlox(void *configPtr)
10061006
if (sensorSetting->useAutoPVT == true) SerialPrintln(F("Yes"));
10071007
else SerialPrintln(F("No"));
10081008

1009+
SerialPrintln(F("16) Reset GNSS to factory defaults"));
1010+
10091011
SerialFlush();
10101012
}
10111013
SerialPrintln(F("x) Exit"));
@@ -1051,6 +1053,18 @@ void menuConfigure_uBlox(void *configPtr)
10511053
}
10521054
else if (incoming == 15)
10531055
sensorSetting->useAutoPVT ^= 1;
1056+
else if (incoming == 16)
1057+
{
1058+
SerialPrintln(F("Reset GNSS module to factory defaults. This will take 5 seconds to complete."));
1059+
SerialPrintln(F("Are you sure? Press 'y' to confirm: "));
1060+
byte bContinue = getByteChoice(menuTimeout);
1061+
if (bContinue == 'y')
1062+
{
1063+
gnssFactoryDefault();
1064+
}
1065+
else
1066+
SerialPrintln(F("Reset GNSS aborted"));
1067+
}
10541068
else if (incoming == STATUS_PRESSED_X)
10551069
break;
10561070
else if (incoming == STATUS_GETNUMBER_TIMEOUT)
@@ -1065,7 +1079,6 @@ void menuConfigure_uBlox(void *configPtr)
10651079
else
10661080
printUnknown(incoming);
10671081
}
1068-
10691082
}
10701083

10711084
bool isUbloxAttached()
@@ -1102,6 +1115,9 @@ void getUbloxDateTime(int &year, int &month, int &day, int &hour, int &minute, i
11021115
SFE_UBLOX_GNSS *nodeDevice = (SFE_UBLOX_GNSS *)temp->classPtr;
11031116
struct_uBlox *nodeSetting = (struct_uBlox *)temp->configPtr;
11041117

1118+
//If autoPVT is enabled, flush the data to make sure we get fresh date and time
1119+
if (nodeSetting->useAutoPVT) nodeDevice->flushPVT();
1120+
11051121
//Get latested date/time from GPS
11061122
//These will be extracted from a single PVT packet
11071123
year = nodeDevice->getYear();
@@ -1121,6 +1137,37 @@ void getUbloxDateTime(int &year, int &month, int &day, int &hour, int &minute, i
11211137
}
11221138
}
11231139

1140+
void gnssFactoryDefault(void)
1141+
{
1142+
//Step through node list
1143+
node *temp = head;
1144+
1145+
while (temp != NULL)
1146+
{
1147+
switch (temp->deviceType)
1148+
{
1149+
case DEVICE_GPS_UBLOX:
1150+
{
1151+
setQwiicPullups(0); //Disable pullups to minimize CRC issues
1152+
1153+
SFE_UBLOX_GNSS *nodeDevice = (SFE_UBLOX_GNSS *)temp->classPtr;
1154+
struct_uBlox *nodeSetting = (struct_uBlox *)temp->configPtr;
1155+
1156+
//Reset the module to the factory defaults
1157+
nodeDevice->factoryDefault();
1158+
1159+
delay(5000); //Blocking delay to allow module to reset
1160+
1161+
nodeDevice->setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
1162+
nodeDevice->saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the current ioPortsettings to flash and BBR
1163+
1164+
setQwiicPullups(settings.qwiicBusPullUps); //Re-enable pullups
1165+
}
1166+
}
1167+
temp = temp->next;
1168+
}
1169+
}
1170+
11241171
void menuConfigure_MCP9600(void *configPtr)
11251172
{
11261173
struct_MCP9600 *sensorSetting = (struct_MCP9600*)configPtr;

Firmware/OpenLog_Artemis/menuDebug.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ void menuDebug()
1313
if (settings.resetOnZeroDeviceCount == true) SerialPrintln(F("Enabled"));
1414
else SerialPrintln(F("Disabled"));
1515

16+
SerialPrint(F("3) GNSS Debug Messages: "));
17+
if (settings.printGNSSDebugMessages == true) SerialPrintln(F("Enabled"));
18+
else SerialPrintln(F("Disabled"));
19+
1620
SerialPrintln(F("x) Exit"));
1721

1822
byte incoming = getByteChoice(menuTimeout); //Timeout after x seconds
@@ -42,6 +46,10 @@ void menuDebug()
4246
settings.resetOnZeroDeviceCount ^= 1;
4347
}
4448
}
49+
else if (incoming == '3')
50+
{
51+
settings.printGNSSDebugMessages ^= 1;
52+
}
4553
else if (incoming == 'x')
4654
break;
4755
else if (incoming == STATUS_GETBYTE_TIMEOUT)

Firmware/OpenLog_Artemis/menuTimeStamp.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void menuTimeStamp()
5757
sprintf(rtcHundredths, "0%d", myRTC.hundredths);
5858
else
5959
sprintf(rtcHundredths, "%d", myRTC.hundredths);
60-
sprintf(rtcTime, "%s:%s:%s.%s,", rtcHour, rtcMin, rtcSec, rtcHundredths);
60+
sprintf(rtcTime, "%s:%s:%s.%s", rtcHour, rtcMin, rtcSec, rtcHundredths);
6161

6262
SerialPrintln(rtcTime);
6363

@@ -174,6 +174,8 @@ void menuTimeStamp()
174174
SerialPrint(F("Enter current day (1 to 31): "));
175175
dd = getNumber(menuTimeout); //Timeout after x seconds
176176

177+
myRTC.getTime();
178+
h = myRTC.hour; m = myRTC.minute; s = myRTC.seconds;
177179
myRTC.setTime(0, s, m, h, dd, mm, yy); //Manually set RTC
178180
lastSDFileNameChangeTime = rtcMillis(); // Record the time of the file name change
179181
}

Firmware/OpenLog_Artemis/nvm.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ void recordSystemSettingsToFile()
181181
settingsFile.println("minimumAwakeTimeMillis=" + (String)settings.minimumAwakeTimeMillis);
182182
settingsFile.println("identifyBioSensorHubs=" + (String)settings.identifyBioSensorHubs);
183183
settingsFile.println("serialTxRxDuringSleep=" + (String)settings.serialTxRxDuringSleep);
184+
settingsFile.println("printGNSSDebugMessages=" + (String)settings.printGNSSDebugMessages);
184185
updateDataFileAccess(&settingsFile); // Update the file access time & date
185186
settingsFile.close();
186187
}
@@ -460,6 +461,8 @@ bool parseLine(char* str) {
460461
settings.identifyBioSensorHubs = d;
461462
else if (strcmp(settingName, "serialTxRxDuringSleep") == 0)
462463
settings.serialTxRxDuringSleep = d;
464+
else if (strcmp(settingName, "printGNSSDebugMessages") == 0)
465+
settings.printGNSSDebugMessages = d;
463466
else
464467
{
465468
SerialPrintf2("Unknown setting %s. Ignoring...\r\n", settingName);

Firmware/OpenLog_Artemis/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ struct struct_settings {
424424
unsigned long minimumAwakeTimeMillis = 0; // Set to greater than zero to keep the Artemis awake for this long between sleeps
425425
bool identifyBioSensorHubs = false; // If true, Bio Sensor Hubs (Pulse Oximeters) will be included in autoDetect (requires exclusive use of pins 32 and 11)
426426
bool serialTxRxDuringSleep = false; // If true, the Serial Tx and Rx pins are left enabled during sleep - to prevent the COM port reinitializing
427+
bool printGNSSDebugMessages = false;
427428
} settings;
428429

429430
//These are the devices on board OpenLog that may be on or offline.

0 commit comments

Comments
 (0)