Releases: wollewald/INA226_WE
Eliminated Range Setting
Compatibility with INA219_WE
When I developed the library I did not choose the best enum names for the measure modes. E.g. "POWER_DOWN" is also used in INA219_WE. If you have problems then uncomment the line: #define INA226_WE_COMPATIBILITY_MODE_ in INA226_WE_config.h and use "INA226_POWER_DOWN" instead of "POWER_DOWN". Do the same for "CONTINUOUS" (-> INA226_CONTINUOUS) AND TRIGGERED (-> INA226_TRIGGERED).
Added a function to return the I2C error code
I added the function getI2cErrorCode() which return the return value of endTransmission. I updated the example sketches Trigger.ino and Continuous.ino to show how it works.
I have also added a timeout check for startSingleMeasurement() of 2 seconds to avoid that the program hangs forever in case of unavailability of the INA226.
Replaced defines by constexpr
Several changes:
- tidied constructors
- replaced #defines by constexpr
- replaced C-Cast by static_cast
- replace private by protected
- corrected typos in example sketches
Added comments about poor quality modules in readme
Added comments about poor quality modules in readme
Read performance increase
In the readRegister function, I have added a "false" in Wire.endTransmission() ---> Wire.endTransmission(false) before Wire.requestFrom(). This saves some microseconds.
TwoWire object can now be passed to the constructor
There are now new options to create your INA226 object:
- INA226_WE ina226 = INA226_WE() -> uses Wire / I2C Address = 0x40
- INA226_WE ina226 = INA226_WE(ICM20948_ADDR) -> uses Wire / I2C_ADDRESS
- INA226_WE ina226 = INA226_WE(&wire2) -> uses the TwoWire object wire2 / I2C_ADDRESS
- INA226_WE ina226 = INA226_WE(&wire2, I2C_ADDRESS) -> all together
This enables you to e.g. to use the two ESP32 I2C busses
Several new functions
measureMode -> INA226measureMode in enum to stop clash with ADS1115_WE
init() checks existance of device and returns 1 if it exists else 0
added getShuntVolatage_V method
added getCurrent_A method
added startSingleMeasurementNoWait method
added isBusy method
English documentation available now
English documentation now available:
https://wolles-elektronikkiste.de/en/ina226-current-and-power-sensor
And some typos corrected in comments in example sketches.
No change to the code.
You can choose a resistor now
With this version it is possible to choose a resistor. So you could use the INA226 IC instead of the module and take the resistor which suits you best. An example (Continuous_With_Resistor_Value.ino) has been added.