function onInit() {
// remove stuff if setup() was called previously
clearInterval();
clearWatch();
// start up properly
setup();
}
and save as you were doing, or you could use "save on send" which does what I think you're expecting happens now - which is basically to run all your code at boot time as if it were uploaded fresh each time.
The downside of the second option is you can't fiddle with the code while it's running and then re-save it, but you may not want to do that anyway.
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,
I think the issue you're seeing is that some stuff (the SSD1306 and NFC) will need initialising at power on.
What happens when you type
save()
is it saves the current state of the interpreter, but that doesn't include the external hardware.There's more in-depth info on this here: http://www.espruino.com/Saving
But either you could add the lines:
and save as you were doing, or you could use "save on send" which does what I think you're expecting happens now - which is basically to run all your code at boot time as if it were uploaded fresh each time.
The downside of the second option is you can't fiddle with the code while it's running and then re-save it, but you may not want to do that anyway.