This commit is contained in:
gongxh
2022-05-11 15:20:00 +08:00
parent 041ecb2da2
commit 2a9a10cb46
11 changed files with 678 additions and 11 deletions

View File

@@ -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
}