From bd661fc263eeaea80ea6bba6da870695153e7c53 Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Sat, 16 Dec 2017 20:16:10 +0100 Subject: [PATCH] Lost change --- sonoff/xsns_13_ina219.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sonoff/xsns_13_ina219.ino b/sonoff/xsns_13_ina219.ino index 0cd4174ee..169e51426 100644 --- a/sonoff/xsns_13_ina219.ino +++ b/sonoff/xsns_13_ina219.ino @@ -77,7 +77,7 @@ #define INA219_CONFIG_MODE_SANDBVOLT_CONTINUOUS (0x0007) #define INA219_REG_SHUNTVOLTAGE (0x01) -#define INA219_REG_BUenergy_voltage_chr (0x02) +#define INA219_REG_BUSVOLTAGE (0x02) #define INA219_REG_POWER (0x03) #define INA219_REG_CURRENT (0x04) #define INA219_REG_CALIBRATION (0x05) @@ -129,11 +129,11 @@ float Ina219GetShuntVoltage_mV() return value * 0.01; } -float Ina219GetBuenergy_voltage_chr_V() +float Ina219GetBusVoltage_V() { // Shift to the right 3 to drop CNVR and OVF and multiply by LSB // raw bus voltage (16-bit signed integer, so +-32767) - int16_t value = (int16_t)(((uint16_t)I2cReadS16(ina219_address, INA219_REG_BUenergy_voltage_chr) >> 3) * 4); + int16_t value = (int16_t)(((uint16_t)I2cReadS16(ina219_address, INA219_REG_BUSVOLTAGE) >> 3) * 4); // bus voltage in volts return value * 0.001; } @@ -185,7 +185,7 @@ void Ina219Show(boolean json) char current[10]; char power[10]; - float fvoltage = Ina219GetBuenergy_voltage_chr_V() + (Ina219GetShuntVoltage_mV() / 1000); + float fvoltage = Ina219GetBusVoltage_V() + (Ina219GetShuntVoltage_mV() / 1000); float fcurrent = Ina219GetCurrent_mA() / 1000; float fpower = fvoltage * fcurrent; dtostrfd(fvoltage, Settings.flag2.voltage_resolution, voltage);