I have recently started getting rid of delay(); statements, and replacing them with short sleeps while waiting for sensor conversions so I can read them. But I have noticed in debugging that this causes clipping in my serial output, because the MCU goes to sleep before it finishes booting out the serial communications. I have fixed this with serial.flush(); statements before the sleeping.
My question is: is this kind of thing also a problem for SD card writing?
Not knowing if I would have the same "clipping problem" or not, I have a bunch of delay statements in place after my SD card writing events, for example:
file.open(FileName, O_RDWR | O_AT_END);
file.print(F("Vcc after new file created: "));file.println(Vcc2);
file.close();
delay(100); //wait till file is really closed?
Can safely I put the MCU to sleep right after the file.close(); event? If not how long should I wait to be safe?