RobTillaart / INA226

Arduino library for INA226 power sensor
MIT License
54 stars 14 forks source link

reset sets wrong bit #14

Closed tomrodeheffer closed 2 years ago

tomrodeheffer commented 2 years ago

I don't have my INA226 yet to test against, but I'm reading the code and I think I spotted a bug. INA226::reset() says

mask |= 0x800;

This is the wrong bit. See INA226 specification Table 5 "Configuration Register" on page 22. It should be bit D15, i.e.

mask |= 0x8000;

RobTillaart commented 2 years ago

Thanks for this issue. I have to investigate, do not recall errors during testing or in my projects with this.

RobTillaart commented 2 years ago

Good catch, working on a fix which replaces the magic numbers of the config register with defines. Expect to create a develop branch today so you can test if you have time.

RobTillaart commented 2 years ago

@tomrodeheffer Do you have time to verify the working of the develop branch? (I have no test setup at the moment) If not I'll merge it tomorrow anyway as the changes are relative small.

(sorry you already mentioned you don't have a sensor either)

RobTillaart commented 2 years ago

@tomrodeheffer Thanks again for pointing to the bug!