modbus TCP
- fix virgole/punti - fix scaled double
This commit is contained in:
@@ -1222,18 +1222,20 @@ namespace IOB_WIN_NEXT
|
||||
/// <returns></returns>
|
||||
private static int getScaledInt(dataConf currMem, bool isWrite = false)
|
||||
{
|
||||
int valInt;
|
||||
int valInt=0;
|
||||
double temp;
|
||||
// prima faccio eventuale fattore di scala...
|
||||
int.TryParse(currMem.value, out valInt);
|
||||
double.TryParse(currMem.value.Replace(".",","), out temp);
|
||||
//int.TryParse(currMem.value, out valInt);
|
||||
if (currMem.factor != 1)
|
||||
{
|
||||
if (isWrite)
|
||||
{
|
||||
valInt = (int)(valInt / currMem.factor);
|
||||
valInt = (int)(temp*10 / currMem.factor)/10;
|
||||
}
|
||||
else
|
||||
{
|
||||
valInt = (int)(valInt * currMem.factor);
|
||||
valInt = (int)(temp*10 * currMem.factor)/10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user