ESP32 Arduino Core: 2.0.5
Arduino IDE 2.0.4
I am working on a data logging system with ESP32 + SD Card. Using the function SD_MMC.file.println() to save data to SD data.
My code is working but there is intermittent data corruption problem.
Pseudo code is :
Code: Select all
#include "SD_MMC.h"
///...
File archive = fs.open("/dat.txt", FILE_WRITE);
while(sensor_is_active){
String data = readSensor();
char *p_char = data.c_str();
archive.println(p_char);
}
How to improve the code to safeguard the data integrity?
I am wondering, is it necessary to partition my data to 512byte buffer before using println()?
John