Hi - there's no 'close' because all the info is written to the file immediately. Closing it wouldn't actually do anything.
However if you've started writing to a file and then you delete it and try and write again I can imagine that would cause issues. What I'd suggest is in your Python, when you go and clear the file, make sure you set currentFile = null; (you'd have to make it global - or maybe make a global function that does currentFile = null and erases the file?). That should allow everything to continue working without a reboot.
... but to answer your initial question, if you just want a 'soft' reboot, just call load(). On the cutting edge firmwares (and 2v05 and later when released) you can do load("filename") too.
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.
Hi - there's no 'close' because all the info is written to the file immediately. Closing it wouldn't actually do anything.
However if you've started writing to a file and then you delete it and try and write again I can imagine that would cause issues. What I'd suggest is in your Python, when you go and clear the file, make sure you set
currentFile = null;
(you'd have to make it global - or maybe make a global function that doescurrentFile = null
and erases the file?). That should allow everything to continue working without a reboot.... but to answer your initial question, if you just want a 'soft' reboot, just call
load()
. On the cutting edge firmwares (and 2v05 and later when released) you can doload("filename")
too.