s-marley / ESP32_FFT_VU

A spectrum analyzer VU meter for the ESP32 and a FastLED matrix
Other
274 stars 67 forks source link

Prevent Stuck Loop #2

Closed Kineticus closed 3 years ago

Kineticus commented 3 years ago

Micros overflows every ~71.5 minutes. This can cause the newTime value to get stuck at a very high value while Micros rolls back to 0. When this happens the while condition in the sample loop is not met for a very long time. Changing the while condition to check for the difference between the two unsigned longs prevents this possibility (a negative outcome is not possible as there is no sign).

s-marley commented 3 years ago

@Kineticus Thank you for noticing and fixing this issue, and apologies it took me so long to merge.