You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AnalogDriverArduino::readBytes is supposed to return the number of bytes written to the array passed in as first argument. It does this by calling `buffer->readArray` and returning the same value returned by that function. However, that function actually returns the number of int16_t samples, each of which is 2 bytes, so in fact the readBytes function should return that value multiplied by 2.
This is particularly important because if AnalogDriverArduino::readBytes returns a value of 1, then many of the end consumers will simply drop that value. This is because many of the end consumers divide the number of bytes by 2 again to get the number of samples, and in integer arithmetic, dividing 1 by 2 gives 0. In some circumstances this can lead to a lot of samples being dropped.
This pr just adds the "times 2" to AnalogDriverArduino::readBytes
0 commit comments