.. published part of the code: well, it is pretty nested.
The code is basically a presence sensor that needs to react snappy (turning on the kitchen light!!).
I like your suggestion of using setTimeout instead of the more rigid setInterval. Although I think this way the root cause of the (very rare but annoying) delays is only obfuscated.
I was trying something in the line of setTimeout within the callback but it didn't help so far. I obviously missed some point :(
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.
.. published part of the code: well, it is pretty nested.
The code is basically a presence sensor that needs to react snappy (turning on the kitchen light!!).
I like your suggestion of using setTimeout instead of the more rigid setInterval. Although I think this way the root cause of the (very rare but annoying) delays is only obfuscated.
I was trying something in the line of setTimeout within the callback but it didn't help so far. I obviously missed some point :(