From 7376716e64ef87fae4f1304d5b89d796e87a0bef Mon Sep 17 00:00:00 2001 From: Klaus Becker <97029552+KlsBecker@users.noreply.github.com> Date: Sun, 24 Sep 2023 21:30:36 -0300 Subject: [PATCH] ina219: fix bus voltage measuring Changed the variable that read the 16 bit register to unsigned --- components/ina219/ina219.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ina219/ina219.c b/components/ina219/ina219.c index 9a432cea..ff79ed59 100644 --- a/components/ina219/ina219.c +++ b/components/ina219/ina219.c @@ -260,8 +260,8 @@ esp_err_t ina219_get_bus_voltage(ina219_t *dev, float *voltage) { CHECK_ARG(dev && voltage); - int16_t raw; - CHECK(read_reg_16(dev, REG_BUS_U, (uint16_t *)&raw)); + uint16_t raw; + CHECK(read_reg_16(dev, REG_BUS_U, &raw)); *voltage = (raw >> 3) * 0.004;