修改
This commit is contained in:
@@ -99,7 +99,7 @@ namespace CleanMachineHMI
|
||||
if (_synchronization != null)
|
||||
{
|
||||
_synchronization.Post(this.PostShowX_Y_Status, plcItem);
|
||||
// OnShowX_Y_Status?.Invoke(plcItem);
|
||||
// OnShowX_Y_Status?.Invoke(plcItem);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -161,13 +161,22 @@ namespace CleanMachineHMI
|
||||
|
||||
private void RefreshPlcItem()
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
while (Global.SysThIsRunFlag)
|
||||
{
|
||||
|
||||
|
||||
stopWatch.Restart();
|
||||
var haschange = false;
|
||||
RefreshPlcItem_M(ref haschange);
|
||||
RefreshPlcItem_D(ref haschange);
|
||||
RefreshPlcItem_X(ref haschange);
|
||||
RefreshPlcItem_Y(ref haschange);
|
||||
|
||||
stopWatch.Stop();
|
||||
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
LogHelper.WriteLog($"读取PLC时间:{ts.Milliseconds}", LogTypeEum.Run);
|
||||
if (haschange)
|
||||
{
|
||||
if (_synchronization != null)
|
||||
@@ -175,9 +184,16 @@ namespace CleanMachineHMI
|
||||
_synchronization.Post(this.DoOnReadFinish, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// thEvent.Set();
|
||||
// ShowWarningMsg();
|
||||
Thread.Sleep(100);
|
||||
int sleeptime = 100 - ts.Milliseconds;
|
||||
if (sleeptime<0)
|
||||
{
|
||||
sleeptime = 0;
|
||||
}
|
||||
Thread.Sleep(sleeptime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1184,5 +1200,5 @@ namespace CleanMachineHMI
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user