test function changed a bit

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@166 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2012-03-28 08:30:52 +00:00
parent af4262aa42
commit b227ad1b0c
2 changed files with 28 additions and 10 deletions

View File

@ -372,7 +372,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
i++; i++;
descrToFuncMap[i].m_pFuncName="reg_rw"; // descrToFuncMap[i].m_pFuncName="reg"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRegister; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRegister;
i++; i++;
@ -2591,10 +2591,10 @@ string slsDetectorCommand::helpRegister(int narg, char *args[], int action) {
ostringstream os; ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION) { if (action==PUT_ACTION || action==HELP_ACTION) {
os << "reg_rw addr val \n writes the register addr with the value val"<< std::endl; os << "reg addr val \n writes the register addr with the value val"<< std::endl;
} }
if (action==GET_ACTION || action==HELP_ACTION) { if (action==GET_ACTION || action==HELP_ACTION) {
os << "reg_rw addr \n reads the register addr"<< std::endl; os << "reg addr \n reads the register addr"<< std::endl;
} }
return os.str(); return os.str();

View File

@ -2968,25 +2968,41 @@ float slsDetectorUtils::getCurrentProgress() {
int slsDetectorUtils::testFunction(int times) { int slsDetectorUtils::testFunction(int times) {
int i,count=0; int i,count=0;
runStatus s; runStatus s;
char controlval[1000];
char statusval[1000];
int nchans = getTotalNumberOfChannels(); int nchans = getTotalNumberOfChannels();
short int dataVals[nchans]; short int dataVals[nchans];
for(i=0;i<times;i++){ for(i=0;i<times;i++){
std::cout<<std::endl<<dec<<i+1<<": \t"; sprintf(statusval,"%x",readRegister(0x25));
std::cout<<std::endl<<dec<<i+1<<": \t"<<statusval<<"\t";
usleep(10000);
startAcquisition(); startAcquisition();
//sprintf(statusval,"%x",readRegister(0x25));
//std::cout<<statusval<<std::endl;
s = getRunStatus(); s = getRunStatus();
if(s==IDLE){ if(s==IDLE){
std::cout<<"IDLE\t"<<std::endl;
s = getRunStatus(); s = getRunStatus();
if(s==IDLE) if(s==IDLE){
std::cout<<"IDLE"<<std::endl; std::cout<<"IDLE"<<std::endl;
exit(-1);
}
} }
else if (s==RUNNING){ else {
if (s==RUNNING){
count=0; count=0;
while(s==RUNNING){ while(s==RUNNING){
count++; count++;
if(count==5){ if(count==5){
std::cout<<"STUCK"<<std::endl; sprintf(statusval,"%x",readRegister(0x25));
std::cout<<"STUCK: "<<statusval<<std::endl;
exit(-1); exit(-1);
} }
usleep(2); usleep(2);
@ -2994,10 +3010,11 @@ int slsDetectorUtils::testFunction(int times) {
s = getRunStatus(); s = getRunStatus();
} }
} }
else{
std::cout<<"\nWeird Status.Exit\n";
exit(-1);
} }
/* else{
std::cout<<"\nWeird Status. "<<runStatusType(s)<<" Exit\n";
exit(-1);
}*/
system("rm ~/wORKSPACE/scratch/run* "); system("rm ~/wORKSPACE/scratch/run* ");
//system("more ~/wORKSPACE/scratch/run* "); //system("more ~/wORKSPACE/scratch/run* ");
usleep(1000000); usleep(1000000);
@ -3011,6 +3028,7 @@ int slsDetectorUtils::testFunction(int times) {
processData(1); processData(1);
setThreadedProcessing(b); setThreadedProcessing(b);
if(!readDataFile("/home/l_maliakal_d/wORKSPACE/scratch/run_1.raw",dataVals)){ if(!readDataFile("/home/l_maliakal_d/wORKSPACE/scratch/run_1.raw",dataVals)){
std::cout<< "Could not open file "<< std::endl; std::cout<< "Could not open file "<< std::endl;
exit(-1); exit(-1);