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 AlignerHomeRoutine : ModuleRoutineBase, IStepRoutine { enum RoutineStep { ClearError, Home, QueryStatus, End, } private int _timeout = 0; AlignerBase _aligner = null; public AlignerHomeRoutine(AlignerModuleBase module) : base(module.Module) { Name = "Home"; } public bool Initalize() { return true; } public RState Start(params object[] objs) { Reset(); _aligner = DEVICE.GetDevice($"{Module}.{Module}"); _timeout = SC.GetValue("EFEM.Aligner.HomeTimeout"); if (_aligner.Name == "Cooling1" || _aligner.Name == "Cooling2") { _timeout = SC.GetValue("EFEM.Cooling.HomeTimeout"); } return Runner.Start(_aligner.Module, Name); } public RState Monitor() { Runner.Run(RoutineStep.Home, Home, CheckHome, _timeout * 1000) .End(RoutineStep.End, NullFun, _delay_50ms); return Runner.Status; } bool Home() { string reason; Notify($"Start home {_aligner.Name}"); if (!_aligner.Home(out reason)) { Stop(reason); return false; } return true; } bool CheckHome() { return !(_aligner.IsError || _aligner.IsBusy); } public void Abort() { } } }