Now, you may be wondering what the point of the cleanup() function is...
If I have a microcontroller with saved code on it which I use, I will often do something like this for onInit()
function onInit() {
pinMode(C5,'input_pullup'); //this is connected to a button to ground.
if(!digitalRead(C5)){return;}
...
...
delete onInit();
}
So I can enter maintenance mode by holding down that button on reboot, and in that mode, I can connect to the console, load the utility functions from the eeprom and modify the functions in it, and then call cleanup(), and then if I need to modify the normal code too, I can call save() and there won't be any cruft from the eeprom maintenance to clog up the saved code.
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.
Now, you may be wondering what the point of the cleanup() function is...
If I have a microcontroller with saved code on it which I use, I will often do something like this for onInit()
So I can enter maintenance mode by holding down that button on reboot, and in that mode, I can connect to the console, load the utility functions from the eeprom and modify the functions in it, and then call cleanup(), and then if I need to modify the normal code too, I can call save() and there won't be any cruft from the eeprom maintenance to clog up the saved code.