Skip to content

Commit cb97b2a

Browse files
Allow to delete the current active file if ADC is not recording
1 parent 36330e3 commit cb97b2a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Software/Microcontroller/Firmware/AsgardADC/AsgardADC.ino

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,8 @@ endread:
682682
// --------------------------------------------------
683683
// #11 - LCS - LOG_CURRENTFILE_SET --> Reply LCA - LOG_CURRENTFILE_ASSERT
684684
// --------------------------------------------------
685-
// Set the current log file to the LOG.CSV
686-
// $LCS,LOG1.CSV
685+
// Set the current log file to the LOG-01.CSV
686+
// $LCS,LOG-01.CSV
687687

688688
if (!strcmp(command, "$LCS"))
689689
{
@@ -921,8 +921,11 @@ endread:
921921
{
922922
strcpy (Answer, "$FMA,DEL");
923923
if (!isSDCardPresent) goto endeval;
924-
if (strcmp(param, AirDataComputer._logfile)) { // The file must not be the default log file
925-
SD.remove(param);
924+
if (!strcmp(param, AirDataComputer._logfile) && (sendtosd_freq == 0)) { // current file
925+
dataFile.close(); // Close the current file (if is not recording)
926+
}
927+
if ((!strcmp(param, AirDataComputer._logfile) && (sendtosd_freq == 0)) || strcmp(param, AirDataComputer._logfile)) {
928+
SD.remove(param); // Delete the file
926929
if (!(SD.exists(param)))
927930
{
928931
strcat (Answer, SEPARATOR);

0 commit comments

Comments
 (0)