Load the code from the SD card at startup, then update it on the sd card
This is quite nice and easy. Just add something like:
function onInit() {
eval(require("fs").readFile("boot.js"));
}
save();
Then don't call save any more. Then, just by overwriting boot.js and rebooting (even via load()) you can do an update.
Make sure you delete everything else first
So you could do:
clearInterval();
clearWatch();
delete onInit;
...
or perhaps even programatically do it by looping over Object.keys(this).
Update the code saved in flash itself, then reboot
This might be 'nicest'. I've put some code up here to let you update it from an SD card, so it shouldn't be too hard for you to get it over the air.
To update the firmware you'd have to get an Espruino working exactly as you want it, and then create an 'image' (using the above code) which you'd send to the board
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 Vishnu,
You've got three options for this I think:
Load the code from the SD card at startup, then update it on the sd card
This is quite nice and easy. Just add something like:
Then don't call save any more. Then, just by overwriting
boot.js
and rebooting (even viaload()
) you can do an update.Make sure you delete everything else first
So you could do:
or perhaps even programatically do it by looping over
Object.keys(this)
.Update the code saved in flash itself, then reboot
This might be 'nicest'. I've put some code up here to let you update it from an SD card, so it shouldn't be too hard for you to get it over the air.
To update the firmware you'd have to get an Espruino working exactly as you want it, and then create an 'image' (using the above code) which you'd send to the board