Some kind of timer might be a good idea as you say - but then it screws up the low power sleep states on the proper Espruino boards as it'll be waking up every so often.
I guess the other option is to replace if (d>0.04) { with if (d>0.04 || code.length>100) {
Hopefully it won't add too much to the execution speed.
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 wonder how long the string actually was?
Some kind of timer might be a good idea as you say - but then it screws up the low power sleep states on the proper Espruino boards as it'll be waking up every so often.
I guess the other option is to replace
if (d>0.04) {
withif (d>0.04 || code.length>100) {
Hopefully it won't add too much to the execution speed.