瀏覽代碼

revise saveopen/saveclose

chenzk 1 天之前
父節點
當前提交
48af58ca91
共有 2 個文件被更改,包括 26 次插入15 次删除
  1. 0 2
      CyberX8_Core/RtState.cs
  2. 26 13
      CyberX8_RT/Modules/EFEM/EfemEntity.cs

+ 0 - 2
CyberX8_Core/RtState.cs

@@ -76,8 +76,6 @@ namespace CyberX8_Core
         ErrorPlacing,
         RobotCycleing,
         ErrorInitingAL,
-        Pause,
-        Resumeing
     }
     public enum PUFSTATE
     {

+ 26 - 13
CyberX8_RT/Modules/EFEM/EfemEntity.cs

@@ -45,6 +45,7 @@ namespace CyberX8_RT.Modules
 
         private bool _isVacuume = false;
         private bool _isPause = false;
+        private bool _isResume = false;
 
         public enum STATE
         {
@@ -77,8 +78,6 @@ namespace CyberX8_RT.Modules
             ErrorPlacing,
             RobotCycleing,
             ErrorInitingAL,
-            Pause,
-            Resumeing
         }
 
         public enum MSG
@@ -132,8 +131,6 @@ namespace CyberX8_RT.Modules
             ReadTagData,
             WriteTagData,
             RobotCycle,
-            Pause,
-            Resume
         
            
         }
@@ -426,12 +423,6 @@ namespace CyberX8_RT.Modules
             AnyStateTransition(MSG.CloseBuzzer,          fnCloseBuzzer, FSM_STATE.SAME);
             AnyStateTransition(MSG.CloseBuzzer,          fnCloseBuzzer, FSM_STATE.SAME);
             
-            AnyStateTransition(MSG.Pause, EnterPause, STATE.Pause);
-
-            //Resume
-            Transition(STATE.Pause, MSG.Resume, EnterResume, STATE.Resumeing);
-            Transition(STATE.Resumeing, FSM_MSG.TIMER, fnResumeTimeout, STATE.Init);
-
             Transition(STATE.Unknown,MSG.CommReady, fnCommReady, STATE.Init);
             //Error
             Transition(STATE.Error, MSG.Recover, fnRecover, STATE.Idle);
@@ -725,6 +716,14 @@ namespace CyberX8_RT.Modules
                     _isPause = false;
                 }
             }
+            if (_isResume)
+            {
+                bool result = SafeCloseActionTimeout();
+                if (result)
+                {
+                    _isResume = false;
+                }
+            }
             // robot idle check
             _robotIdleTrigger.CLK = _efem.Status != RState.Running;
             if (_robotIdleTrigger.Q)
@@ -1214,6 +1213,17 @@ namespace CyberX8_RT.Modules
             return ret == RState.End;
         }
 
+        private bool SafeCloseActionTimeout()
+        {
+            RState ret = _efemSafeCloseRoutine.Monitor();
+            if (ret == RState.Failed || ret == RState.Timeout)
+            {
+                LOG.Write(eEvent.ERR_EFEM_COMMON_FAILED, ModuleName.EFEM, "SafeClose");
+                return false;
+            }
+            return ret == RState.End;
+        }
+
         private bool fnMap(object[] param)
         {
             // module
@@ -1250,7 +1260,6 @@ namespace CyberX8_RT.Modules
 
         private bool SafeOpenAction(object[] param)
         {
-            PostMsg(MSG.Pause);
             bool result = _efemSafeOpenRoutine.Start() == RState.Running;
             if (result)
             {
@@ -1261,8 +1270,12 @@ namespace CyberX8_RT.Modules
 
         private bool SafeCloseAction(object[] param)
         {
-            CheckToPostMessage<STATE, MSG>(eEvent.ERR_EFEM_COMMON_FAILED, "EFEM", (int)MSG.Resume);
-            return _efemSafeCloseRoutine.Start() == RState.Running;
+            bool result = _efemSafeCloseRoutine.Start() == RState.Running;
+            if (result)
+            {
+                _isResume = true;
+            }
+            return result;
         }
 
         public bool DoorUnlock(object[] param)