I have been experimenting with using it for data logging and have been thinking about how to persist the data log into flash so that it will survive powering on and off.
I'm having trouble writing files to flash. Specifically, I've been trying to append a file as recommended on the page Data Collection.
However, the second write always throws an error. I've reduced the code to this:
The Espruino WiFi is a bit oddball in that it only has one page for storage - a 64kB one - so there are no 'unused' pages it can free. If it can't get the contents of that page temporarily into RAM then it can't compact it.
Not sure if that makes any difference.
Am I doing something wrong? Is it simply a bad idea to be using the flash storage on an Espruino WiFi to store a data log? The specs say it has 512kB of flash, I guess the missing 448KB is storing the firmware?
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.
I have an Espruino WiFi flashed with 2v06.
I have been experimenting with using it for data logging and have been thinking about how to persist the data log into flash so that it will survive powering on and off.
I'm having trouble writing files to flash. Specifically, I've been trying to append a file as recommended on the page Data Collection.
However, the second write always throws an error. I've reduced the code to this:
It always results in an error:
I've tried
Storage.eraseAll()
andStorage.compact()
. There are no other files in my Flash storage.I noticed this quote from Gordon in this comment:
Not sure if that makes any difference.
Am I doing something wrong? Is it simply a bad idea to be using the flash storage on an Espruino WiFi to store a data log? The specs say it has 512kB of flash, I guess the missing 448KB is storing the firmware?