Commit 1558f2fd authored by Patrick's avatar Patrick

include csv headers on new file

parent 7e60ef2a
......@@ -226,8 +226,17 @@ void take_measurement() {
SD.chdir(buff);
// create the day file name
sprintf(buff, "%02d.log", current_reading.d);
uint8_t file_exists = true;
// check if it's a new file and needs headers
if (!SD.exists(buff)) {
file_exists = false;
}
// open DD.log file
myFile = SD.open(buff, FILE_WRITE);
if (file_exists == false) {
// write headers
myFile.println(F("date,time,stage(mm)"));
}
myFile.print(current_reading.y);
myFile.write('-');
if (current_reading.m < 10) { myFile.write('0'); }
......@@ -235,7 +244,7 @@ void take_measurement() {
myFile.write('-');
if (current_reading.d < 10) { myFile.write('0'); }
myFile.print(current_reading.d);
myFile.write('T');
myFile.write(',');
if (current_reading.hh < 10) { myFile.write('0'); }
myFile.print(current_reading.hh);
myFile.write(':');
......@@ -243,7 +252,6 @@ void take_measurement() {
myFile.print(current_reading.mm);
myFile.write(':');
myFile.print("00"); // zero seconds
myFile.write('Z');
myFile.write(',');
myFile.print(temp); // stage in mm
myFile.println();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment