增加是否开启心跳检查
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
#define USE_LOCAL_TCP_DEBUG //使用本地调式
|
//使用本地调式
|
||||||
|
// #define USE_LOCAL_TCP_DEBUG
|
||||||
|
//启用心跳检查
|
||||||
|
// #define UseHeartbeat
|
||||||
|
|
||||||
using CleanMachine.Model;
|
using CleanMachine.Model;
|
||||||
using LeadDataBaseUtility;
|
using LeadDataBaseUtility;
|
||||||
@@ -111,7 +114,7 @@ namespace CleanMachineHMI
|
|||||||
master = factory.CreateAsciiMaster(adaptet);
|
master = factory.CreateAsciiMaster(adaptet);
|
||||||
}
|
}
|
||||||
#if USE_LOCAL_TCP_DEBUG
|
#if USE_LOCAL_TCP_DEBUG
|
||||||
port.Connect("10.0.0.95", 5002);
|
port.Connect("127.0.0.1", 5002);
|
||||||
this._isConn = true;
|
this._isConn = true;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -131,7 +134,11 @@ namespace CleanMachineHMI
|
|||||||
}
|
}
|
||||||
public void ClosePlcConn()
|
public void ClosePlcConn()
|
||||||
{
|
{
|
||||||
|
#if USE_LOCAL_TCP_DEBUG
|
||||||
if (port.Connected)
|
if (port.Connected)
|
||||||
|
#else
|
||||||
|
if (port.IsOpen)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
port.Close();
|
port.Close();
|
||||||
master = null;
|
master = null;
|
||||||
@@ -866,9 +873,8 @@ namespace CleanMachineHMI
|
|||||||
WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartDataNew.ToString(), PlcItemTypeDesc.D);
|
WritePlcItem("PlcHeartbeatWriteData", wcsToPlcHeartDataNew.ToString(), PlcItemTypeDesc.D);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_LOCAL_TCP_DEBUG
|
#if UseHeartbeat
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (DateTime.Now > HeartbeatTime.AddSeconds(5))//心跳超时
|
if (DateTime.Now > HeartbeatTime.AddSeconds(5))//心跳超时
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user