mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-10 07:10:42 +00:00
this just fixed the write speed issue
This commit is contained in:
parent
83c11c27ed
commit
d8317daf83
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user