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

Sketch does not progress to the next animation. #12

Open
chopsuwe opened this issue May 12, 2020 · 0 comments
Open

Sketch does not progress to the next animation. #12

chopsuwe opened this issue May 12, 2020 · 0 comments

Comments

@chopsuwe
Copy link

Occasionally the sketch will not progress to the next animation. This is particularly noticeable when a complex animation is running and the workload is high.

The cause is a bug in the timer ISR responsible for flagging when it is time to change the animation.

The original codes checks to see if animationTimer is equal to animationMax and sets the flag. Occasionally animationTimer will be incremented without evaluating the following IF statement. From that point onward the the value of animationTimer will be greater than animationMax and fail to set the flag.

The solution is to change line 606 of cubeplex.h to evaluate if animationTimer is greater than or equal to* animationMax.

The corrected code is:

ISR(TIMER1_OVF_vect) {
  animationTimer++;
  if (animationTimer >= animationMax) {   // change the equal == to greater than or equal to >= 
    continuePattern = false;
    animationTimer=0;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant