Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setTimeout/Interval when timers scheduled within timer #1829

Closed
gfwilliams opened this issue May 27, 2020 · 0 comments
Closed

setTimeout/Interval when timers scheduled within timer #1829

gfwilliams opened this issue May 27, 2020 · 0 comments

Comments

@gfwilliams
Copy link
Member

http://forum.espruino.com/conversations/348097/#comment15308185

setInterval(function () {
  if (BTN1.read()) setTimeout(function(){},0);
}, 100);
setInterval(function() {
  digitalPulse(LED1,1,10);
}, 1000);

LED1 should flash every second - but hold BTN1 and it'll stop!

This is the issue:

while (jsvObjectIteratorHasValue(&it) && !(jsiStatus & JSIS_TIMERS_CHANGED)) {

Not all timers get decremented if the timers array changes. I guess we could do execution in two parts - one to decrement, and one to execute?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant