put trimval should work also for MYTHEN

This commit is contained in:
2017-11-21 12:09:52 +01:00
parent 7c9958db04
commit 45e0cf71eb
5 changed files with 72 additions and 66 deletions

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repsitory UUID: 1fd03e9cdd01efd75e3ab8641be71d61b2e1aa10 Repsitory UUID: 73bad32c4ab2c8cfb2687547f7da6f932b358c1a
Revision: 1566 Revision: 1604
Branch: 3.0.1 Branch: developer
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Thattil
Last Changed Rev: 1571 Last Changed Rev: 1609
Last Changed Date: 2017-10-03 14:12:22.000000002 +0200 ./slsDetector/slsDetector.cpp Last Changed Date: 2017-11-07 09:50:45.000000002 +0100 ./threadFiles/ThreadPool.o

View File

@ -4598,46 +4598,46 @@ int multiSlsDetector::setAllTrimbits(int val, int imod){
// single // single
{ {
int id=-1, im=-1; int id=-1, im=-1;
if (decodeNMod(imod, id, im)>=0) { if (decodeNMod(imod, id, im)>=0) {
if(detectors[id]){ if(detectors[id]){
ret = detectors[id]->setAllTrimbits(val,im); ret = detectors[id]->setAllTrimbits(val,im);
if(detectors[id]->getErrorMask()) if(detectors[id]->getErrorMask())
setErrorMask(getErrorMask()|(1<<id)); setErrorMask(getErrorMask()|(1<<id));
return ret; return ret;
} }
return -1; return -1;
} }
} }
// multi // multi
if(!threadpool){ if(!threadpool){
cout << "Error in creating threadpool. Exiting" << endl; cout << "Error in creating threadpool. Exiting" << endl;
return -1; return -1;
} }
int* iret[thisMultiDetector->numberOfDetectors]; int* iret[thisMultiDetector->numberOfDetectors];
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){ for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
if(detectors[idet]){ if(detectors[idet]){
iret[idet]= new int(-1); iret[idet]= new int(-1);
Task* task = new Task(new func2_t<int,int,int>(&slsDetector::setAllTrimbits, Task* task = new Task(new func2_t<int,int,int>(&slsDetector::setAllTrimbits,
detectors[idet],val,imod,iret[idet])); detectors[idet],val,imod,iret[idet]));
threadpool->add_task(task); threadpool->add_task(task);
} }
} }
threadpool->startExecuting(); threadpool->startExecuting();
threadpool->wait_for_tasks_to_complete(); threadpool->wait_for_tasks_to_complete();
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){ for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
if(detectors[idet]){ if(detectors[idet]){
if(iret[idet] != NULL){ if(iret[idet] != NULL){
if (ret==-100) if (ret==-100)
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=-1; ret=-1;
delete iret[idet]; delete iret[idet];
}else ret=-1; }else ret=-1;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
} }
} }
return ret; return ret;
} }

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git" #define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUIDLIB "1fd03e9cdd01efd75e3ab8641be71d61b2e1aa10" #define SVNREPUUIDLIB "73bad32c4ab2c8cfb2687547f7da6f932b358c1a"
//#define SVNREV 0x1571 //#define SVNREV 0x1609
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTHLIB "Dhanya_Maliakal" #define SVNAUTHLIB "Dhanya_Thattil"
#define SVNREVLIB 0x1571 #define SVNREVLIB 0x1609
#define SVNDATELIB 0x20171003 #define SVNDATELIB 0x20171107
// //

View File

@ -7526,24 +7526,30 @@ int slsDetector::setAllTrimbits(int val, int imod){
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Setting all trimbits to "<< val << std::endl; std::cout<< "Setting all trimbits to "<< val << std::endl;
#endif #endif
if (getDetectorsType() == MYTHEN) {
if (thisDetector->onlineFlag==ONLINE_FLAG) { if (val>=0) {
if (connectControl() == OK){ setChannel((val<<((int)TRIMBIT_OFF))|((int)COMPARATOR_ENABLE)); // trimbit scan
controlSocket->SendDataOnly(&fnum,sizeof(fnum)); }
controlSocket->SendDataOnly(&val,sizeof(val)); return val;
controlSocket->ReceiveDataOnly(&ret,sizeof(ret)); } else {
if (ret==FAIL) { if (thisDetector->onlineFlag==ONLINE_FLAG) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess)); if (connectControl() == OK){
std::cout<< "Detector returned error: " << mess << std::endl; controlSocket->SendDataOnly(&fnum,sizeof(fnum));
setErrorMask((getErrorMask())|(ALLTIMBITS_NOT_SET)); controlSocket->SendDataOnly(&val,sizeof(val));
} else { controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
controlSocket->ReceiveDataOnly(&retval,sizeof(retval)); if (ret==FAIL) {
} controlSocket->ReceiveDataOnly(mess,sizeof(mess));
disconnectControl(); std::cout<< "Detector returned error: " << mess << std::endl;
if (ret==FORCE_UPDATE) setErrorMask((getErrorMask())|(ALLTIMBITS_NOT_SET));
updateDetector(); } else {
} controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
} }
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
}
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "All trimbits were set to "<< retval << std::endl; std::cout<< "All trimbits were set to "<< retval << std::endl;

View File

@ -4532,14 +4532,14 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
return string("done"); return string("done");
} else if (cmd=="trimval") { } else if (cmd=="trimval") {
if (action==PUT_ACTION){ if (action==PUT_ACTION){
if (sscanf(args[1],"%d",&val)) if (sscanf(args[1],"%d",&val))
myDet->setAllTrimbits(val); myDet->setAllTrimbits(val);
else else
return string("invalid trimbit value ")+cmd; return string("invalid trimbit value ")+cmd;
} }
sprintf(ans,"%d",myDet->setAllTrimbits(-1)); sprintf(ans,"%d",myDet->setAllTrimbits(-1));
return ans; return ans;
} else if (cmd=="pedestal") { } else if (cmd=="pedestal") {
if (action==GET_ACTION) if (action==GET_ACTION)
return string("cannot get"); return string("cannot get");