From f7a5e58228b43ca2fa4716a1437674ce73676777 Mon Sep 17 00:00:00 2001 From: irmishappy <48766654+irmishappy@users.noreply.github.com> Date: Wed, 19 Feb 2020 21:01:05 +0200 Subject: [PATCH 1/2] Update sensor.ino Apparent, reactive power measurement unit corrections. --- code/espurna/sensor.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/espurna/sensor.ino b/code/espurna/sensor.ino index 80ef59ec3a..0e95c3cd22 100644 --- a/code/espurna/sensor.ino +++ b/code/espurna/sensor.ino @@ -90,6 +90,10 @@ PROGMEM const char magnitude_amperes[] = "A"; PROGMEM const char magnitude_volts[] = "V"; PROGMEM const char magnitude_watts[] = "W"; PROGMEM const char magnitude_kw[] = "kW"; +PROGMEM const char magnitude_VA[] = "VA"; +PROGMEM const char magnitude_kVA[] = "kVA"; +PROGMEM const char magnitude_VAR[] = "VAR"; +PROGMEM const char magnitude_kVAR[] = "kVAR"; PROGMEM const char magnitude_joules[] = "J"; PROGMEM const char magnitude_kwh[] = "kWh"; PROGMEM const char magnitude_ugm3[] = "µg/m³"; From a46e337957dfefe34c6b28afec5715661cc9d180 Mon Sep 17 00:00:00 2001 From: irmishappy <48766654+irmishappy@users.noreply.github.com> Date: Sat, 22 Feb 2020 21:18:50 +0200 Subject: [PATCH 2/2] Update sensor.ino --- code/espurna/sensor.ino | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/espurna/sensor.ino b/code/espurna/sensor.ino index 0e95c3cd22..ed51b6c3d1 100644 --- a/code/espurna/sensor.ino +++ b/code/espurna/sensor.ino @@ -109,7 +109,7 @@ PROGMEM const char magnitude_resistance[] = "ohm"; PROGMEM const char* const magnitude_units[] = { magnitude_empty, magnitude_celsius, magnitude_percentage, magnitude_hectopascals, magnitude_amperes, magnitude_volts, - magnitude_watts, magnitude_watts, magnitude_watts, + magnitude_watts, magnitude_VA, magnitude_VAR, magnitude_percentage, magnitude_joules, magnitude_joules, magnitude_empty, magnitude_empty, magnitude_empty, magnitude_ugm3, magnitude_ugm3, magnitude_ugm3, @@ -1937,9 +1937,14 @@ String magnitudeUnits(unsigned char type) { (_sensor_energy_units == ENERGY_KWH)) { strncpy_P(buffer, magnitude_kwh, sizeof(buffer)); } else if ( - (type == MAGNITUDE_POWER_ACTIVE || type == MAGNITUDE_POWER_APPARENT || type == MAGNITUDE_POWER_REACTIVE) && - (_sensor_power_units == POWER_KILOWATTS)) { + (type == MAGNITUDE_POWER_ACTIVE ) && (_sensor_power_units == POWER_KILOWATTS)) { strncpy_P(buffer, magnitude_kw, sizeof(buffer)); + } else if ( + (type == MAGNITUDE_POWER_APPARENT ) && (_sensor_power_units == POWER_KILOWATTS )) { + strncpy_P(buffer, magnitude_kVA, sizeof(buffer)); + } else if ( + (type == MAGNITUDE_POWER_REACTIVE) && (_sensor_power_units == POWER_KILOWATTS )) { + strncpy_P(buffer, magnitude_kVAR, sizeof(buffer)); } else { strncpy_P(buffer, magnitude_units[type], sizeof(buffer)); }