You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
4.5 KiB
C#
100 lines
4.5 KiB
C#
using Rs.Framework;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Rs.MotionPlat.Flow
|
|
{
|
|
|
|
public class HomeFlow
|
|
{
|
|
ushort homeStep = 0;
|
|
private static HomeFlow instace;
|
|
private bool m_bCancle = false;
|
|
private bool m_bHomed = false;
|
|
public static HomeFlow Instance
|
|
{
|
|
get
|
|
{
|
|
if (instace == null)
|
|
instace = new HomeFlow();
|
|
return instace;
|
|
}
|
|
}
|
|
|
|
public void CancleHome()
|
|
{
|
|
m_bCancle = true;
|
|
}
|
|
|
|
private HomeFlow() { }
|
|
|
|
public void StartGoHome()
|
|
{
|
|
Task.Run(()=> {
|
|
|
|
while (true && !m_bCancle &&!m_bHomed)
|
|
{
|
|
switch (homeStep)
|
|
{
|
|
case 0://所有的Z轴回原
|
|
MessageQueue.Instance.Insert("所有ZR轴开始回零");
|
|
m_bHomed = false;
|
|
MachineManage.Instance.MachineStatus = EMachineStatus.Homing;
|
|
MessageQueue.Instance.Insert(AxisControl.VacR1.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacR2.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacR3.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacR4.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacR5.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacR6.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacR7.Home().ToString());
|
|
|
|
MessageQueue.Instance.Insert(AxisControl.VacZ1.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacZ2.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacZ3.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacZ4.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacZ5.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacZ6.Home().ToString());
|
|
MessageQueue.Instance.Insert(AxisControl.VacZ7.Home().ToString());
|
|
|
|
MessageQueue.Instance.Insert(AxisControl.VacB.Home().ToString());
|
|
homeStep++;
|
|
break;
|
|
case 1://等待所有Z轴回原完成
|
|
AxisControl.VacZ1.IsHomed(out bool bZ1Homed);
|
|
AxisControl.VacZ2.IsHomed(out bool bZ2Homed);
|
|
AxisControl.VacZ3.IsHomed(out bool bZ3Homed);
|
|
AxisControl.VacZ4.IsHomed(out bool bZ4Homed);
|
|
AxisControl.VacZ5.IsHomed(out bool bZ5Homed);
|
|
AxisControl.VacZ6.IsHomed(out bool bZ6Homed);
|
|
AxisControl.VacZ7.IsHomed(out bool bZ7Homed);
|
|
|
|
AxisControl.VacR1.IsHomed(out bool bR1Homed);
|
|
AxisControl.VacR2.IsHomed(out bool bR2Homed);
|
|
AxisControl.VacR3.IsHomed(out bool bR3Homed);
|
|
AxisControl.VacR4.IsHomed(out bool bR4Homed);
|
|
AxisControl.VacR5.IsHomed(out bool bR5Homed);
|
|
AxisControl.VacR6.IsHomed(out bool bR6Homed);
|
|
AxisControl.VacR7.IsHomed(out bool bR7Homed);
|
|
AxisControl.VacB.IsHomed(out bool bBHomed);
|
|
|
|
if (bZ1Homed && bZ2Homed&&bZ3Homed&&bZ4Homed&&bZ5Homed&&bZ6Homed&&bZ7Homed &&
|
|
bR1Homed && bR2Homed && bR3Homed && bR4Homed && bR5Homed && bR6Homed && bR7Homed && bBHomed)
|
|
{
|
|
MessageQueue.Instance.Insert("所有ZR轴回零完成");
|
|
m_bHomed = true;
|
|
//回零完成,结束
|
|
MachineManage.Instance.MachineStatus = EMachineStatus.Homed;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|