Commit 2a148e3c authored by Yuelong Yu's avatar Yuelong Yu
Browse files

bug fixing

parent d6cb66ac
......@@ -256,6 +256,11 @@ void AGIPDMC::init_device()
cout<<e.what()<<endl;
exit(0);
}
catch(...)
{
cout<<"unknown exception caught"<<endl;
exit(0);
}
m_thData = new UpdateDataThread(this,m_sptrDP.get(),m_mtxData);
......@@ -874,31 +879,31 @@ void AGIPDMC::start_asics()
void AGIPDMC::RunCycle(int nMode)
{
// SetState(Tango::MOVING);
SetState(Tango::MOVING);
// bool bTrue = WriteAttr<Tango::DevShort>("OpMode",nMode);
bool bTrue = WriteAttr<Tango::DevShort>("OpMode",nMode);
// //aux and analog voltage
// if(nMode == 3)
// bTrue = bTrue && WriteAttr<Tango::DevShort>("AUX",1);
//aux and analog voltage
if(nMode == 3)
bTrue = bTrue && WriteAttr<Tango::DevShort>("AUX",1);
// //if device is in automatic mode
// // check if automatic == 0
// // automatic is not 0, then Execute command is necessary to update the matrix.
// // otherwise, matrix will not be updated.
// // automatic is 1 then it is not.
// // bTrue = bTrue && RunCommand("Execute");
//if device is in automatic mode
// check if automatic == 0
// automatic is not 0, then Execute command is necessary to update the matrix.
// otherwise, matrix will not be updated.
// automatic is 1 then it is not.
bTrue = bTrue && RunCommand("Execute");
// if(bTrue)
// {
// omni_mutex_lock l(m_mtxData);
// m_nOpMode = nMode;
// }
// else
// {
// SetStatus("This step is failed. Please retry it.");
// SetState(Tango::ON);
// }
if(bTrue)
{
omni_mutex_lock l(m_mtxData);
m_nOpMode = nMode;
}
else
{
SetStatus("This step is failed. Please retry it.");
SetState(Tango::ON);
}
}
/*----- PROTECTED REGION ID(AGIPDMC::namespace_ending) ENABLED START -----*/
......
......@@ -52,16 +52,17 @@ namespace AGIPDMC_ns
short shHigh = vshData[0];
short shLow = vshData[1];
cout<<" high: "<<shHigh<<" low: "<<shLow<<endl;
//cout<<" high: "<<shHigh<<" low: "<<shLow<<endl;
return (((int)(shLow & 0xff))<<24
+ (((int)(shLow & 0xff00))>>8)<<16
+ ((int)(shHigh & 0xff))<<8
+ ((int)(shHigh & 0xff00))>>8);
return (((int)shHigh)<<16) | ((int)shLow);
}
void UpdateDataThread::ReadOutSpectrum(string strAttrName)
{
if(m_nRunningMode == 0)
m_objAGIPDMC->RunCommand("Execute");
//cout<<"Read out spectrum"<<endl;
try
{
......@@ -81,27 +82,28 @@ namespace AGIPDMC_ns
if(!m_vMatrixData.empty())
{
UpdateTemperatures();
// int nCounter = GetMatrixCounter(m_vMatrixData);
// //get new matrix
// if(m_nCurrentCounter < nCounter)
// {
// m_nCurrentCounter = nCounter;
int nCounter = GetMatrixCounter(m_vMatrixData);
cout<<"counter"<<nCounter<<endl;
//get new matrix
if(m_nCurrentCounter < nCounter)
{
m_nCurrentCounter = nCounter;
// m_objAGIPDMC->m_nDataLength = nLen;
// std::copy(m_vMatrixData.begin(),
// m_vMatrixData.end(),
// (m_objAGIPDMC->attr_RawMatrix_read));
m_objAGIPDMC->m_nDataLength = nLen;
std::copy(m_vMatrixData.begin(),
m_vMatrixData.end(),
(m_objAGIPDMC->attr_RawMatrix_read));
// m_uptrMC->SetRawData(m_vMatrixData);
m_uptrMC->SetRawData(m_vMatrixData);
// //0 : power up step
// if(m_nRunningMode == 0)
// PowerCycle();
// //1 : normal run step. update temperatures
// else if(m_nRunningMode == 1)
// UpdateTemperatures();
// }
//0 : power up step
if(m_nRunningMode == 0)
PowerCycle();
//1 : normal run step. update temperatures
else if(m_nRunningMode == 1)
UpdateTemperatures();
}
}
//cout<<"read"<<endl;
......@@ -116,7 +118,7 @@ namespace AGIPDMC_ns
}
catch(...)
{
//cout<<"unknown exception caught"<<endl;
cout<<"read spectrum:unknown exception caught"<<endl;
}
}
......
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