From ae49f919664a48c8f05e378046ac4ce09fdeeb03 Mon Sep 17 00:00:00 2001 From: rejoe2 Date: Thu, 19 Oct 2023 17:55:57 +0200 Subject: [PATCH] fix 1ch AC calc --- src/hm/Communication.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/hm/Communication.h b/src/hm/Communication.h index d8859477..c7332b32 100644 --- a/src/hm/Communication.h +++ b/src/hm/Communication.h @@ -579,10 +579,15 @@ const byteAssign_t InfoAssignment[] = { //preliminary AC calculation... float ac_pow = 0; - for(uint8_t i = 1; i <= iv->channels; i++) { - if ((!iv->lastAlarm[i].code) || (iv->lastAlarm[i].code == 1)) { - uint8_t pos = iv->getPosByChFld(i, FLD_PDC, rec); - ac_pow += iv->getValue(pos, rec); + if (iv->type == INV_TYPE_1CH) { + if ((!iv->lastAlarm[0].code) || (iv->lastAlarm[0].code == 1)) + ac_pow += iv->getValue(iv->getPosByChFld(1, FLD_PDC, rec), rec); + } else { + for(uint8_t i = 1; i <= iv->channels; i++) { + if ((!iv->lastAlarm[i].code) || (iv->lastAlarm[i].code == 1)) { + uint8_t pos = iv->getPosByChFld(i, FLD_PDC, rec); + ac_pow += iv->getValue(pos, rec); + } } } ac_pow = (int) (ac_pow*9.5);