Set available() to 0 when Wire.requestFrom fails (#259)
Wire::requestFrom() returns the number of bytes read from the slave. In the case of error, the slave can end up returning a very large integer for PICO_GENERIC_ERROR which would then be used as the # of bytes read causing crashes and errors. Running TalkingToMyself without connecting the I2C ports would show this behavior. Now, when PICO_GENERIC_ERROR is returned, set the read-back buffer len to 0 explicitly.
Showing
Please register or sign in to comment