mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-23 13:56:10 +02:00
Parse power factor, Qvar as signed values
This commit is contained in:
parent
4d735924ef
commit
adb056fd4f
2 changed files with 4 additions and 4 deletions
|
@ -264,9 +264,9 @@ class Inverter {
|
||||||
val <<= 8;
|
val <<= 8;
|
||||||
val |= buf[ptr];
|
val |= buf[ptr];
|
||||||
} while(++ptr != end);
|
} while(++ptr != end);
|
||||||
if (FLD_T == rec->assign[pos].fieldId) {
|
if ((FLD_T == rec->assign[pos].fieldId) || (FLD_Q == rec->assign[pos].fieldId) || (FLD_PF == rec->assign[pos].fieldId)) {
|
||||||
// temperature is a signed value!
|
// temperature, Qvar, and power factor are a signed values
|
||||||
rec->record[pos] = (REC_TYP)((int16_t)val) / (REC_TYP)(div);
|
rec->record[pos] = ((REC_TYP)((int16_t)val)) / (REC_TYP)(div);
|
||||||
} else if (FLD_YT == rec->assign[pos].fieldId) {
|
} else if (FLD_YT == rec->assign[pos].fieldId) {
|
||||||
rec->record[pos] = ((REC_TYP)(val) / (REC_TYP)(div)) + ((REC_TYP)config->yieldCor[rec->assign[pos].ch-1]);
|
rec->record[pos] = ((REC_TYP)(val) / (REC_TYP)(div)) + ((REC_TYP)config->yieldCor[rec->assign[pos].ch-1]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -43,7 +43,7 @@ const byteAssign_t hms4chAssignment[] = {
|
||||||
{ FLD_PAC, UNIT_W, CH0, 54, 2, 10 },
|
{ FLD_PAC, UNIT_W, CH0, 54, 2, 10 },
|
||||||
{ FLD_Q, UNIT_VAR, CH0, 56, 2, 10 }, // signed!
|
{ FLD_Q, UNIT_VAR, CH0, 56, 2, 10 }, // signed!
|
||||||
{ FLD_IAC, UNIT_A, CH0, 58, 2, 100 },
|
{ FLD_IAC, UNIT_A, CH0, 58, 2, 100 },
|
||||||
{ FLD_PF, UNIT_NONE, CH0, 60, 2, 1000 },
|
{ FLD_PF, UNIT_NONE, CH0, 60, 2, 1000 }, // signed!
|
||||||
{ FLD_T, UNIT_C, CH0, 62, 2, 10 }, // signed!
|
{ FLD_T, UNIT_C, CH0, 62, 2, 10 }, // signed!
|
||||||
{ FLD_EVT, UNIT_NONE, CH0, 64, 2, 1 },
|
{ FLD_EVT, UNIT_NONE, CH0, 64, 2, 1 },
|
||||||
{ FLD_YD, UNIT_WH, CH0, CALC_YD_CH0, 0, CMD_CALC },
|
{ FLD_YD, UNIT_WH, CH0, CALC_YD_CH0, 0, CMD_CALC },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue