diff --git a/IOB-UT-NEXT/IOB-UT-NEXT.csproj b/IOB-UT-NEXT/IOB-UT-NEXT.csproj
index 6c00d9c9..99354ab9 100644
--- a/IOB-UT-NEXT/IOB-UT-NEXT.csproj
+++ b/IOB-UT-NEXT/IOB-UT-NEXT.csproj
@@ -125,6 +125,7 @@
+
diff --git a/IOB-UT-NEXT/Objects.cs b/IOB-UT-NEXT/Objects.cs
index 55fd73de..a9a63508 100644
--- a/IOB-UT-NEXT/Objects.cs
+++ b/IOB-UT-NEXT/Objects.cs
@@ -812,6 +812,11 @@ namespace IOB_UT_NEXT
///
public int Period { get; set; } = 60;
+ ///
+ /// UM parametro, impiegato anche x conversione (es epoch --> datetime)
+ ///
+ public string UM { get; set; } = "";
+
#endregion Public Properties
}
}
\ No newline at end of file
diff --git a/IOB-WIN-NEXT/DATA/CONF/FINASSI_HELPI_01.json b/IOB-WIN-NEXT/DATA/CONF/FINASSI_HELPI_01.json
index 5c42f0dc..6152a1c9 100644
--- a/IOB-WIN-NEXT/DATA/CONF/FINASSI_HELPI_01.json
+++ b/IOB-WIN-NEXT/DATA/CONF/FINASSI_HELPI_01.json
@@ -132,7 +132,7 @@
"tipoMem": "INT",
"index": 1102,
"size": 2,
- "unit": "#",
+ "unit": "EPOCH",
"func": "POINT",
"period": 90,
"factor": 1
@@ -144,7 +144,7 @@
"tipoMem": "INT",
"index": 1104,
"size": 2,
- "unit": "#",
+ "unit": "EPOCH",
"func": "POINT",
"period": 90,
"factor": 1
diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs
index 3ce72210..b943a182 100644
--- a/IOB-WIN-NEXT/IobGeneric.cs
+++ b/IOB-WIN-NEXT/IobGeneric.cs
@@ -3155,7 +3155,7 @@ namespace IOB_WIN_NEXT
}
else
{
- lgError($"Errore in invio richiesta registrazione allarme: URL: {lastUrl}{Environment.NewLine}Payload:{Environment.NewLine}{rawData}");
+ lgError($"Errore in invio richiesta registrazione allarme | resp: {resp} | URL: {lastUrl}{Environment.NewLine}Payload:{Environment.NewLine}{rawData}");
}
}
return fatto;
@@ -4902,6 +4902,7 @@ namespace IOB_WIN_NEXT
{
Funzione = funz,
Period = periodo,
+ UM = item.Value.unit,
DTStart = DateTime.Now.AddHours(-1),
dataArray = new List()
};
diff --git a/IOB-WIN-NEXT/IobModbusTCP.cs b/IOB-WIN-NEXT/IobModbusTCP.cs
index a16a6040..c18eb2e8 100644
--- a/IOB-WIN-NEXT/IobModbusTCP.cs
+++ b/IOB-WIN-NEXT/IobModbusTCP.cs
@@ -830,14 +830,10 @@ namespace IOB_WIN_NEXT
fatto = writeInputReg(currMem.index, CurrVal);
break;
- //case plcDataType.String:
- // // se ho writePre --> "allungo" di 2 la dimensione della stringa x MemBlock...
- // if (writePre)
- // {
- // MemBlock = new byte[byteSize + 2];
- // }
- // saveStringOnMemBlock(ref MemBlock, 0, currMem.size, currMem.value);
- // break;
+ case plcDataType.String:
+ CurrVal = ModbusClient.ConvertStringToRegisters(currMem.value);
+ fatto = writeInputReg(currMem.index, CurrVal);
+ break;
default:
break;
@@ -1304,6 +1300,7 @@ namespace IOB_WIN_NEXT
// procedo x ogni valore configurato...
foreach (var item in memItemList)
{
+ listInt = new int[item.Value.size];
// attesa 50 ms prima di procedere x evitare burst dati
if (!useLUT)
{
@@ -1368,7 +1365,18 @@ namespace IOB_WIN_NEXT
{
try
{
- listInt = HoldingRegisterLUT[lutAddress];
+ if (listInt.Length == 2)
+ {
+ listInt = HoldingRegisterLUT[lutAddress];
+ }
+ else
+ {
+ // faccio ciclo x copiare 2 alla volta...
+ for (int i = 0; i < listInt.Length; i += 2)
+ {
+ Array.Copy(HoldingRegisterLUT[lutAddress + i], 0, listInt, i, 2);
+ }
+ }
}
catch (Exception exc)
{
@@ -1385,7 +1393,6 @@ namespace IOB_WIN_NEXT
{
// valore string...
valString = ModbusClient.ConvertRegistersToString(listInt, 0, item.Value.size);
-
}
else
{
@@ -1407,10 +1414,20 @@ namespace IOB_WIN_NEXT
dataOk = (valore > (item.Value.minVal + deltaVal) && valore < (item.Value.maxVal - deltaVal));
if (dataOk || disDynDataRangeCheck)
{
- // moltiplico x fattore conversione...
- valoreScal = valore * item.Value.factor;
- saveValue(ref outVal, valoreScal, item.Key);
- lgDebug($"getDataDictionary: valore ricevuto | {item.Key} | val: {valore} | valoreScal: {valoreScal}");
+ // verifica valori EPOCH x convertirli in datetime...
+ if (item.Value.unit == "EPOCH")
+ {
+ valString = TimeUtils.epochConvert(valore).ToString("yyyy-MM-dd HH:mm:ss");
+ saveValueString(ref outVal, valString, item.Key);
+ lgDebug($"getDataDictionary: valore EPOCH ricevuto | {item.Key} | val: {valore} | valString: {valString}");
+ }
+ else
+ {
+ // moltiplico x fattore conversione...
+ valoreScal = valore * item.Value.factor;
+ saveValue(ref outVal, valoreScal, item.Key);
+ lgDebug($"getDataDictionary: valore ricevuto | {item.Key} | val: {valore} | valoreScal: {valoreScal}");
+ }
}
else
{