You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • No, there shouldn't be a problem with unmounting/re-mounting (there may be a little more SD card wear over just leaving the file open and appending to it though).

    However it does seem to take a while to re-initialise the SD card (also to open the file), during which time Espruino won't be doing anything else (unless you're able to record using Waveform, which uses interrupts), so potentially you could lose data during that time.

    Personally I wouldn't unmount each time because of the above.

    One potential fix might be to use the 'card detect' switch. It's not wired up on the Espruino board, but you could solder it to a GPIO pin. You could use setWatch on it to detect when the card was being ejected and to then close the file, unmount, and stop writing.

    Whether you can do that quick enough not to cause damage to the SD card, I really don't know I'm afraid.

About

Avatar for Gordon @Gordon started