You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please post a complete MCVE, the small snippet is not enough for anyone else to run anything. Also, try running with full debugging options and catch the logs. Sometimes, especially with Strings, there are out of memory issues which don't cause the app to crash, but which to end up corrupting Strings.
After some debugging found that just before writing to file (SPIFFS here), the contents of the String is as expected (ending with 1\r\n). however after reading the file, for some unknown reason, the 1\r\n is manifested as ÿÿÿ (3 times 0xFF).
After replacing the (deprecated) SPIFFS with LIttleFS the phenomenon has disappeared
Basic Infos
Platform
Settings in IDE
Problem Description
Simple add to String variable results in saving garbage to file
MCVE Sketch
Code below adds "1\r\n" or "0\r\n" to String_to_Save String.
if (Irms > Log_threshold){
String_to_Save += "1\r\n";
}else{
String_to_Save += "0\r\n";
}
Saved String however sometimes looks like this:
Where:
is expected. for some unknown reason the "1\r\n" part is lost and "ÿÿÿ" (3 times value 255) is saved instead
When compiling and tested with 2.7.4 it functions as expected, with 3.0.0 results in described issue above
below complete sample:
Debug Messages
none
The text was updated successfully, but these errors were encountered: