Bläddra i källkod

move the waiting code to the dedicated thread to increase the respond time.

cxs 3 år sedan
förälder
incheckning
186888e330

+ 4 - 3
OTSCPP/OTSControl/OTSSemBase.cpp

@@ -64,7 +64,7 @@ namespace OTSController {
 		{
 			LogErrorTrace(__FILE__, __LINE__, "COTSSemBase::MoveSEMToPoint: failed to call SetPositionXY method.");
 		}
-		Sleep(2000);
+		//Sleep(2000);
 		while (nAttempTime > 0 && !bInPlace)
 		{
 			
@@ -108,14 +108,15 @@ namespace OTSController {
 					bInPlace = TRUE;
 				}
 			}
+			
 
-			if (!bInPlace)
+			/*if (!bInPlace)
 			{
 
 
 
 				Sleep(1000);
-			}
+			}*/
 
 			// tried once
 			--nAttempTime;

+ 30 - 6
OTSCPP/OTSControl/Oxford/OxfordWrapper/OxfordControllerWrapper.cpp

@@ -29,7 +29,7 @@ const long g_nSinglePointCollectDelay = 3000;
 const long g_nSingleFeatureCollectDelay = 5000;
 const long g_nXrayControllerConnectTimeOutMilliSeconds = 10000;
 const long g_nImageTimeOutMilliSeconds = 20000;
-const long g_nStageTimeOutMilliSeconds = 10000;
+const long g_nStageTimeOutMilliSeconds = 15000;
 
 
 
@@ -327,6 +327,31 @@ void OxfordControllerWrapper::ControllerThreadFunction()
 			{
 				_oxfordControllerData.m_nState = OxfordControllerState::FAILED;
 			}
+			
+			
+
+			long nCollectedTime = 0;
+			while (!m_bIsStageUpdated)
+			{
+				Application::DoEvents();
+				
+				Thread::Sleep(g_nOxfordControllerEventSleepTimerInt);
+
+
+				
+				nCollectedTime += g_nOxfordControllerEventSleepTimerInt;
+				if (nCollectedTime > g_nStageTimeOutMilliSeconds)
+				{
+
+
+					_oxfordControllerData.m_nState = OxfordControllerState::FAILED;
+
+				
+
+					break;
+				}
+			}
+			Thread::Sleep(2000);
 
 			m_endControllerEvent->Set();
 		}
@@ -488,18 +513,17 @@ bool OxfordControllerWrapper::SetPositionXY(const double a_dPosX, const double a
 	long nCollectedTime = 0;
 	while (true)
 	{
-		if (m_bIsStageUpdated)
-		{
+		
 			if (m_endControllerEvent->WaitOne(0, true))
 			{
 				m_endControllerEvent->Reset();
 				break;
 			}
-		}
+		
 
 
 		Application::DoEvents();
-		Thread::Sleep(g_nOxfordControllerEventSleepTimerInt);
+		/*Thread::Sleep(g_nOxfordControllerEventSleepTimerInt);
 
 
 		long nCollectedTimeLimit = g_nStageTimeOutMilliSeconds;
@@ -514,7 +538,7 @@ bool OxfordControllerWrapper::SetPositionXY(const double a_dPosX, const double a
 			m_endControllerEvent->Reset();
 
 			break;
-		}
+		}*/
 	}
 
 	if (_oxfordControllerData.m_nState == OxfordControllerState::SUCCEEDED)