adafruit / Adafruit_VS1053_Library

This is a Arduino library for the Adafruit VS1053 Codec Breakout and Music Maker Shields
https://www.adafruit.com/products/1381
135 stars 113 forks source link

Prevent interrupts at the beginning of feedBuffer()... #21

Closed joelbschwartz closed 7 years ago

joelbschwartz commented 7 years ago

…where flag is checked if feedBuffer is already running, similar to a feature of Paul Stoffregen’s fork, possibly related to issue #4

Scope: modify feedBuffer() by adding a step to disable interrupts noInterrupts() while the flag is being checked (and set) to determine if feedBuffer() is already running.

This is inspired by a change also in Paul Stoffregen's fork of this library. I had issues with a project (with a number of interrupts) occasionally crashing while playing audio. So far, after this change, I haven't observed another crash.

I did not verify this section of code is directly responsible for creating/fixing the crash. But it seems prudent and in my testing, causes no harm!

No known limitations related to platform support.

ladyada commented 7 years ago

hiya can you submit a PR without whitespace changes? :)

joelbschwartz commented 7 years ago

Oops! Resubmitted.