mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-07 22:25:53 +02:00
fix 1ch AC calc
This commit is contained in:
parent
0fca99f833
commit
ae49f91966
1 changed files with 9 additions and 4 deletions
|
@ -579,12 +579,17 @@ const byteAssign_t InfoAssignment[] = {
|
||||||
|
|
||||||
//preliminary AC calculation...
|
//preliminary AC calculation...
|
||||||
float ac_pow = 0;
|
float ac_pow = 0;
|
||||||
|
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++) {
|
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)) {
|
||||||
uint8_t pos = iv->getPosByChFld(i, FLD_PDC, rec);
|
uint8_t pos = iv->getPosByChFld(i, FLD_PDC, rec);
|
||||||
ac_pow += iv->getValue(pos, rec);
|
ac_pow += iv->getValue(pos, rec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ac_pow = (int) (ac_pow*9.5);
|
ac_pow = (int) (ac_pow*9.5);
|
||||||
iv->setValue(iv->getPosByChFld(0, FLD_PAC, rec), rec, (float) ac_pow/10);
|
iv->setValue(iv->getPosByChFld(0, FLD_PAC, rec), rec, (float) ac_pow/10);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue