MI - Fix AC calc after midnight

For other than 1ch inverters
This commit is contained in:
rejoe2 2024-05-30 12:44:50 +02:00 committed by GitHub
parent 4ca05620dc
commit 5f3c6feb35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -897,7 +897,14 @@ class Communication : public CommQueue<> {
stsok = false;
if( (!oldState) || (!q->iv->alarmCnt) ) { // initial zero value? => just write this channel to main state and raise changed flags
changedStatus = true;
q->iv->alarmCnt = 1; // minimum...
if( !q->iv->alarmCnt ) {
q->iv->alarmCnt = 1; // minimum...
for (uint8_t i = 1; i <= 9; i++) { //start with 1
if (i != stschan && q->iv->lastAlarm[i].code) {
q->iv->lastAlarm[i].code = 0; // zero outdated values
}
}
}
} else {
//sth is or was wrong?
if (q->iv->type == INV_TYPE_1CH) {
@ -996,7 +1003,7 @@ class Communication : public CommQueue<> {
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))
if ((!iv->lastAlarm[i].code) || (iv->lastAlarm[i].code == 1) || ( (iv->alarmCnt == 1) && (iv->lastAlarm[0].code == 1) ) )
ac_pow += iv->getValue(iv->getPosByChFld(i, FLD_PDC, rec), rec);
}
}