Aggiunta gestione stato pompe (ON/OFF)

This commit is contained in:
Samuele E. Locatelli
2017-04-06 13:49:43 +02:00
parent d28d50284e
commit 2cef255ea9
+32 -1
View File
@@ -506,6 +506,37 @@ namespace MTC_Adapter
currProgName = vettMemArea[bitNum].mMemAreaProgName.Value.ToString();
}
}
else if (mapIOT_Byte[i].varName.StartsWith("IOT_VAC_"))
{
// recupero NUMERO
try
{
numero = Convert.ToInt32(mapIOT_Byte[i].varName.Replace("IOT_VAC_", ""));
// controllo SE ha bit = 1 è ON..
string VacStat = "";
if (((StFlag8)currByte).HasFlag((StFlag8)Math.Pow(2, bitNum)))
{
VacStat = "ON";
}
else
{
VacStat = "OFF";
}
// salvo in vettore SE possibile...
if (numero <= vettVacPump.Length)
{
vettVacPump[numero - 1].mVacPumpStatus.Value = VacStat;
}
else
{
lg.Error("Errore in inserimento vettore " + mapIOT_Byte[i].varName);
}
}
catch (Exception exc)
{
lg.Error(exc, "Errore in decodifica " + mapIOT_Byte[i].varName);
}
}
}
}
@@ -676,7 +707,7 @@ namespace MTC_Adapter
{
numero = Convert.ToInt32(mapIOT_Word[i].varName.Replace("IOT_C_H_VAC_", ""));
// salvo in vettore SE possibile...
if (numero <= vettVacAct.Length)
if (numero <= vettVacPump.Length)
{
vettVacPump[numero - 1].mVacPumpWrkTime.Value = ncDevice.PLC_MemoryAreaIOT_Word[byteNum];
}