@Christof550, other option with your uploading approach is:
put your active code - lines 17..93 - into the onInit() function
send the reset(1) command separately as pre-amble (the true-thy arg clears saved code)
drop the notify(0); clearInterval(); clearWatch(); - reset() already took care of this;
send the code (lines 6..93 with active code in onInit() function)
send the save() command separately as post-amble - it will save the code and invoke onInit() and get's 'you' going
Any restart of the code / power cycle will then just do fine... (load/execute the - initialization and defining the onInit() - code in to ram and then invoke the onInit();).
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.
@Christof550, other option with your uploading approach is:
onInit()
functionreset(1)
command separately as pre-amble (the true-thy arg clears saved code)notify(0); clearInterval(); clearWatch();
-reset()
already took care of this;onInit()
function)save()
command separately as post-amble - it will save the code and invokeonInit()
and get's 'you' goingAny restart of the code / power cycle will then just do fine... (load/execute the - initialization and defining the onInit() - code in to ram and then invoke the
onInit();
).