mirror of
https://github.com/anklimov/lighthub
synced 2026-01-31 18:49:06 +03:00
modbus negative register fix
This commit is contained in:
@@ -260,7 +260,7 @@ int out_Modbus::findRegister(int registerNum, int posInBuffer, int regType)
|
|||||||
case PAR_I16:
|
case PAR_I16:
|
||||||
//isSigned=true;
|
//isSigned=true;
|
||||||
param=data;
|
param=data;
|
||||||
mappedParam.Int((int32_t)data);
|
mappedParam.Int((int32_t)(int16_t)data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAR_U16:
|
case PAR_U16:
|
||||||
@@ -292,13 +292,13 @@ int out_Modbus::findRegister(int registerNum, int posInBuffer, int regType)
|
|||||||
|
|
||||||
case PAR_TENS:
|
case PAR_TENS:
|
||||||
param=data;
|
param=data;
|
||||||
mappedParam.Tens((int32_t) data);
|
mappedParam.Tens((int16_t) data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAR_100:
|
case PAR_100:
|
||||||
param=data;
|
param=data;
|
||||||
mappedParam.Tens_raw(data * (TENS_BASE/100));
|
mappedParam.Tens_raw((int16_t) data * (TENS_BASE/100));
|
||||||
mappedParam.Float((int32_t) data/100.);
|
mappedParam.Float((int32_t) (int16_t) data/100.);
|
||||||
}
|
}
|
||||||
|
|
||||||
debugSerial << F("MB got ")<<mappedParam.toString(buf,sizeof(buf))<< F(" from ")<<regType<<F(":")<<paramObj->name<<endl;
|
debugSerial << F("MB got ")<<mappedParam.toString(buf,sizeof(buf))<< F(" from ")<<regType<<F(":")<<paramObj->name<<endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user