setInterval problem

Posted on
  • I am having a lot of problems with setInterval. Even using the simple tutorial example of flashing a LED. If left unattended it works for perhaps two hours and then breaks with the LED constantly on. I have also tried it using digitalWrite to a pin and when it goes wrong the pin is being pulsed at a much higher rate than was set. Further calls to changeInterval have no effect, a reset is required. I have tried this on the two Espruino boards I have with the same results. I am observing this using firmware 1v58. Is this linked to the problems currently being seen for setTimeout and getTime? Any ideas?

    Arthur

  • When it breaks, is getTime() giving bogus results? (Note, it should be in seconds)

  • getTime() does not return the correct result. It is incrementing far too fast, about 2500 per second. By the way, do you understand why it returns a value to 14 decimal places?

  • Sounds like the same issue I'm having in the DISK_ERR thread.

  • Yes, sorry about this - it's probably the same issue and I'll be working on a fix today.

    The 14 decimal places is more or less random - it's probably just the maximum Espruino outputs at... It'll be because time is stored to 2 ^ 20 / sec = 1048576 / sec - which doesn't convert to decimal exactly.

  • I have been running 1v59 commit_date/2014-03-25 13:14:38 for over 15 hours now and it is still working OK!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

setInterval problem

Posted by Avatar for arthurj @arthurj

Actions