1) "sometimes random crashing the whole system. But that's the least of my concerns", as a "Software Engineer", this should be a main concern. 2) "f.size() is
310831
", read [ESP32 DRAM memory allocation](
docs.espressif.com/projects/esp-idf/en/latest/esp32/…) to understand how much memory in total available on ESP32. 3) The
do...loop
with String concatenation is basically allocating more heap on each loop and causing heap fragmentation. Even you can make your code works, but it will not be stable and will crash at some point of time... —
hcheung 47 secs ago