mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-05 17:40:40 +02:00
Header after/before bug solved in text client - implemented commands to change DACs other than threshold (also for chiptestboard)
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@33 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
be173eaee1
commit
3367bb3026
@ -248,7 +248,13 @@ enum dacIndex {
|
|||||||
SHAPER2, /**< shaper2 feedback */
|
SHAPER2, /**< shaper2 feedback */
|
||||||
TEMPERATURE, /**< temperature sensor (adc) */
|
TEMPERATURE, /**< temperature sensor (adc) */
|
||||||
HUMIDITY, /**< humidity sensor (adc) */
|
HUMIDITY, /**< humidity sensor (adc) */
|
||||||
DETECTOR_BIAS /**< detector bias */
|
DETECTOR_BIAS, /**< detector bias */
|
||||||
|
VA_POT, /**< power supply va */
|
||||||
|
VDD_POT, /**< chiptest board power supply vdd */
|
||||||
|
VSH_POT, /**< chiptest board power supply vsh */
|
||||||
|
VIO_POT, /**< chiptest board power supply va */
|
||||||
|
HV_POT /**< chiptest board high voltage */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -372,7 +378,7 @@ enum correctionFlags {
|
|||||||
enum {
|
enum {
|
||||||
|
|
||||||
// General purpose functions
|
// General purpose functions
|
||||||
F_EXEC_COMMAND, /**< command is executed */
|
F_EXEC_COMMAND=0, /**< command is executed */
|
||||||
F_GET_ERROR, /**< return detector error status */
|
F_GET_ERROR, /**< return detector error status */
|
||||||
|
|
||||||
// configuration functions
|
// configuration functions
|
||||||
|
@ -369,7 +369,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
setAction(ival,args[1]);
|
setAction(ival,args[1]);
|
||||||
}
|
}
|
||||||
sprintf(answer,"%d %s",getActionMode(ival), getActionScript(ival).c_str());
|
if (getActionMode(ival)==0)
|
||||||
|
sprintf(answer,"none");
|
||||||
|
else
|
||||||
|
sprintf(answer,"%s",getActionScript(ival).c_str());
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else if (var=="startscriptpar") {
|
} else if (var=="startscriptpar") {
|
||||||
ival=startScript;
|
ival=startScript;
|
||||||
@ -385,7 +388,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
setAction(ival,args[1]);
|
setAction(ival,args[1]);
|
||||||
}
|
}
|
||||||
sprintf(answer,"%d %s",getActionMode(ival), getActionScript(ival).c_str());
|
if (getActionMode(ival)==0)
|
||||||
|
sprintf(answer,"none");
|
||||||
|
else
|
||||||
|
sprintf(answer,"%s",getActionScript(ival).c_str());
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else if (var=="stopscriptpar") {
|
} else if (var=="stopscriptpar") {
|
||||||
ival=stopScript;
|
ival=stopScript;
|
||||||
@ -399,7 +405,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
setAction(ival,args[1]);
|
setAction(ival,args[1]);
|
||||||
}
|
}
|
||||||
sprintf(answer,"%d %s",getActionMode(ival), getActionScript(ival).c_str());
|
if (getActionMode(ival)==0)
|
||||||
|
sprintf(answer,"none");
|
||||||
|
else
|
||||||
|
sprintf(answer,"%s",getActionScript(ival).c_str());
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else if (var=="scriptbeforepar") {
|
} else if (var=="scriptbeforepar") {
|
||||||
ival=scriptBefore;
|
ival=scriptBefore;
|
||||||
@ -414,7 +423,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
setAction(ival,args[1]);
|
setAction(ival,args[1]);
|
||||||
}
|
}
|
||||||
sprintf(answer,"%d %s",getActionMode(ival), getActionScript(ival).c_str());
|
if (getActionMode(ival)==0)
|
||||||
|
sprintf(answer,"none");
|
||||||
|
else
|
||||||
|
sprintf(answer,"%s",getActionScript(ival).c_str());
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else if (var=="scriptafterpar") {
|
} else if (var=="scriptafterpar") {
|
||||||
ival=scriptAfter;
|
ival=scriptAfter;
|
||||||
@ -430,7 +442,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
setAction(ival,args[1]);
|
setAction(ival,args[1]);
|
||||||
}
|
}
|
||||||
sprintf(answer,"%d %s",getActionMode(ival), getActionScript(ival).c_str());
|
if (getActionMode(ival)==0)
|
||||||
|
sprintf(answer,"none");
|
||||||
|
else
|
||||||
|
sprintf(answer,"%s", getActionScript(ival).c_str());
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else if (var=="headerafterpar") {
|
} else if (var=="headerafterpar") {
|
||||||
ival=headerAfter;
|
ival=headerAfter;
|
||||||
@ -446,7 +461,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
setAction(ival,args[1]);
|
setAction(ival,args[1]);
|
||||||
}
|
}
|
||||||
sprintf(answer,"%d %s",getActionMode(ival), getActionScript(ival).c_str());
|
if (getActionMode(ival)==0)
|
||||||
|
sprintf(answer,"none");
|
||||||
|
else
|
||||||
|
sprintf(answer,"%s", getActionScript(ival).c_str());
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else if (var=="headerbeforepar") {
|
} else if (var=="headerbeforepar") {
|
||||||
ival=headerBefore;
|
ival=headerBefore;
|
||||||
@ -739,7 +757,80 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
|
|||||||
}
|
}
|
||||||
sprintf(answer,"%f",setDAC(-1,THRESHOLD));
|
sprintf(answer,"%f",setDAC(-1,THRESHOLD));
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
} else if (var=="vcalibration") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, CALIBRATION_PULSE);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,CALIBRATION_PULSE));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vtrimbit") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, TRIMBIT_SIZE);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,TRIMBIT_SIZE));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vpreamp") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, PREAMP);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,PREAMP));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vshaper1") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, SHAPER1);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,SHAPER1));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vshaper2") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, SHAPER2);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,SHAPER2));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vhighvoltage") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, HV_POT);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,HV_POT));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vapower") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, VA_POT);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,VA_POT));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vddpower") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, VDD_POT);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,VDD_POT));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="vshpower") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, VSH_POT);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,VSH_POT));
|
||||||
|
return string(answer);
|
||||||
|
} else if (var=="viopower") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
sscanf(args[1],"%f",&fval);
|
||||||
|
setDAC(fval, VIO_POT);
|
||||||
|
}
|
||||||
|
sprintf(answer,"%f",setDAC(-1,VIO_POT));
|
||||||
|
return string(answer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//timers
|
//timers
|
||||||
|
|
||||||
else if (var=="exptime") {
|
else if (var=="exptime") {
|
||||||
@ -1138,6 +1229,28 @@ string mythenDetector::helpLine( int action) {
|
|||||||
os << std::endl;
|
os << std::endl;
|
||||||
os << "vthreshold dacu\t sets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
os << "vthreshold dacu\t sets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
|
|
||||||
|
os << "vcalibration " << "dacu\t sets the calibration pulse amplitude in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vtrimbit " << "dacu\t sets the trimbit amplitude in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vpreamp " << "dacu\t sets the preamp feedback voltage in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vshaper1 " << "dacu\t sets the shaper1 feedback voltage in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vshaper2 " << "dacu\t sets the shaper2 feedback voltage in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vhighvoltage " << "dacu\t CHIPTEST BOARD ONLY - sets the detector HV in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vapower " << "dacu\t CHIPTEST BOARD ONLY - sets the analog power supply in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vddpower " << "dacu\t CHIPTEST BOARD ONLY - sets the digital power supply in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vshpower " << "dacu\t CHIPTEST BOARD ONLY - sets the comparator power supply in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "viopower " << "dacu\t CHIPTEST BOARD ONLY - sets the FPGA I/O power supply in dac units (0-1024)." << std::endl;
|
||||||
|
|
||||||
|
os << std::endl;
|
||||||
os << "exptime t \t Sets the exposure time per frame (in s)"<< std::endl;
|
os << "exptime t \t Sets the exposure time per frame (in s)"<< std::endl;
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
os << "period t \t Sets the frames period (in s)"<< std::endl;
|
os << "period t \t Sets the frames period (in s)"<< std::endl;
|
||||||
@ -1338,6 +1451,27 @@ string mythenDetector::helpLine( int action) {
|
|||||||
os << "vthreshold \t Gets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
os << "vthreshold \t Gets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
|
|
||||||
|
os << "vcalibration " << "dacu\t gets the calibration pulse amplitude in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vtrimbit " << "dacu\t gets the trimbit amplitude in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vpreamp " << "dacu\t gets the preamp feedback voltage in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vshaper1 " << "dacu\t gets the shaper1 feedback voltage in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vshaper2 " << "dacu\t gets the shaper2 feedback voltage in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vhighvoltage " << "dacu\t CHIPTEST BOARD ONLY - gets the detector HV in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vapower " << "dacu\t CHIPTEST BOARD ONLY - gets the analog power supply in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vddpower " << "dacu\t CHIPTEST BOARD ONLY - gets the digital power supply in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "vshpower " << "dacu\t CHIPTEST BOARD ONLY - gets the comparator power supply in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
os << "viopower " << "dacu\t CHIPTEST BOARD ONLY - gets the FPGA I/O power supply in dac units (0-1024)." << std::endl;
|
||||||
|
os << std::endl;
|
||||||
|
|
||||||
|
|
||||||
os << "exptime\t Gets the exposure time per frame (in s)"<< std::endl;
|
os << "exptime\t Gets the exposure time per frame (in s)"<< std::endl;
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
|
@ -1546,7 +1546,7 @@ float slsDetector::setDAC(float val, dacIndex index, int imod){
|
|||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< std::endl;
|
std::cout<< std::endl;
|
||||||
std::cout<< "Setting DAC "<< index << "of module " << imod << " to " << val << std::endl;
|
std::cout<< "Setting DAC/POT "<< index << "of module " << imod << " to " << val << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (controlSocket) {
|
||||||
@ -1557,15 +1557,18 @@ float slsDetector::setDAC(float val, dacIndex index, int imod){
|
|||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
if (dacs) {
|
if (index < thisDetector->nDacs){
|
||||||
if (imod>=0) {
|
|
||||||
*(dacs+index+imod*thisDetector->nDacs)=retval;
|
if (dacs) {
|
||||||
}
|
if (imod>=0) {
|
||||||
else {
|
|
||||||
for (imod=0; imod<thisDetector->nModsMax; imod++)
|
|
||||||
*(dacs+index+imod*thisDetector->nDacs)=retval;
|
*(dacs+index+imod*thisDetector->nDacs)=retval;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (imod=0; imod<thisDetector->nModsMax; imod++)
|
||||||
|
*(dacs+index+imod*thisDetector->nDacs)=retval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
@ -1576,10 +1579,10 @@ float slsDetector::setDAC(float val, dacIndex index, int imod){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Dac set to "<< retval << std::endl;
|
std::cout<< "Dac/Pot set to "<< retval << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
std::cout<< "Set dac failed " << std::endl;
|
std::cout<< "Set dac/pot failed " << std::endl;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user