From 8fec7e32f49625d8a27a008be2689174e80f9ac7 Mon Sep 17 00:00:00 2001 From: Akram Doudou <37239755+ChrisRed255@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:13:08 +0100 Subject: [PATCH] Changed the order of multiplication to avoid overflow for int16 value (#17) --- INA219.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INA219.cpp b/INA219.cpp index c02215c..258dab6 100644 --- a/INA219.cpp +++ b/INA219.cpp @@ -94,7 +94,7 @@ float INA219::getBusVoltage() float INA219::getPower() { uint16_t value = _readRegister(INA219_POWER); - return value * 20 * _current_LSB; + return value * _current_LSB * 20; } // TODO CHECK