增加工作流程完后ZR回原

master
lhiven 1 year ago
parent 388a3165ed
commit e561e40654

@ -0,0 +1,121 @@
using Rs.Controls;
using Rs.Framework;
using Rs.Motion;
using Rs.MotionPlat.Commom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Rs.MotionPlat.Flow.SubFlow
{
enum EZRHomeFlowStep
{
StartHome,
WaitHomed,
GoStartPos,
WaitArrivedStartPos
}
public class ZRHomeFlow
{
private ZRHomeFlow() { }
private static ZRHomeFlow instance;
public static ZRHomeFlow Instance
{
get
{
if(instance==null)
instance = new ZRHomeFlow();
return instance;
}
}
private ManualResetEvent homeFinished = new ManualResetEvent(false);
private EZRHomeFlowStep step = EZRHomeFlowStep.StartHome;
bool finished = false;
public void GoHome()
{
if (finished)
{
finished = false;
}
else
return;
Task.Run(() => {
while (!finished)
{
switch (step)
{
case EZRHomeFlowStep.StartHome:
AxisControl.NozzleZ1.Home();
AxisControl.NozzleZ2.Home();
AxisControl.NozzleZ3.Home();
AxisControl.NozzleZ4.Home();
AxisControl.NozzleZ5.Home();
AxisControl.NozzleZ6.Home();
AxisControl.NozzleZ7.Home();
AxisControl.NozzleZ8.Home();
AxisControl.NozzleR1.Home();
AxisControl.NozzleR2.Home();
AxisControl.NozzleR3.Home();
AxisControl.NozzleR4.Home();
AxisControl.NozzleR5.Home();
AxisControl.NozzleR6.Home();
AxisControl.NozzleR7.Home();
AxisControl.NozzleR8.Home();
step = EZRHomeFlowStep.WaitHomed;
break;
case EZRHomeFlowStep.WaitHomed:
if(AxisControl.NozzleZ1.HomeStatus== EHomeStatus.Finished
&& AxisControl.NozzleZ2.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleZ3.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleZ4.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleZ5.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleZ6.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleZ7.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleZ8.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR1.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR2.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR3.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR4.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR5.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR6.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR7.HomeStatus == EHomeStatus.Finished
&& AxisControl.NozzleR8.HomeStatus == EHomeStatus.Finished)
{
step = EZRHomeFlowStep.GoStartPos;
}
break;
case EZRHomeFlowStep.GoStartPos:
for(int i=1;i<9;i++)
{
double targetPos = SysConfigParam.GetValue<Double>($"NozzleR{i}StartPos");
AxisControl.GetAxis($"NozzleR{i}").MovePos(targetPos, GlobalVar.WholeSpeed);
}
step = EZRHomeFlowStep.WaitArrivedStartPos;
break;
case EZRHomeFlowStep.WaitArrivedStartPos:
if(Ops.IsStop("NozzleR1")
&& Ops.IsStop("NozzleR2")
&& Ops.IsStop("NozzleR3")
&& Ops.IsStop("NozzleR4")
&& Ops.IsStop("NozzleR5")
&& Ops.IsStop("NozzleR6")
&& Ops.IsStop("NozzleR7")
&& Ops.IsStop("NozzleR8"))
{
finished = true;
homeFinished.Set();
}
break;
}
}
});
}
}
}

@ -235,6 +235,7 @@
<Compile Include="Flow\NormalFlow\TakeTrayFlow.cs" /> <Compile Include="Flow\NormalFlow\TakeTrayFlow.cs" />
<Compile Include="Flow\SubFlow\LaserFlow.cs" /> <Compile Include="Flow\SubFlow\LaserFlow.cs" />
<Compile Include="Flow\SubFlow\UpCameraCheckFlow.cs" /> <Compile Include="Flow\SubFlow\UpCameraCheckFlow.cs" />
<Compile Include="Flow\SubFlow\ZRHomeFlow.cs" />
<Compile Include="Flow\TestCenter.cs" /> <Compile Include="Flow\TestCenter.cs" />
<Compile Include="Flow\NormalFlow\TurnoverFlow.cs" /> <Compile Include="Flow\NormalFlow\TurnoverFlow.cs" />
<Compile Include="Flow\WorkEnvironment.cs" /> <Compile Include="Flow\WorkEnvironment.cs" />

Loading…
Cancel
Save