|
@@ -28,8 +28,8 @@ const long g_nMicrocopeConnectTimeOutMilliSeconds = 2000;
|
|
|
const long g_nSinglePointCollectDelay = 3000;
|
|
|
const long g_nSingleFeatureCollectDelay = 5000;
|
|
|
const long g_nXrayControllerConnectTimeOutMilliSeconds = 10000;
|
|
|
-const long g_nImageTimeOutMilliSeconds = 30000;
|
|
|
-const long g_nStageTimeOutMilliSeconds = 30000;
|
|
|
+const long g_nImageTimeOutMilliSeconds = 20000;
|
|
|
+const long g_nStageTimeOutMilliSeconds = 10000;
|
|
|
|
|
|
|
|
|
|
|
@@ -317,6 +317,21 @@ void OxfordControllerWrapper::ControllerThreadFunction()
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
+ case OxfordControllerCommand::SET_POSITIONXY:
|
|
|
+ {
|
|
|
+ if (SetPositionXYToController(_oxfordControllerData.m_dPositionX, _oxfordControllerData.m_dPositionY))
|
|
|
+ {
|
|
|
+ _oxfordControllerData.m_nState = OxfordControllerState::SUCCEEDED;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _oxfordControllerData.m_nState = OxfordControllerState::FAILED;
|
|
|
+ }
|
|
|
+
|
|
|
+ m_endControllerEvent->Set();
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
case OxfordControllerCommand::STOP_ACQUISITION:
|
|
|
{
|
|
|
auto edsController = CreateEdsSpectrumController();
|
|
@@ -469,26 +484,38 @@ bool OxfordControllerWrapper::SetPositionXY(const double a_dPosX, const double a
|
|
|
_oxfordControllerData.m_dPositionX = a_dPosX;
|
|
|
_oxfordControllerData.m_dPositionY = a_dPosY;
|
|
|
m_bIsStageUpdated = false;
|
|
|
-
|
|
|
- if (SetPositionXYToController(_oxfordControllerData.m_dPositionX, _oxfordControllerData.m_dPositionY))
|
|
|
- {
|
|
|
- _oxfordControllerData.m_nState = OxfordControllerState::SUCCEEDED;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _oxfordControllerData.m_nState = OxfordControllerState::FAILED;
|
|
|
- }
|
|
|
- double waitTime=0;
|
|
|
- while (!m_bIsStageUpdated)//m_bIsStageUpdated will be set by the callback event.
|
|
|
+ m_startControllerEvent->Set();
|
|
|
+ long nCollectedTime = 0;
|
|
|
+ while (true)
|
|
|
{
|
|
|
- Sleep(100);
|
|
|
- waitTime += 0.1;
|
|
|
- if (waitTime > 10)//prevent the m_bIsStageUpdated won't be set ,we will wait only 10s.
|
|
|
+ if (m_bIsStageUpdated)
|
|
|
+ {
|
|
|
+ if (m_endControllerEvent->WaitOne(0, true))
|
|
|
+ {
|
|
|
+ m_endControllerEvent->Reset();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Application::DoEvents();
|
|
|
+ Thread::Sleep(g_nOxfordControllerEventSleepTimerInt);
|
|
|
+
|
|
|
+
|
|
|
+ long nCollectedTimeLimit = g_nStageTimeOutMilliSeconds;
|
|
|
+ nCollectedTime += g_nOxfordControllerEventSleepTimerInt;
|
|
|
+ if (nCollectedTime > nCollectedTimeLimit)
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+ _oxfordControllerData.m_nState = OxfordControllerState::FAILED;
|
|
|
+
|
|
|
+
|
|
|
+ m_endControllerEvent->Reset();
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if (_oxfordControllerData.m_nState == OxfordControllerState::SUCCEEDED)
|
|
|
{
|
|
@@ -500,6 +527,45 @@ bool OxfordControllerWrapper::SetPositionXY(const double a_dPosX, const double a
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //---------------------------------------------------new method
|
|
|
+
|
|
|
+ //_oxfordControllerData.m_nCommand = OxfordControllerCommand::SET_POSITIONXY;
|
|
|
+
|
|
|
+ //_oxfordControllerData.m_dPositionX = a_dPosX;
|
|
|
+ //_oxfordControllerData.m_dPositionY = a_dPosY;
|
|
|
+ //m_bIsStageUpdated = false;
|
|
|
+
|
|
|
+ //if (SetPositionXYToController(_oxfordControllerData.m_dPositionX, _oxfordControllerData.m_dPositionY))
|
|
|
+ //{
|
|
|
+ // _oxfordControllerData.m_nState = OxfordControllerState::SUCCEEDED;
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // _oxfordControllerData.m_nState = OxfordControllerState::FAILED;
|
|
|
+ //}
|
|
|
+ //double waitTime=0;
|
|
|
+ //while (!m_bIsStageUpdated)//m_bIsStageUpdated will be set by the callback event.
|
|
|
+ //{
|
|
|
+ // Sleep(100);
|
|
|
+ // waitTime += 0.1;
|
|
|
+ // if (waitTime > 10)//prevent the m_bIsStageUpdated won't be set ,we will wait only 10s.
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //
|
|
|
+
|
|
|
+ //if (_oxfordControllerData.m_nState == OxfordControllerState::SUCCEEDED)
|
|
|
+ //{
|
|
|
+ // return true;
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|