Skip to content

Commit 7a9c654

Browse files
committed
Disable NMEA sentences on I2C, UART, and SPI port. Add more checks for SD presence before checking semaphore.
NMEA is already turned off on I2C port in general, but turn off specific sentences to try to reduce ZED-F9x module processing.
1 parent 91f426f commit 7a9c654

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

Firmware/RTK_Surveyor/Form.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ void startConfigAP()
142142
#ifdef COMPILE_WIFI
143143
static void handleFirmwareFileUpload(AsyncWebServerRequest *request, String fileName, size_t index, uint8_t *data, size_t len, bool final)
144144
{
145+
if(online.microSD == false)
146+
{
147+
Serial.println(F("No SD card available"));
148+
return;
149+
}
150+
145151
//Attempt to write to file system. This avoids collisions with file writing in F9PSerialReadTask()
146152
if (xSemaphoreTake(xFATSemaphore, fatSemaphore_longWait_ms) != pdPASS) {
147153
Serial.println(F("Failed to get file system lock on firmware file"));

Firmware/RTK_Surveyor/System.ino

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,15 @@ bool configureUbloxModule()
211211

212212
response &= configureGNSSMessageRates(COM_PORT_UART1, settings.ubxMessages); //Make sure the appropriate messages are enabled
213213

214+
response &= disableNMEASentences(COM_PORT_I2C); //Disable NMEA messages on all but UART1
215+
response &= disableNMEASentences(COM_PORT_UART2);
216+
response &= disableNMEASentences(COM_PORT_SPI);
217+
214218
response &= i2cGNSS.setAutoPVT(true, false); //Tell the GPS to "send" each solution, but do not update stale data when accessed
215219
response &= i2cGNSS.setAutoHPPOSLLH(true, false); //Tell the GPS to "send" each high res solution, but do not update stale data when accessed
216220

217221
if (zedModuleType == PLATFORM_F9R)
218-
{
219222
response &= i2cGNSS.setAutoESFSTATUS(true, false); //Tell the GPS to "send" each ESF Status, but do not update stale data when accessed
220-
}
221223

222224
if (getSerialRate(COM_PORT_UART1) != settings.dataPortBaud)
223225
{
@@ -248,8 +250,6 @@ bool configureUbloxModule()
248250
return (response);
249251
}
250252

251-
252-
253253
//Disable all the NMEA sentences on a given com port
254254
bool disableNMEASentences(uint8_t portType)
255255
{
@@ -597,6 +597,12 @@ bool createTestFile()
597597
SdFile testFile;
598598
char testFileName[40] = "testfile.txt";
599599

600+
if(online.microSD == false)
601+
{
602+
Serial.println(F("SD card offline"));
603+
return(false);
604+
}
605+
600606
//Attempt to write to file system. This avoids collisions with file writing from other functions like recordSystemSettingsToFile() and F9PSerialReadTask()
601607
if (xSemaphoreTake(xFATSemaphore, fatSemaphore_shortWait_ms) == pdPASS)
602608
{

Firmware/RTK_Surveyor/menuMain.ino

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,20 @@ void factoryReset()
107107
eepromErase();
108108

109109
//Assemble settings file name
110-
char settingsFileName[40]; //SFE_Surveyor_Settings.txt
110+
char settingsFileName[40]; //SFE_Express_Plus_Settings.txt
111111
strcpy(settingsFileName, platformFilePrefix);
112112
strcat(settingsFileName, "_Settings.txt");
113113

114114
//Attempt to write to file system. This avoids collisions with file writing from other functions like recordSystemSettingsToFile() and F9PSerialReadTask()
115-
if (xSemaphoreTake(xFATSemaphore, fatSemaphore_longWait_ms) == pdPASS)
115+
if (settings.enableSD && online.microSD)
116116
{
117-
if (sd.exists(settingsFileName))
118-
sd.remove(settingsFileName);
119-
xSemaphoreGive(xFATSemaphore);
120-
} //End xFATSemaphore
117+
if (xSemaphoreTake(xFATSemaphore, fatSemaphore_longWait_ms) == pdPASS)
118+
{
119+
if (sd.exists(settingsFileName))
120+
sd.remove(settingsFileName);
121+
xSemaphoreGive(xFATSemaphore);
122+
} //End xFATSemaphore
123+
}
121124

122125
i2cGNSS.factoryReset(); //Reset everything: baud rate, I2C address, update rate, everything.
123126

0 commit comments

Comments
 (0)