-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
waiting for feedbackWaiting on additional info. If it's not received, the issue may be closed.Waiting on additional info. If it's not received, the issue may be closed.
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: [ESP-12]
- Core Version: [latest git hash or date]
- Development Env: [Arduino IDE 1.8.9]
- Operating System: [MacOS]
Settings in IDE
- Module: [Generic ESP8266 Module and Adafruit Feather Huzzah]
- Flash Mode: [qio]
- Flash Size: [4MB/1MB]
- lwip Variant: [v1.4|v2 Lower Memory|Higher Bandwidth]
- Reset Method: [ck|nodemcu]
- Flash Frequency: [80Mhz]
- CPU Frequency: [80Mhz]
- Upload Using: [SERIAL]
- Upload Speed: [921600] (serial upload only)
Problem Description
After updating to 2.5.1, data that gets pushed to an existing file on the SD-Card via
file.println(data); gets no longer added below the last line in the file, but replaces the whole file content. So only the last data, that was pushed to the file, stays there.
I was not able to figure out whether the whole file is replaced or only the content.
Same issue with short and long file name.
Examples to reproduce the Error: SD/Datalogger or SD/ReadWrite
Or the one below.
Output on Serial Monitor at readout should be:
test.txt:
testing 1, 2, 3.
testing 4, 5, 6.
But only is:
test.txt:
testing 1, 2, 3.
#include <SPI.h>
#include <SD.h>
File myFile;
void setup() {
Serial.begin(9600);
while (!Serial) {
}
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
myFile = SD.open("test.txt", FILE_WRITE);
if (myFile) {
myFile.println("testing 1, 2, 3.");
myFile.close();
myFile.println("testing 4, 5, 6.");
myFile.close();
Serial.println("done.");
}
else {
Serial.println("error opening test.txt");
}
// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");
// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}
void loop() {
// nothing happens after setup
}
Debug Messages
none
Metadata
Metadata
Assignees
Labels
waiting for feedbackWaiting on additional info. If it's not received, the issue may be closed.Waiting on additional info. If it's not received, the issue may be closed.