Thanks for the reply.
The formatting went away when I returned to the forum later. Seemed to sort itself out!
Thanks for the reformatted code I will give it a try. I can see the logic now so it makes sense. Coming from a Java background you may see where my confusion stems from.
My process was to upload the code, then press the button, then save(), then do the dump().
Am I right is saying that the current value of the var's is wirtten to flash with the source when a save() is run and dump inlines the values with the source.
A load(), reset... then reads the state, including the saved values, back to ram.
You would normally expect a reset to ZERO all state and start running the source from the top. It's a bit mind blowing especially if the app has many states.
So onInit() is run on reset, reset() and power-up. Is it run on load() as well.
I do think the coding examples need to show this feature of the language.
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.
Thanks for the reply.
The formatting went away when I returned to the forum later. Seemed to sort itself out!
Thanks for the reformatted code I will give it a try. I can see the logic now so it makes sense. Coming from a Java background you may see where my confusion stems from.
My process was to upload the code, then press the button, then save(), then do the dump().
Am I right is saying that the current value of the var's is wirtten to flash with the source when a save() is run and dump inlines the values with the source.
A load(), reset... then reads the state, including the saved values, back to ram.
You would normally expect a reset to ZERO all state and start running the source from the top. It's a bit mind blowing especially if the app has many states.
So onInit() is run on reset, reset() and power-up. Is it run on load() as well.
I do think the coding examples need to show this feature of the language.