Zanduino / INA

Combined Arduino library for reading multiple INA2xx power monitor devices
GNU General Public License v3.0
158 stars 40 forks source link

begin() only looks for 15 devices #51

Closed nathancheek closed 4 years ago

nathancheek commented 4 years ago

Function INA_Class::begin() attempts to find all INA devices on the I2C bus. However, when it loops through all possible addresses, it does not check the highest possible address 0x4F. The error can be seen on the following line: https://github.com/SV-Zanshin/INA/blob/56999531b6b632196b89fb14e8f48558e8bd1d87/src/INA.cpp#L219

The fix is to increment until 0x50; that way communication with a device at 0x4F will be attempted.

SV-Zanshin commented 4 years ago

Thanks for catching that. Rather than change the upper "0x4F" value, the condition should be changed to "<=" so that the upper and lower values are directly visible in the source code and thus are a bit easier to understand.