mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-10 07:10:42 +00:00
filename defined on function call
This commit is contained in:
parent
2b14e3171b
commit
50500d0188
@ -83,4 +83,4 @@
|
||||
|
||||
// SD card logging config -- Needed only for SD-card logging
|
||||
#define SD_SS 0 //SD card Chipselect pin (Use a different pins for LoRa and SD)
|
||||
#define SD_FILENAME "fdrs_log.txt"
|
||||
#define SD_FILENAME "fdrs_log.csv" // length max. 32
|
@ -173,10 +173,10 @@ void getSerial() {
|
||||
|
||||
}
|
||||
}
|
||||
void logToSD() {
|
||||
void logToSD(char filename[32]) {
|
||||
#ifdef USE_SD_LOG
|
||||
DBG("Logging to SD card.");
|
||||
File logfile = SD.open(SD_FILENAME, FILE_WRITE);
|
||||
File logfile = SD.open(filename, FILE_WRITE);
|
||||
for (int i = 0; i < ln; i++) {
|
||||
logfile.print(tenths_of_a_second_since_reset/10.0);
|
||||
logfile.print(",");
|
||||
@ -184,7 +184,7 @@ void logToSD() {
|
||||
logfile.print(",");
|
||||
logfile.print(theData[i].t);
|
||||
logfile.print(",");
|
||||
logfile.print(theData[i].d);
|
||||
logfile.println(theData[i].d);
|
||||
}
|
||||
logfile.close();
|
||||
#endif
|
||||
@ -249,7 +249,7 @@ void mqtt_publish(const char* payload){
|
||||
#ifdef USE_WIFI
|
||||
if(!client.publish(TOPIC_DATA, payload)){
|
||||
DBG(" Error on sending MQTT");
|
||||
logToSD();
|
||||
logToSD(SD_FILENAME);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user