this just fixed the write speed issue

This commit is contained in:
theFeiter 2022-07-08 11:33:46 +02:00
parent 83c11c27ed
commit d8317daf83

View File

@ -180,17 +180,13 @@ void sendSD(const char filename[32]) {
DBG("Logging to SD card."); DBG("Logging to SD card.");
File logfile = SD.open(filename, FILE_WRITE); File logfile = SD.open(filename, FILE_WRITE);
for (int i = 0; i < ln; i++) { for (int i = 0; i < ln; i++) {
char linebuf[32];
#ifdef USE_WIFI #ifdef USE_WIFI
logfile.print(timeClient.getEpochTime()); sprintf(linebuf, "%ld,%d,%d,%g",timeClient.getEpochTime(),theData[i].id,theData[i].t,theData[i].d);
#else #else
logfile.print(seconds_since_reset); sprintf(linebuf, "%ld,%d,%d,%g",seconds_since_reset,theData[i].id,theData[i].t,theData[i].d);
#endif #endif
logfile.print(","); logfile.println(linebuf);
logfile.print(theData[i].id);
logfile.print(",");
logfile.print(theData[i].t);
logfile.print(",");
logfile.println(theData[i].d);
} }
logfile.close(); logfile.close();
#endif #endif
@ -200,17 +196,13 @@ void sendFS(const char filename[32]) {
DBG("Logging to internal flash."); DBG("Logging to internal flash.");
File logfile = LittleFS.open(filename, "a"); File logfile = LittleFS.open(filename, "a");
for (int i = 0; i < ln; i++) { for (int i = 0; i < ln; i++) {
char linebuf[32];
#ifdef USE_WIFI #ifdef USE_WIFI
logfile.print(timeClient.getEpochTime()); sprintf(linebuf, "%ld,%d,%d,%g",timeClient.getEpochTime(),theData[i].id,theData[i].t,theData[i].d);
#else #else
logfile.print(seconds_since_reset); sprintf(linebuf, "%ld,%d,%d,%g",seconds_since_reset,theData[i].id,theData[i].t,theData[i].d);
#endif #endif
logfile.print(","); logfile.println(linebuf);
logfile.print(theData[i].id);
logfile.print(",");
logfile.print(theData[i].t);
logfile.print(",");
logfile.println(theData[i].d);
} }
logfile.close(); logfile.close();
#endif #endif