update in pèrod valori status complessivi

This commit is contained in:
S.E.Locatelli
2022-05-11 19:32:31 +02:00
parent e7aa9d6763
commit 9ff06607e1
+9 -36
View File
@@ -81,6 +81,14 @@ namespace IOB_WIN_NEXT
InMarcia = !rawData.Skip(0).Take(1).FirstOrDefault().Equals(0);
InEmergenza = !rawData.Skip(1).Take(1).FirstOrDefault().Equals(0);
InStop = !rawData.Skip(2).Take(1).FirstOrDefault().Equals(0);
//var valore = BitConverter.ToUInt16(rawData, 0);
//byte b = rawData.Skip(0).Take(1).FirstOrDefault();
//InMarcia = (b & (1 << (1 - 1))) != 0;
//InEmergenza = (b & (1 << (2 - 1))) != 0;
//InStop = (b & (1 << (3 - 1))) != 0; ;
}
}
@@ -260,42 +268,7 @@ namespace IOB_WIN_NEXT
B_input += (1 << 3);
}
}
// se abilitato watchdog...
if (opcUaParams.WatchDog.IsEnabled)
{
#if false
if (adesso.Subtract(lastWatchDogPLC).TotalSeconds > 2)
{
lastWatchDogPLC = adesso;
WatchDog++;
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
lgTrace($"WatchDog val: {WatchDog}");
try
{
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(opcUaParams.WatchDog.MemConfWrite);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
commWriteVal.Value.Value = WatchDog;
List<WriteValue> nodes2Write = new List<WriteValue>();
nodes2Write.Add(commWriteVal);
UA_ref.WriteNodes(nodes2Write);
}
catch (Exception exc)
{
lgError($"Eccezione in gestione WatchDog, valore attuale {WatchDog}{Environment.NewLine}{exc}");
}
}
#endif
}
else
{
lgTrace("WatchDog disabilitato");
}
// controllo se sono poweroff e se non ho dati buoni da > 2 minuti --> disconnetto
if (!powerOnOk && adesso.Subtract(lastCurrent).TotalMinutes > 2)
{