BufferHomeRoutine.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Routine;
  4. using Aitex.Core.RT.SCCore;
  5. using JetEfemLib.Aligners;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Aligners;
  8. namespace JetEfemLib.Buffers
  9. {
  10. class BufferHomeRoutine : ModuleRoutineBase, IStepRoutine
  11. {
  12. enum RoutineStep
  13. {
  14. ClearError,
  15. Home,
  16. QueryStatus,
  17. End,
  18. }
  19. private int _timeout = 0;
  20. FutureBuffer _buffer = null;
  21. public BufferHomeRoutine(ModuleName module) : base(module.ToString())
  22. {
  23. Name = "Home";
  24. }
  25. public bool Initalize()
  26. {
  27. return true;
  28. }
  29. public RState Start(params object[] objs)
  30. {
  31. Reset();
  32. _timeout = SC.GetValue<int>("EFEM.Aligner.HomeTimeout");
  33. _buffer = DEVICE.GetDevice<FutureBuffer>($"{Module}");
  34. return Runner.Start(Module, Name);
  35. }
  36. public RState Monitor()
  37. {
  38. Runner.Run(RoutineStep.Home, Home, NullFun, _timeout * 1000)
  39. .End(RoutineStep.End, NullFun, _delay_50ms);
  40. return Runner.Status;
  41. }
  42. bool Home()
  43. {
  44. string reason;
  45. Notify($"Start home {_buffer.Name}");
  46. if (!_buffer.Home(out reason))
  47. {
  48. Stop(reason);
  49. return false;
  50. }
  51. return true;
  52. }
  53. public void Abort()
  54. {
  55. }
  56. }
  57. }