From ccf8d7e4d8a29cc91c527be470c90abcb54b8cbe Mon Sep 17 00:00:00 2001 From: HCL <1625932291@qq.com> Date: Fri, 8 Dec 2023 09:29:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=BF=9B=E5=BA=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Robots/Sunway/SunwayRobot.cs | 7 ++-- .../Robots/Sunway/SunwayRobotHandler.cs | 38 +++++++++++++++++-- .../Robots/Sunway/SunwayRobotSimulator.cs | 3 +- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobot.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobot.cs index e54ad2f..b70c4b9 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobot.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobot.cs @@ -701,9 +701,9 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Sunway } } } - else if (data.Length <=10) + else { - if (data == "LOAD A ON") + if (data.Contains("LOAD A ON")) { if (Module=="WaferRobot" && !WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), 0)) { @@ -715,7 +715,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Sunway WaferManager.Instance.CreateTray(ModuleHelper.Converter(Module), 0, TrayStatus.Normal); } } - else if (data == "LOAD A OFF") + else if (data.Contains("LOAD A OFF")) { if (Module == "WaferRobot" && WaferManager.Instance.CheckHasWafer(ModuleHelper.Converter(Module), 0)) { @@ -812,6 +812,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Sunway lock (_locker) { //Robot Home指令包含了清除报警,电机使能,Home动作 + _lstHandler.AddLast(new SunwayRobotSetEchoHandler(this, false)); _lstHandler.AddLast(new SunwayRobotHomeHandler(this, _scMotionTimeout.IntValue)); _lstHandler.AddLast(new SunwayRobotRQLoadHandler(this)); } diff --git a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobotHandler.cs b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobotHandler.cs index 5f00195..d1065c0 100644 --- a/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobotHandler.cs +++ b/MECF.Framework.RT.EquipmentLibrary/HardwareUnits/Robots/Sunway/SunwayRobotHandler.cs @@ -158,7 +158,7 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Sunway }; ResponseMessage = msg; - //Device.NoteActionCompleted(); + Device.IsBusy = false; handled = true; return true; } @@ -590,6 +590,39 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Sunway } } + public class SunwayRobotSetEchoHandler : SunwayRobotHandler + { + //SET IO ECHO Y|N + public SunwayRobotSetEchoHandler(SunwayRobot device, bool isOpen, int timeout = 5) + : base(device, $"SET IO ECHO {(isOpen ? "Y" : "N")}") + { + AckTimeout = TimeSpan.FromSeconds(timeout); + CompleteTimeout = TimeSpan.FromSeconds(timeout); + } + + public override bool HandleMessage(MessageBase msg, out bool handled) + { + var result = msg as SunwayRobotMessage; + handled = false; + if (!result.IsResponse) + { + Device.NoteError("Robot Set IO Echo Command Timeout"); + return true; + } + + if (result.Data.Contains("ERR")) + { + Device.NoteError("Robot Set IO Echo Command Error"); + return false; + } + + ResponseMessage = msg; + Device.IsBusy = false; + handled = true; + return true; + } + } + public class SunwayRobotSTATHandler : SunwayRobotHandler { @@ -1533,9 +1566,6 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Sunway return true; } } - - - public class SunwayRobotMTCSPHandler : SunwayRobotHandler { //前往位置 diff --git a/SimulatorCore/Robots/Sunway/SunwayRobotSimulator.cs b/SimulatorCore/Robots/Sunway/SunwayRobotSimulator.cs index 0800056..5b34ab5 100644 --- a/SimulatorCore/Robots/Sunway/SunwayRobotSimulator.cs +++ b/SimulatorCore/Robots/Sunway/SunwayRobotSimulator.cs @@ -61,6 +61,7 @@ namespace MECF.Framework.Simulator.Core.Robots.Sunway AddCommandHandler("PICK", HandleHome); AddCommandHandler("PLACE", HandleHome); AddCommandHandler("VAC", HandleHome); + AddCommandHandler("SET", HandleHome); AddCommandHandler("SVON", HandleHome); @@ -120,7 +121,7 @@ namespace MECF.Framework.Simulator.Core.Robots.Sunway lastMsg = msg; operateEnum = OperateEnum.Null; - OnWriteMessage("LOAD A ON"); + OnWriteMessage($"LOAD A OFF/r/n_RDY"); }