Case 2.1
A slight change to case 2. This time a NOT_READY error instead of a DISK_ERR error.
// fresh restart
>var f = require("fs").readFile("test.txt");
="hello\n\n"
>E.unmountSD();
=undefined
//Removed card and re-inserted without file operation
>var f = require("fs").readFile("test.txt");
ERROR: Unable to mount SD card : NOT_READY
=undefined
Conclusion
Just to check, I just tried 'Case 1' here on the Espruino Board and it works fine - so I'm pretty surprised that yours is different as it's using the same code.
I guess it may be possible that you didn't do a make clean before building with the filesystem enabled, and that meant that somehow reset() didn't reinitialise the SD card?
I did forget to do make clean last time but not this time. For me calling reset() still isn't working
The problem is that jswrap_fs_kill is actually called from reset(), so if that doesn't solve the problem then there's something else...
I think there has to be something else. Using the very latest Github version, calling E.unmountSD() has only managed to change DISK_ERR errors into NOT_READY errors.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon thanks for this addition. I cloned the latest from Git, compiled it and am testing it out. This is what I see:
Case 1.1
A small change to case 1. Instead of
DISK_ERR
errors I'm gettingNOT_READY
errorsCase 2.1
A slight change to case 2. This time a
NOT_READY
error instead of aDISK_ERR
error.Conclusion
I did forget to do
make clean
last time but not this time. For me callingreset()
still isn't workingI think there has to be something else. Using the very latest Github version, calling
E.unmountSD()
has only managed to changeDISK_ERR
errors intoNOT_READY
errors.