I have create antoher function goToVolumeWorkingDirectory() to move into the Volume Working Directory, where the log.jsonl file will be created to save the log (json format)
I am surpise to see that the file is create in /LOG/2024/7/5/log.jsonl and the log is saved there. But...
I solved my problem, but honestly I do not know how
I corrected the @david_2018 observation, but I am not sure this cause the issue.
However, I modify this
int defineVolumeWorkingDirectory()
{
DateTime now = rtc.now();
int16_t yy = now.year(); // Save the year
int16_t mm = now.month(); // Save the month
int16_t dd = now.day(); // Save the day
sprintf(sd_pathLog,"/LOG/%i/%i/%i/",yy,mm,dd); // sd_pathLog is a global variable
return volumeWorkingDirectory(false);
}
to
int defineVolumeWorkingDirectory()
{
sprintf(sd_pathLog,"/LOG/%i/%i/%i",y,m,d); // sd_pathLog is a global variable
return volumeWorkingDirectory(false);
}
y,m and d are global variable used all around my code RtcInterval update thoses global variable at each loop()
I also removed the last / at sd_pathLog.
PS: I removed the function defineVolumeWorkingDirectory() and printf(sd_pathLog,"/LOG/%i/%i/%i",y,m,d); is now in checkVolumeWorkingDirectory(). In that way, after midnight, the log are saved into the next day folder.
The semicolon after the if statement on line 433 ends the if statement (in effect, if b is equal to false, then do nothing).
The bracketed code on lines 434 through 441 is executed unconditionally, regardless of the value of b.