From 10f6e980f579d61acd0ebb960852925427fdd552 Mon Sep 17 00:00:00 2001 From: barbudor Date: Sun, 25 Sep 2022 14:09:39 +0200 Subject: [PATCH] fix power calculation --- tasmota/tasmota_xsns_sensor/xsns_54_ina226.ino | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/tasmota/tasmota_xsns_sensor/xsns_54_ina226.ino b/tasmota/tasmota_xsns_sensor/xsns_54_ina226.ino index fa5f16be0..97fb68174 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_54_ina226.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_54_ina226.ino @@ -307,21 +307,6 @@ float Ina226ReadShunt_i(uint8_t device) return result; } -/* -* Read the calculated power -*/ - -float Ina226ReadPower_w(uint8_t device) -{ - uint8_t addr = Ina226Info[device].address; - int16_t reg_shunt_i = I2cReadS16( addr, INA226_REG_POWER); - - float result = ((float) reg_shunt_i) * (Ina226Info[device].i_lsb * 25.0); - - return result; -} - - /* * Read voltage, shunt voltage, current, and power registerd for a given device */ @@ -331,7 +316,7 @@ void Ina226Read(uint8_t device) //AddLog( LOG_LEVEL_NONE, "Ina226Read"); voltages[device] = Ina226ReadBus_v(device); currents[device] = Ina226ReadShunt_i(device); - powers[device] = Ina226ReadPower_w(device); + powers[device] = voltages[device] * currents[device]; //AddLog( LOG_LEVEL_NONE, "INA226 Device %d", device ); //_debug_fval("Voltage", voltages[device]); //_debug_fval("Current", currents[device]);