Skip to content

Commit

Permalink
Merge pull request #232 from Hampycalc/master
Browse files Browse the repository at this point in the history
Latch timing reference can cause infinite loop
  • Loading branch information
ladyada authored May 15, 2020
2 parents 766f7fb + 8c9fac0 commit 538c53d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Adafruit_NeoPixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ class Adafruit_NeoPixel {
@return 1 or true if show() will start sending immediately, 0 or false
if show() would block (meaning some idle time is available).
*/
bool canShow(void) const { return (micros()-endTime) >= 300L; }
bool canShow(void) {
if (endTime > micros()) {
endTime = micros();
}
return (micros() - endTime) >= 300L;
}
/*!
@brief Get a pointer directly to the NeoPixel data buffer in RAM.
Pixel data is stored in a device-native format (a la the NEO_*
Expand Down

0 comments on commit 538c53d

Please sign in to comment.