Commit 434f7f92 几米阳光

1

1 个父辈 005d9f15
......@@ -98,23 +98,14 @@ namespace URSoldering.DeviceLibrary
/// 初始化
/// </summary>
public static void Init()
{
//URRobotControl.InitEpson();
Task.Factory.StartNew(delegate ()
{
bool result = URRobotControl.StartRobot();
if (!result)
{
WarnMsg = "连接UR机器人失败";
}
});
{
StartURRobot();
SolderingManager.Init(RobotConfig.JBC_Soldering_Port, RobotConfig.JBC_Soldering_Num);
SendWireManager.Init(RobotConfig.JBC_SendWire_Port);
isInit = true;
}
public static void ResetInit()
private static void StartURRobot()
{
if (!URRobotControl.IsRun)
{
......@@ -128,6 +119,10 @@ namespace URSoldering.DeviceLibrary
}
});
}
}
public static void ResetInit()
{
StartURRobot();
SendWireManager.Init(RobotConfig.JBC_SendWire_Port);
SolderingManager.Init(RobotConfig.JBC_Soldering_Port, RobotConfig.JBC_Soldering_Num);
}
......
......@@ -116,6 +116,10 @@ namespace URSoldering.DeviceLibrary
/// <returns></returns>
public static bool StartRobot()
{
if (IsRun)
{
return true;
}
if (reconnectTimer == null)
{
reconnectTimer = new System.Timers.Timer();
......@@ -125,10 +129,6 @@ namespace URSoldering.DeviceLibrary
reconnectTimer.Enabled = false;
}
IsStartConnect = true;
if (IsRun)
{
return true;
}
return StartConnect();
}
......@@ -160,9 +160,10 @@ namespace URSoldering.DeviceLibrary
PreStartTime = DateTime.Now;
startCount++;
//Reset();
LogUtil.info("" + LogName + "开始连接");
Reset();
controlTcp = new TcpClient();
controlTcp.TimeOutTime = 2000;
bool result = controlTcp.connect(RobotIp, ControlPort, new TcpClient.HandleMessage(OnControlRevice));
if (!result)
{
......
......@@ -235,6 +235,7 @@ namespace URSoldering.Client
}
if (!URRobotControl.IsRun&&isRun.Equals(false))
{
isRun = true;
Task.Factory.StartNew(delegate ()
{
bool result = URRobotControl.StartRobot();
......@@ -248,13 +249,10 @@ namespace URSoldering.Client
}
});
isRun = true;
}
else
{
RobotStatus(true);
URRobotControl.FreeAxis();
RobotStatus(true);
UpdateRobotPosition();
}
}
......@@ -272,8 +270,7 @@ namespace URSoldering.Client
}
URRobotControl.LockAxis();
//timer2.Stop();
timer1.Stop();
UsbCameraHDevelop.CloseAllCamera();
timer1.Stop();
}
private void btnSavePoint_Click(object sender, EventArgs e)
......
......@@ -22,25 +22,12 @@ namespace URSoldering.Client
private void FrmBoardInfo_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
//此界面打开时,不能打开自动焊接
//CheckForIllegalCrossThreadCalls = false;
if (WeldRobotBean.ISRun)
{
LogUtil.error("进入焊接界面,发现WeldRobotBean自动运行中,关闭自动运行");
WeldRobotBean.StopRun();
}
if (URRobotControl.IsRun)
{
URRobotControl.FreeAxis();
URPointValue lastP = URRobotControl.GetLastPosition();
urRobotSControl1.ShowPoint(lastP);
}
else
{
}
}
isAuto = false;
timer1.Interval = 1000;
......@@ -53,21 +40,11 @@ namespace URSoldering.Client
{
if (!URRobotControl.IsRun && isRun.Equals(false))
{
isRun = true;
Task.Factory.StartNew(delegate ()
{
bool result = URRobotControl.StartRobot();
if (!result)
{
LogUtil.info("连接失败:" + result);
}
else
{
URRobotControl.FreeAxis();
isAuto = false;
}
});
isRun = true;
bool result = URRobotControl.StartRobot();
});
}
else
{
......@@ -81,8 +58,7 @@ namespace URSoldering.Client
private void FrmBoardInfo_FormClosing(object sender, FormClosingEventArgs e)
{
URRobotControl.LockAxis();
timer1.Stop();
UsbCameraHDevelop.CloseAllCamera();
timer1.Stop();
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!