GrovePi
GrovePi copied to clipboard
Extraneous bus.read_byte commands?
In various functions in grovepi.py, there are what seem to me to be completely extraneous calls to read_byte, which can just be deleted. Or at least, deleting them doesn't seem to break anything for me.
e.g. in analogRead it says bus.read_byte(address)
, then it does the actual read transaction with number = bus.read_i2c_block_data(address, 1)
. As far as I can tell the bus.read_byte is totally ignored, just does an extra i2c transaction for no reason and makes the code slightly slower.
Maybe I'm missing something and there is a reason for it, but as far as I can tell this is a bug?
When we were building the firmware initially, we found that read_block() didn't work properly without calling the read_byte() first and this was the way we were able to make it work. It was a workaround then and we seem to have kept it till now.