Skip to content

Commit bf8ac32

Browse files
committed
Disable UART2 tasks, close SD before factory reset
1 parent 31b312a commit bf8ac32

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

Firmware/RTK_Surveyor/menuMain.ino

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -289,31 +289,13 @@ void factoryReset()
289289
{
290290
displaySytemReset(); //Display friendly message on OLED
291291

292+
stopUART2Tasks();
293+
294+
endSD(false, false); //Disable SD card use
295+
292296
Serial.println("Formatting file system...");
293297
LittleFS.format();
294298

295-
//Attempt to write to file system. This avoids collisions with file writing from other functions like recordSystemSettingsToFile() and F9PSerialReadTask()
296-
if (settings.enableSD && online.microSD)
297-
{
298-
if (xSemaphoreTake(sdCardSemaphore, fatSemaphore_longWait_ms) == pdPASS)
299-
{
300-
//Remove this specific settings file. Don't remove the other profiles.
301-
sd->remove(settingsFileName);
302-
303-
sd->remove(stationCoordinateECEFFileName); //Remove station files
304-
sd->remove(stationCoordinateGeodeticFileName);
305-
306-
xSemaphoreGive(sdCardSemaphore);
307-
} //End sdCardSemaphore
308-
else
309-
{
310-
//An error occurs when a settings file is on the microSD card and it is not
311-
//deleted, as such the settings on the microSD card will be loaded when the
312-
//RTK reboots, resulting in failure to achieve the factory reset condition
313-
Serial.printf("sdCardSemaphore failed to yield, menuMain.ino line %d\r\n", __LINE__);
314-
}
315-
}
316-
317299
if (online.gnss == true)
318300
i2cGNSS.factoryReset(); //Reset everything: baud rate, I2C address, update rate, everything.
319301

0 commit comments

Comments
 (0)