I have uploaded an app called 'Bee' that sometimes has to process a large dictionary file. I noticed that executing a JS function that does not return within ~1 or 2 seconds causes the interpreter to interrupt it, logging "Execution Interrupted" to the console window (when using the IDE). Calling the same function interactively via the REPL in the IDE does not trigger this behavior. For a simple example, run the following snippet by uploading to RAM in the IDE:
function crunch() {
for (i=0; i<10000; ++i) {
var x = Math.sin(Math.random()*Math.PI);
if (i%50 == 0) console.log(i);
}
}
crunch();
Execution gets interrupted before the function finishes; calling 'crunch()' interactively from the console window however lets it finish.
I can see the purpose of this behavior to avoid lock ups in an event-loop driven system like espruino, but is there a way to (temporarily) disable it? I played around with E.kickWatchdog(), but that does not quite seem to do the trick.
Thanks.
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.
I have uploaded an app called 'Bee' that sometimes has to process a large dictionary file. I noticed that executing a JS function that does not return within ~1 or 2 seconds causes the interpreter to interrupt it, logging "Execution Interrupted" to the console window (when using the IDE). Calling the same function interactively via the REPL in the IDE does not trigger this behavior. For a simple example, run the following snippet by uploading to RAM in the IDE:
Execution gets interrupted before the function finishes; calling 'crunch()' interactively from the console window however lets it finish.
I can see the purpose of this behavior to avoid lock ups in an event-loop driven system like espruino, but is there a way to (temporarily) disable it? I played around with E.kickWatchdog(), but that does not quite seem to do the trick.
Thanks.