Skip to content

Commit 1a41cf1

Browse files
committed
Fix power usage display
1 parent da0f459 commit 1a41cf1

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

hardware/Teleinfo.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ void Teleinfo::Init()
131131
m_p3power.ID = 3;
132132

133133
m_counter = 0;
134-
m_power_inst = 0;
134+
m_Power_USAGE_IINST = 0;
135+
m_Power_USAGE_IINST_JW = 0;
136+
m_Power_USAGE_IINST_JR = 0;
135137
}
136138

137139
bool Teleinfo::StartHardware()
@@ -324,21 +326,21 @@ void Teleinfo::MatchLine()
324326
{
325327
if (m_bLabel_PTEC_JW == true)
326328
{
327-
m_p1power.usagecurrent = 0;
328-
m_p2power.usagecurrent += (ulValue * 230);
329-
m_p3power.usagecurrent = 0;
329+
m_Power_USAGE_IINST = 0;
330+
m_Power_USAGE_IINST_JW += (ulValue * 230);
331+
m_Power_USAGE_IINST_JR = 0;
330332
}
331333
else if (m_bLabel_PTEC_JR == true)
332334
{
333-
m_p1power.usagecurrent = 0;
334-
m_p2power.usagecurrent = 0;
335-
m_p3power.usagecurrent += (ulValue * 230);
335+
m_Power_USAGE_IINST = 0;
336+
m_Power_USAGE_IINST_JW = 0;
337+
m_Power_USAGE_IINST_JR += (ulValue * 230);
336338
}
337339
else
338340
{
339-
m_p1power.usagecurrent += (ulValue * 230);
340-
m_p2power.usagecurrent = 0;
341-
m_p3power.usagecurrent = 0;
341+
m_Power_USAGE_IINST += (ulValue * 230);
342+
m_Power_USAGE_IINST_JW = 0;
343+
m_Power_USAGE_IINST_JR = 0;
342344
}
343345
}
344346
break;
@@ -398,9 +400,9 @@ void Teleinfo::MatchLine()
398400
//_log.Log(LOG_NORM,"powerusage1 = %lu", m_p1power.powerusage1);
399401
//_log.Log(LOG_NORM,"powerusage2 = %lu", m_p1power.powerusage2);
400402
//_log.Log(LOG_NORM,"usagecurrent = %lu", m_p1power.usagecurrent);
401-
m_p1power.usagecurrent /= m_counter;
402-
m_p2power.usagecurrent /= m_counter;
403-
m_p3power.usagecurrent /= m_counter;
403+
m_p1power.usagecurrent = (m_Power_USAGE_IINST / m_counter);
404+
m_p2power.usagecurrent = (m_Power_USAGE_IINST_JW / m_counter);
405+
m_p3power.usagecurrent = (m_Power_USAGE_IINST_JR / m_counter);
404406
sDecodeRXMessage(this, (const unsigned char *)&m_p1power, NULL, 255);
405407
if (m_bLabel_Tempo == true)
406408
{
@@ -411,6 +413,9 @@ void Teleinfo::MatchLine()
411413
m_p1power.usagecurrent = 0;
412414
m_p2power.usagecurrent = 0;
413415
m_p3power.usagecurrent = 0;
416+
m_Power_USAGE_IINST = 0;
417+
m_Power_USAGE_IINST_JW = 0;
418+
m_Power_USAGE_IINST_JR = 0;
414419
}
415420
}
416421
break;

0 commit comments

Comments
 (0)