Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Don't create a new file if last file is empty #136
Currently, when operating in the " New file logging " mode, the OpenLog firmware creates a new file each time the OpenLog powers up. Over time, if there are power cycles without any subsequent logging, this leads to the SD card being cluttered with many empty log files.
In order to prevent all these empty log files, another way to handle the power up is to check if the last used file (saved in EEPROM) is empty on the SD card. If the last used file exists on the SD card and its size is zero, then the next log file to use is this empty last used file instead of yet another new file. This also reduces the possible occurrences of the "!Too many logs:" error.
This change in operation can easily be added to the OpenLog firmware's newlog() function by inserting the following lines at line 415 of "OpenLog_v3.ino":
This would add about 130 bytes to the size of the OpenLog firmware.