Closed twischer closed 3 years ago
Without this patch values >2^15 will be interpreted as negative values. Therefore the right shift in INA219::busVoltage() will do a sign extension. This issue was seen on ESP8266 when measuring voltages above 16V.
In the Arduino Adafruit_INA219 library uint16_t is used for the bus voltage similar to this patch. See https://github.com/adafruit/Adafruit_INA219/blob/2.1.0/Adafruit_INA219.cpp#L78
Without this patch values >2^15 will be interpreted as negative values. Therefore the right shift in INA219::busVoltage() will do a sign extension. This issue was seen on ESP8266 when measuring voltages above 16V.
In the Arduino Adafruit_INA219 library uint16_t is used for the bus voltage similar to this patch. See https://github.com/adafruit/Adafruit_INA219/blob/2.1.0/Adafruit_INA219.cpp#L78