Switching between dev/standalone mode #216
Replies: 3 comments
-
Posted at 2014-02-20 by @gfwilliams Hi, what you're doing is fine, however you may not have to set your global variables on
If you just send your code over to the device then you'll have to call |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by hansamann So the habit / pattern I developed now is this
--> so reset() - I would do this to get a "blank" espruino to play with. But it would not clear the persistent memory, so after a power on/off or reset button press, it would be back as it loads again. Thx! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by @gfwilliams Yes, that's it... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-02-20 by hansamann
Hi all,
I have trouble to understand when I would call save() load() and reset(). I've declared a few global variables at the top of my espruino code:
var channel, led2State, debug;
These variables are initialized in an onInit() function, that I typically call manually once I have moved the code over to the device. The onInit() function is called once the device starts up - e.g. after a reset button click, right?
Now, I could also make the onIinit() call at the bottom of the code - once I flash the code over, it would execute the onInit() once, - just like after a reset. But a reset - if I understand correctly - will not execute the onInit() twice, as the call to onInit() is done by the system.
Are these assumptions correct?
Is it OK to declare global variables -what happens to these once I do a save()?
Thx
Sven
Beta Was this translation helpful? Give feedback.
All reactions