put trimval should work also for MYTHEN

This commit is contained in:
bergamaschi 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
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
Repsitory UUID: 1fd03e9cdd01efd75e3ab8641be71d61b2e1aa10
Revision: 1566
Branch: 3.0.1
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 1571
Last Changed Date: 2017-10-03 14:12:22.000000002 +0200 ./slsDetector/slsDetector.cpp
Repsitory UUID: 73bad32c4ab2c8cfb2687547f7da6f932b358c1a
Revision: 1604
Branch: developer
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 1609
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
{
int id=-1, im=-1;
if (decodeNMod(imod, id, im)>=0) {
if(detectors[id]){
ret = detectors[id]->setAllTrimbits(val,im);
if(detectors[id]->getErrorMask())
setErrorMask(getErrorMask()|(1<<id));
return ret;
}
return -1;
}
int id=-1, im=-1;
if (decodeNMod(imod, id, im)>=0) {
if(detectors[id]){
ret = detectors[id]->setAllTrimbits(val,im);
if(detectors[id]->getErrorMask())
setErrorMask(getErrorMask()|(1<<id));
return ret;
}
return -1;
}
}
// multi
if(!threadpool){
cout << "Error in creating threadpool. Exiting" << endl;
return -1;
cout << "Error in creating threadpool. Exiting" << endl;
return -1;
}
int* iret[thisMultiDetector->numberOfDetectors];
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
if(detectors[idet]){
iret[idet]= new int(-1);
Task* task = new Task(new func2_t<int,int,int>(&slsDetector::setAllTrimbits,
if(detectors[idet]){
iret[idet]= new int(-1);
Task* task = new Task(new func2_t<int,int,int>(&slsDetector::setAllTrimbits,
detectors[idet],val,imod,iret[idet]));
threadpool->add_task(task);
}
threadpool->add_task(task);
}
}
threadpool->startExecuting();
threadpool->wait_for_tasks_to_complete();
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
if(detectors[idet]){
if(iret[idet] != NULL){
if (ret==-100)
ret=*iret[idet];
else if (ret!=*iret[idet])
ret=-1;
delete iret[idet];
}else ret=-1;
if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet));
}
if(detectors[idet]){
if(iret[idet] != NULL){
if (ret==-100)
ret=*iret[idet];
else if (ret!=*iret[idet])
ret=-1;
delete iret[idet];
}else ret=-1;
if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet));
}
}
return ret;
}

View File

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

View File

@ -7526,24 +7526,30 @@ int slsDetector::setAllTrimbits(int val, int imod){
#ifdef VERBOSE
std::cout<< "Setting all trimbits to "<< val << std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&val,sizeof(val));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(ALLTIMBITS_NOT_SET));
} else {
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
}
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
if (getDetectorsType() == MYTHEN) {
if (val>=0) {
setChannel((val<<((int)TRIMBIT_OFF))|((int)COMPARATOR_ENABLE)); // trimbit scan
}
return val;
} else {
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&val,sizeof(val));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL) {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(ALLTIMBITS_NOT_SET));
} else {
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
}
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
}
#ifdef VERBOSE
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");
} else if (cmd=="trimval") {
if (action==PUT_ACTION){
if (sscanf(args[1],"%d",&val))
myDet->setAllTrimbits(val);
else
return string("invalid trimbit value ")+cmd;
}
sprintf(ans,"%d",myDet->setAllTrimbits(-1));
return ans;
if (action==PUT_ACTION){
if (sscanf(args[1],"%d",&val))
myDet->setAllTrimbits(val);
else
return string("invalid trimbit value ")+cmd;
}
sprintf(ans,"%d",myDet->setAllTrimbits(-1));
return ans;
} else if (cmd=="pedestal") {
if (action==GET_ACTION)
return string("cannot get");