From 61d6556373f86c10529fd9df3e6d045417b28490 Mon Sep 17 00:00:00 2001 From: theFeiter Date: Thu, 7 Jul 2022 00:26:55 +0200 Subject: [PATCH 1/8] create SPIFFS logger function --- FDRS_Gateway/fdrs_functions.h | 41 +++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index 40eb74f..faa4e8d 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -175,7 +175,7 @@ void getSerial() { } } -void SDsend(char filename[32]) { +void send_SD(char filename[32]) { #ifdef USE_SD_LOG DBG("Logging to SD card."); File logfile = SD.open(filename, FILE_WRITE); @@ -195,6 +195,27 @@ void SDsend(char filename[32]) { logfile.close(); #endif } +void send_FS(char filename[32]) { + #ifdef USE_SPIFFS_LOG + DBG("Logging to internal flash."); + File logfile = SPIFFS.open(filename, "a"); + for (int i = 0; i < ln; i++) { + #ifdef USE_WIFI + logfile.print(timeClient.getEpochTime()); + #else + logfile.print(seconds_since_reset); + #endif + logfile.print(","); + logfile.print(theData[i].id); + logfile.print(","); + logfile.print(theData[i].t); + logfile.print(","); + logfile.println(theData[i].d); + } + logfile.close(); + } + #endif +} void reconnect(int attempts, bool silent) { #ifdef USE_WIFI @@ -255,7 +276,8 @@ void mqtt_publish(const char* payload){ #ifdef USE_WIFI if(!client.publish(TOPIC_DATA, payload)){ DBG(" Error on sending MQTT"); - SDsend(SD_FILENAME); + send_SD(SD_FILENAME); + send_FS(SD_FILENAME); } #endif } @@ -646,3 +668,18 @@ void begin_SD(){ } #endif } +void begin_FS(){ + #ifdef USE_SPIFFS_LOG + DBG("Initializing SPIFFS..."); + + if(!SPIFFS.begin()) + { + Serial.println(" initialization failed"); + while (1); + } + else + { + Serial.println(" SPIFFS initialized"); + } + #endif +} From 5624ac30afc94614171500b9b1870fd6790f3f5d Mon Sep 17 00:00:00 2001 From: theFeiter Date: Thu, 7 Jul 2022 00:27:01 +0200 Subject: [PATCH 2/8] create SPIFFS logger function --- FDRS_Gateway/FDRS_Gateway.ino | 3 +++ FDRS_Gateway/fdrs_config.h | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/FDRS_Gateway/FDRS_Gateway.ino b/FDRS_Gateway/FDRS_Gateway.ino index 01acb53..9b798ac 100644 --- a/FDRS_Gateway/FDRS_Gateway.ino +++ b/FDRS_Gateway/FDRS_Gateway.ino @@ -69,6 +69,9 @@ void setup() { #ifdef USE_SD_LOG begin_SD(); #endif +#ifdef USE_SPIFFS_LOG + begin_FS(); +#endif //DBG(sizeof(DataReading)); #ifdef USE_WIFI diff --git a/FDRS_Gateway/fdrs_config.h b/FDRS_Gateway/fdrs_config.h index 9f33a88..2a5c0b2 100644 --- a/FDRS_Gateway/fdrs_config.h +++ b/FDRS_Gateway/fdrs_config.h @@ -19,6 +19,7 @@ //#define USE_LORA //#define USE_WIFI //Used only for MQTT gateway //#define USE_SD_LOG //Used only for SD-card logging +//#define USE_SPIFFS_LOG //Used only for SPIFFS logging (esp internal filesystem) // Peer addresses #define ESPNOW1_PEER 0x0E // ESPNOW1 Address @@ -83,4 +84,7 @@ // 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.csv" // length max. 32 \ No newline at end of file +#define SD_FILENAME "fdrs_log.csv" // length max. 32 + +// SPIFFS logging config -- Needed only for SPIFFS logging +#define SPIFFS_FILENAME "fdrs_log.csv" // length max. 32 \ No newline at end of file From 9d5a1062dc169905b3dd7ad256b812389d14bd13 Mon Sep 17 00:00:00 2001 From: theFeiter Date: Thu, 7 Jul 2022 00:48:58 +0200 Subject: [PATCH 3/8] change filename --- FDRS_Gateway/fdrs_functions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index faa4e8d..518901f 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -277,7 +277,7 @@ void mqtt_publish(const char* payload){ if(!client.publish(TOPIC_DATA, payload)){ DBG(" Error on sending MQTT"); send_SD(SD_FILENAME); - send_FS(SD_FILENAME); + send_FS(SPIFFS_FILENAME); } #endif } From da4b4032463bedba0f6439a7b0b72263ca5152b1 Mon Sep 17 00:00:00 2001 From: theFeiter Date: Thu, 7 Jul 2022 11:42:17 +0200 Subject: [PATCH 4/8] use littlefs since spiffs is deprecated apply some suggestions from the compiler --- FDRS_Gateway/FDRS_Gateway.ino | 5 ++++- FDRS_Gateway/fdrs_config.h | 4 ++-- FDRS_Gateway/fdrs_functions.h | 31 +++++++++++++++---------------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/FDRS_Gateway/FDRS_Gateway.ino b/FDRS_Gateway/FDRS_Gateway.ino index 9b798ac..f7e84f1 100644 --- a/FDRS_Gateway/FDRS_Gateway.ino +++ b/FDRS_Gateway/FDRS_Gateway.ino @@ -30,6 +30,9 @@ #include #include #endif +#ifdef USE_FS_LOG +#include +#endif #include "fdrs_functions.h" void setup() { @@ -69,7 +72,7 @@ void setup() { #ifdef USE_SD_LOG begin_SD(); #endif -#ifdef USE_SPIFFS_LOG +#ifdef USE_FS_LOG begin_FS(); #endif diff --git a/FDRS_Gateway/fdrs_config.h b/FDRS_Gateway/fdrs_config.h index 2a5c0b2..d8cd02e 100644 --- a/FDRS_Gateway/fdrs_config.h +++ b/FDRS_Gateway/fdrs_config.h @@ -19,7 +19,7 @@ //#define USE_LORA //#define USE_WIFI //Used only for MQTT gateway //#define USE_SD_LOG //Used only for SD-card logging -//#define USE_SPIFFS_LOG //Used only for SPIFFS logging (esp internal filesystem) +//#define USE_FS_LOG //Used only for SPIFFS logging (esp internal filesystem) // Peer addresses #define ESPNOW1_PEER 0x0E // ESPNOW1 Address @@ -87,4 +87,4 @@ #define SD_FILENAME "fdrs_log.csv" // length max. 32 // SPIFFS logging config -- Needed only for SPIFFS logging -#define SPIFFS_FILENAME "fdrs_log.csv" // length max. 32 \ No newline at end of file +#define FS_FILENAME "fdrs_log.csv" // length max. 32 \ No newline at end of file diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index 518901f..32233b9 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -175,7 +175,7 @@ void getSerial() { } } -void send_SD(char filename[32]) { +void send_SD(const char filename[32]) { #ifdef USE_SD_LOG DBG("Logging to SD card."); File logfile = SD.open(filename, FILE_WRITE); @@ -195,10 +195,10 @@ void send_SD(char filename[32]) { logfile.close(); #endif } -void send_FS(char filename[32]) { - #ifdef USE_SPIFFS_LOG +void send_FS(const char filename[32]) { + #ifdef USE_FS_LOG DBG("Logging to internal flash."); - File logfile = SPIFFS.open(filename, "a"); + File logfile = LittleFS.open(filename, "a"); for (int i = 0; i < ln; i++) { #ifdef USE_WIFI logfile.print(timeClient.getEpochTime()); @@ -213,15 +213,14 @@ void send_FS(char filename[32]) { logfile.println(theData[i].d); } logfile.close(); - } #endif } -void reconnect(int attempts, bool silent) { +void reconnect(short int attempts, bool silent) { #ifdef USE_WIFI if(!silent) DBG("Connecting MQTT..."); - for (int i = 1; i<=attempts; i++) { + for (short int i = 1; i<=attempts; i++) { // Attempt to connect if (client.connect("FDRS_GATEWAY", mqtt_user, mqtt_pass)) { // Subscribe @@ -230,11 +229,11 @@ void reconnect(int attempts, bool silent) { return; } else { if(!silent) { - char msg[15]; + char msg[23]; sprintf(msg, " Attempt %d/%d",i,attempts); DBG(msg); } - if(attempts=!1){ + if((attempts=!1)){ delay(3000); } } @@ -249,7 +248,7 @@ void reconnect(int attempts){ void mqtt_callback(char* topic, byte * message, unsigned int length) { String incomingString; DBG(topic); - for (int i = 0; i < length; i++) { + for (unsigned int i = 0; i < length; i++) { incomingString += (char)message[i]; } StaticJsonDocument<2048> doc; @@ -277,7 +276,7 @@ void mqtt_publish(const char* payload){ if(!client.publish(TOPIC_DATA, payload)){ DBG(" Error on sending MQTT"); send_SD(SD_FILENAME); - send_FS(SPIFFS_FILENAME); + send_FS(FS_FILENAME); } #endif } @@ -647,7 +646,7 @@ void begin_espnow() { void begin_lora(){ #ifdef USE_LORA DBG("Initializing LoRa!"); - LoRa.setPins(SS, RST, DIO0); + LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0); if (!LoRa.begin(FDRS_BAND)) { DBG(" Initialization failed!"); while (1); @@ -669,17 +668,17 @@ void begin_SD(){ #endif } void begin_FS(){ - #ifdef USE_SPIFFS_LOG - DBG("Initializing SPIFFS..."); + #ifdef USE_FS_LOG + DBG("Initializing LittleFS..."); - if(!SPIFFS.begin()) + if(!LittleFS.begin()) { Serial.println(" initialization failed"); while (1); } else { - Serial.println(" SPIFFS initialized"); + Serial.println(" LittleFS initialized"); } #endif } From d67e831e64c817a68ea9b708dee23356a75c6aa7 Mon Sep 17 00:00:00 2001 From: theFeiter Date: Thu, 7 Jul 2022 11:45:18 +0200 Subject: [PATCH 5/8] Revert "use littlefs since spiffs is deprecated" This reverts commit da4b4032463bedba0f6439a7b0b72263ca5152b1. --- FDRS_Gateway/FDRS_Gateway.ino | 5 +---- FDRS_Gateway/fdrs_config.h | 4 ++-- FDRS_Gateway/fdrs_functions.h | 31 ++++++++++++++++--------------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/FDRS_Gateway/FDRS_Gateway.ino b/FDRS_Gateway/FDRS_Gateway.ino index f7e84f1..9b798ac 100644 --- a/FDRS_Gateway/FDRS_Gateway.ino +++ b/FDRS_Gateway/FDRS_Gateway.ino @@ -30,9 +30,6 @@ #include #include #endif -#ifdef USE_FS_LOG -#include -#endif #include "fdrs_functions.h" void setup() { @@ -72,7 +69,7 @@ void setup() { #ifdef USE_SD_LOG begin_SD(); #endif -#ifdef USE_FS_LOG +#ifdef USE_SPIFFS_LOG begin_FS(); #endif diff --git a/FDRS_Gateway/fdrs_config.h b/FDRS_Gateway/fdrs_config.h index d8cd02e..2a5c0b2 100644 --- a/FDRS_Gateway/fdrs_config.h +++ b/FDRS_Gateway/fdrs_config.h @@ -19,7 +19,7 @@ //#define USE_LORA //#define USE_WIFI //Used only for MQTT gateway //#define USE_SD_LOG //Used only for SD-card logging -//#define USE_FS_LOG //Used only for SPIFFS logging (esp internal filesystem) +//#define USE_SPIFFS_LOG //Used only for SPIFFS logging (esp internal filesystem) // Peer addresses #define ESPNOW1_PEER 0x0E // ESPNOW1 Address @@ -87,4 +87,4 @@ #define SD_FILENAME "fdrs_log.csv" // length max. 32 // SPIFFS logging config -- Needed only for SPIFFS logging -#define FS_FILENAME "fdrs_log.csv" // length max. 32 \ No newline at end of file +#define SPIFFS_FILENAME "fdrs_log.csv" // length max. 32 \ No newline at end of file diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index 32233b9..518901f 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -175,7 +175,7 @@ void getSerial() { } } -void send_SD(const char filename[32]) { +void send_SD(char filename[32]) { #ifdef USE_SD_LOG DBG("Logging to SD card."); File logfile = SD.open(filename, FILE_WRITE); @@ -195,10 +195,10 @@ void send_SD(const char filename[32]) { logfile.close(); #endif } -void send_FS(const char filename[32]) { - #ifdef USE_FS_LOG +void send_FS(char filename[32]) { + #ifdef USE_SPIFFS_LOG DBG("Logging to internal flash."); - File logfile = LittleFS.open(filename, "a"); + File logfile = SPIFFS.open(filename, "a"); for (int i = 0; i < ln; i++) { #ifdef USE_WIFI logfile.print(timeClient.getEpochTime()); @@ -213,14 +213,15 @@ void send_FS(const char filename[32]) { logfile.println(theData[i].d); } logfile.close(); + } #endif } -void reconnect(short int attempts, bool silent) { +void reconnect(int attempts, bool silent) { #ifdef USE_WIFI if(!silent) DBG("Connecting MQTT..."); - for (short int i = 1; i<=attempts; i++) { + for (int i = 1; i<=attempts; i++) { // Attempt to connect if (client.connect("FDRS_GATEWAY", mqtt_user, mqtt_pass)) { // Subscribe @@ -229,11 +230,11 @@ void reconnect(short int attempts, bool silent) { return; } else { if(!silent) { - char msg[23]; + char msg[15]; sprintf(msg, " Attempt %d/%d",i,attempts); DBG(msg); } - if((attempts=!1)){ + if(attempts=!1){ delay(3000); } } @@ -248,7 +249,7 @@ void reconnect(int attempts){ void mqtt_callback(char* topic, byte * message, unsigned int length) { String incomingString; DBG(topic); - for (unsigned int i = 0; i < length; i++) { + for (int i = 0; i < length; i++) { incomingString += (char)message[i]; } StaticJsonDocument<2048> doc; @@ -276,7 +277,7 @@ void mqtt_publish(const char* payload){ if(!client.publish(TOPIC_DATA, payload)){ DBG(" Error on sending MQTT"); send_SD(SD_FILENAME); - send_FS(FS_FILENAME); + send_FS(SPIFFS_FILENAME); } #endif } @@ -646,7 +647,7 @@ void begin_espnow() { void begin_lora(){ #ifdef USE_LORA DBG("Initializing LoRa!"); - LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0); + LoRa.setPins(SS, RST, DIO0); if (!LoRa.begin(FDRS_BAND)) { DBG(" Initialization failed!"); while (1); @@ -668,17 +669,17 @@ void begin_SD(){ #endif } void begin_FS(){ - #ifdef USE_FS_LOG - DBG("Initializing LittleFS..."); + #ifdef USE_SPIFFS_LOG + DBG("Initializing SPIFFS..."); - if(!LittleFS.begin()) + if(!SPIFFS.begin()) { Serial.println(" initialization failed"); while (1); } else { - Serial.println(" LittleFS initialized"); + Serial.println(" SPIFFS initialized"); } #endif } From cb47f6c02e3684ed36a857b0631fde0ff9fbd81b Mon Sep 17 00:00:00 2001 From: theFeiter Date: Thu, 7 Jul 2022 11:49:57 +0200 Subject: [PATCH 6/8] use littlefs since spiffs is deprecated --- FDRS_Gateway/FDRS_Gateway.ino | 5 ++++- FDRS_Gateway/fdrs_config.h | 6 +++--- FDRS_Gateway/fdrs_functions.h | 15 +++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/FDRS_Gateway/FDRS_Gateway.ino b/FDRS_Gateway/FDRS_Gateway.ino index 9b798ac..f7e84f1 100644 --- a/FDRS_Gateway/FDRS_Gateway.ino +++ b/FDRS_Gateway/FDRS_Gateway.ino @@ -30,6 +30,9 @@ #include #include #endif +#ifdef USE_FS_LOG +#include +#endif #include "fdrs_functions.h" void setup() { @@ -69,7 +72,7 @@ void setup() { #ifdef USE_SD_LOG begin_SD(); #endif -#ifdef USE_SPIFFS_LOG +#ifdef USE_FS_LOG begin_FS(); #endif diff --git a/FDRS_Gateway/fdrs_config.h b/FDRS_Gateway/fdrs_config.h index 2a5c0b2..c5d0859 100644 --- a/FDRS_Gateway/fdrs_config.h +++ b/FDRS_Gateway/fdrs_config.h @@ -19,7 +19,7 @@ //#define USE_LORA //#define USE_WIFI //Used only for MQTT gateway //#define USE_SD_LOG //Used only for SD-card logging -//#define USE_SPIFFS_LOG //Used only for SPIFFS logging (esp internal filesystem) +//#define USE_FS_LOG //Used only for SPIFFS logging (esp internal filesystem) // Peer addresses #define ESPNOW1_PEER 0x0E // ESPNOW1 Address @@ -86,5 +86,5 @@ #define SD_SS 0 //SD card Chipselect pin (Use a different pins for LoRa and SD) #define SD_FILENAME "fdrs_log.csv" // length max. 32 -// SPIFFS logging config -- Needed only for SPIFFS logging -#define SPIFFS_FILENAME "fdrs_log.csv" // length max. 32 \ No newline at end of file +// Internal flash logging config -- Needed only for internal flash logging +#define FS_FILENAME "fdrs_log.csv" // length max. 32 \ No newline at end of file diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index 518901f..872d06f 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -196,9 +196,9 @@ void send_SD(char filename[32]) { #endif } void send_FS(char filename[32]) { - #ifdef USE_SPIFFS_LOG + #ifdef USE_FS_LOG DBG("Logging to internal flash."); - File logfile = SPIFFS.open(filename, "a"); + File logfile = LittleFS.open(filename, "a"); for (int i = 0; i < ln; i++) { #ifdef USE_WIFI logfile.print(timeClient.getEpochTime()); @@ -213,7 +213,6 @@ void send_FS(char filename[32]) { logfile.println(theData[i].d); } logfile.close(); - } #endif } void reconnect(int attempts, bool silent) { @@ -277,7 +276,7 @@ void mqtt_publish(const char* payload){ if(!client.publish(TOPIC_DATA, payload)){ DBG(" Error on sending MQTT"); send_SD(SD_FILENAME); - send_FS(SPIFFS_FILENAME); + send_FS(FS_FILENAME); } #endif } @@ -669,17 +668,17 @@ void begin_SD(){ #endif } void begin_FS(){ - #ifdef USE_SPIFFS_LOG - DBG("Initializing SPIFFS..."); + #ifdef USE_FS_LOG + DBG("Initializing LittleFS..."); - if(!SPIFFS.begin()) + if(!LittleFS.begin()) { Serial.println(" initialization failed"); while (1); } else { - Serial.println(" SPIFFS initialized"); + Serial.println(" LittleFS initialized"); } #endif } From d013f38196e814e68f5df7010373b78a3736ccb6 Mon Sep 17 00:00:00 2001 From: theFeiter Date: Thu, 7 Jul 2022 11:59:04 +0200 Subject: [PATCH 7/8] apply some compiler suggestions --- FDRS_Gateway/fdrs_functions.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index 38c3869..1a3fa9d 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -215,12 +215,12 @@ void sendFS(const char filename[32]) { logfile.close(); #endif } -void reconnect(int attempts, bool silent) { +void reconnect(short int attempts, bool silent) { #ifdef USE_WIFI if(!silent) DBG("Connecting MQTT..."); - for (int i = 1; i<=attempts; i++) { + for (short int i = 1; i<=attempts; i++) { // Attempt to connect if (client.connect("FDRS_GATEWAY", mqtt_user, mqtt_pass)) { // Subscribe @@ -229,11 +229,11 @@ void reconnect(int attempts, bool silent) { return; } else { if(!silent) { - char msg[15]; + char msg[23]; sprintf(msg, " Attempt %d/%d",i,attempts); DBG(msg); } - if(attempts=!1){ + if((attempts=!1)){ delay(3000); } } @@ -248,7 +248,7 @@ void reconnect(int attempts){ void mqtt_callback(char* topic, byte * message, unsigned int length) { String incomingString; DBG(topic); - for (int i = 0; i < length; i++) { + for (unsigned int i = 0; i < length; i++) { incomingString += (char)message[i]; } StaticJsonDocument<2048> doc; From d8317daf83333c59252029cda7d112b737f5f320 Mon Sep 17 00:00:00 2001 From: theFeiter Date: Fri, 8 Jul 2022 11:33:46 +0200 Subject: [PATCH 8/8] this just fixed the write speed issue --- FDRS_Gateway/fdrs_functions.h | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/FDRS_Gateway/fdrs_functions.h b/FDRS_Gateway/fdrs_functions.h index 512d078..17e5047 100644 --- a/FDRS_Gateway/fdrs_functions.h +++ b/FDRS_Gateway/fdrs_functions.h @@ -180,17 +180,13 @@ void sendSD(const char filename[32]) { DBG("Logging to SD card."); File logfile = SD.open(filename, FILE_WRITE); for (int i = 0; i < ln; i++) { + char linebuf[32]; #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 - logfile.print(seconds_since_reset); + sprintf(linebuf, "%ld,%d,%d,%g",seconds_since_reset,theData[i].id,theData[i].t,theData[i].d); #endif - logfile.print(","); - logfile.print(theData[i].id); - logfile.print(","); - logfile.print(theData[i].t); - logfile.print(","); - logfile.println(theData[i].d); + logfile.println(linebuf); } logfile.close(); #endif @@ -200,17 +196,13 @@ void sendFS(const char filename[32]) { DBG("Logging to internal flash."); File logfile = LittleFS.open(filename, "a"); for (int i = 0; i < ln; i++) { + char linebuf[32]; #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 - logfile.print(seconds_since_reset); + sprintf(linebuf, "%ld,%d,%d,%g",seconds_since_reset,theData[i].id,theData[i].t,theData[i].d); #endif - logfile.print(","); - logfile.print(theData[i].id); - logfile.print(","); - logfile.print(theData[i].t); - logfile.print(","); - logfile.println(theData[i].d); + logfile.println(linebuf); } logfile.close(); #endif