Commit c1b3d3dd authored by Yuelong Yu's avatar Yuelong Yu
Browse files

changed refresh rate of live image.

fixed problem of timeout when the master server tries to coonect to slave one.
parent 0c2eab09
...@@ -266,11 +266,13 @@ namespace AGIPD_ns ...@@ -266,11 +266,13 @@ namespace AGIPD_ns
*/ */
void UpdateLiveImage() void UpdateLiveImage()
{ {
int nNum = 10;
//analog one //analog one
if((m_lCurrentFrameNo%2)!=0) if((m_lCurrentFrameNo%2)!=0)
{ {
//in live mode //in live mode
if(m_bLiveMode && ((m_lCurrentFrameNo+1)%704 == 0)) if(m_bLiveMode && ((m_lCurrentFrameNo+1)%nNum == 0))
{ {
copy(m_ptrShData,m_ptrShData+m_nX*m_nY,m_objAGIPD->attr_LiveDataAnalog_read); copy(m_ptrShData,m_ptrShData+m_nX*m_nY,m_objAGIPD->attr_LiveDataAnalog_read);
*(m_objAGIPD->attr_LiveFrameNoAnalog_read) = m_lCurrentFrameNo; *(m_objAGIPD->attr_LiveFrameNoAnalog_read) = m_lCurrentFrameNo;
...@@ -278,7 +280,7 @@ namespace AGIPD_ns ...@@ -278,7 +280,7 @@ namespace AGIPD_ns
} }
else //digital one else //digital one
{ {
if(m_bLiveMode && ( m_lCurrentFrameNo%704 == 0)) if(m_bLiveMode && ( m_lCurrentFrameNo%nNum == 0))
{ {
copy(m_ptrShData,m_ptrShData+m_nX*m_nY,m_objAGIPD->attr_LiveDataDigital_read); copy(m_ptrShData,m_ptrShData+m_nX*m_nY,m_objAGIPD->attr_LiveDataDigital_read);
*(m_objAGIPD->attr_LiveFrameNoDigital_read) = m_lCurrentFrameNo; *(m_objAGIPD->attr_LiveFrameNoDigital_read) = m_lCurrentFrameNo;
......
...@@ -254,9 +254,11 @@ namespace AGIPDMaster_ns ...@@ -254,9 +254,11 @@ namespace AGIPDMaster_ns
cout<<strDP<<endl; cout<<strDP<<endl;
Tango::DeviceProxy* objDP = new Tango::DeviceProxy(strDP);
WaitForState(objDP,Tango::OFF);
try try
{ {
Tango::DeviceProxy* objDP = new Tango::DeviceProxy(strDP);
objDP->ping(); objDP->ping();
m_vobjDP.push_back(objDP); m_vobjDP.push_back(objDP);
usleep(100); usleep(100);
...@@ -2065,5 +2067,48 @@ namespace AGIPDMaster_ns ...@@ -2065,5 +2067,48 @@ namespace AGIPDMaster_ns
} }
void AGIPDMaster::WaitForState(Tango::DeviceProxy* objDP,int nState)
{
sleep(1);
int nCount = 0;
int nMax = 100;
//cout<<"Starting state poll loop"<<endl;
while(true)
{
if(nCount > nMax)
{
cout<<"Timeout"<<endl;
exit(1);
}
try
{
if( objDP->state() != nState )
{
sleep(0.5);
nCount++;
}
else
break;
}
catch(Tango::DevFailed& df)
{
for(int err=0; err<df.errors.length(); err++)
{
cout<<"Error: " << df.errors[err].desc.in() <<endl;
}
nCount++;
}
catch(...)
{
cout<<"Mysterious exception caught by (...)"<<endl;
nCount++;
}
}
//cout<<"Exiting wait loop"<<endl;
}
/*----- PROTECTED REGION END -----*/ // AGIPDMaster::namespace_ending /*----- PROTECTED REGION END -----*/ // AGIPDMaster::namespace_ending
} // namespace } // namespace
...@@ -585,7 +585,7 @@ public: ...@@ -585,7 +585,7 @@ public:
bool ReadAttrBool(string strAttr); bool ReadAttrBool(string strAttr);
string ReadAttrStr(string strAttr); string ReadAttrStr(string strAttr);
void WaitForState(Tango::DeviceProxy* objDP,int nState);
/*----- PROTECTED REGION END -----*/ // AGIPDMaster::Additional Method prototypes /*----- PROTECTED REGION END -----*/ // AGIPDMaster::Additional Method prototypes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment