using System; using Aitex.Core.RT.Device; using Aitex.Core.RT.Routine; using Aitex.Core.RT.SCCore; using MECF.Framework.Common.Equipment; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners; using MECF.Framework.RT.ModuleLibrary.AlignerModules; namespace JetEfemLib.Aligners { class AlignerAlignRoutine : ModuleRoutineBase, IStepRoutine { enum Align { Align, End, } private int _timeout = 0; private double _angle = 0.0; private AlignerBase _aligner; public AlignerAlignRoutine(AlignerModuleBase module) : base(module.Module) { Name = "Align"; _aligner = DEVICE.GetDevice($"{Module}.{Module}"); _angle = SC.GetValue("EFEM.Aligner.DefaultNotchDegree"); } public bool Initalize() { return true; } public void Init(double notch) { _angle = notch; } public RState Start(params object[] objs) { Reset(); _timeout = SC.GetValue("EFEM.Aligner.AlignTimeout"); Notify($"Start align to {_angle} degree"); //AlignersState.IsAligning = true; return Runner.Start(_aligner.Module, Name); } public RState Monitor() { Runner.Run(Align.Align, AlignWafer, CheckAlignDone, _timeout * 1000) .End(Align.End, NullFun, _delay_50ms); return Runner.Status; } bool AlignWafer() { Notify($"Start align to {_angle} degree"); string reason; if (!_aligner.Align(_angle, out reason)) { Stop(reason); return false; } return true; } bool CheckAlignDone() { return !(_aligner.IsError || _aligner.IsBusy); } public void Abort() { //AlignersState.IsAligning = false; Notify("Abort"); } } }