fix calibration (#1103)

This commit is contained in:
vxider 2020-06-29 05:59:22 +08:00 committed by GitHub
parent c041cc483c
commit 78633c5768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,7 +120,7 @@ void INA219Component::setup() {
}
this->calibration_lsb_ = lsb;
auto calibration = uint32_t(0.04096f / (0.0001 * lsb * this->shunt_resistance_ohm_));
auto calibration = uint32_t(0.04096f / (0.000001 * lsb * this->shunt_resistance_ohm_));
ESP_LOGV(TAG, " Using LSB=%u calibration=%u", lsb, calibration);
if (!this->write_byte_16(INA219_REGISTER_CALIBRATION, calibration)) {
this->mark_failed();