From de8a0f3c0fea8fcc0fc7a34c091a49580c6c4b3a Mon Sep 17 00:00:00 2001 From: Aleksandr Gusarov Date: Mon, 21 Nov 2022 11:29:38 +0400 Subject: [PATCH] fix INA228 negative current calculations --- src/INA.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/INA.cpp b/src/INA.cpp index ee8ebf0..fcc5296 100644 --- a/src/INA.cpp +++ b/src/INA.cpp @@ -701,7 +701,7 @@ int32_t INA_Class::getBusMicroAmps(const uint8_t deviceNumber) { raw = raw >> 4; } // if-then negative - microAmps = ((int64_t)raw * (int64_t)ina.current_LSB) / 1000ULL; + microAmps = ((int64_t)raw * (int64_t)ina.current_LSB) / 1000LL; break; default: microAmps = (int64_t)readWord(ina.currentRegister, ina.address) * (int64_t)ina.current_LSB /