DexterInd / GrovePi

GrovePi is an open source platform for connecting Grove Sensors to the Raspberry Pi.
https://www.dexterindustries.com/grovepi/
Other
490 stars 488 forks source link

Extraneous bus.read_byte commands? #169

Open joemarshall opened 8 years ago

joemarshall commented 8 years ago

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?

karan259 commented 8 years ago

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.