Personally I'd look at readCompass - putting a getTime() at the start, and one at the end, and comparing.
readCompass
getTime()
If an interval gets delayed, it'll be because some other bit (or bits) of JavaScript is taking a long time to execute.
If it's getting slower over time, is it possible you're not doing a clearInterval(..) for your intervalRefSec = setInterval(readCompass, 200);?
clearInterval(..)
intervalRefSec = setInterval(readCompass, 200);
@Gordon started
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.
Personally I'd look at
readCompass
- putting agetTime()
at the start, and one at the end, and comparing.If an interval gets delayed, it'll be because some other bit (or bits) of JavaScript is taking a long time to execute.
If it's getting slower over time, is it possible you're not doing a
clearInterval(..)
for yourintervalRefSec = setInterval(readCompass, 200);
?