New Zmq header staructur implemented and works, still different number of pixels in the GUI should be fixed (but it does not crash)

This commit is contained in:
2018-09-25 09:36:47 +02:00
parent 19e7ced332
commit ae8678cdc2
16 changed files with 1505 additions and 182 deletions

View File

@ -391,6 +391,8 @@ enum dacIndex {
M_vIbiasSh, /**< mythen 3 >*/
M_vIcin, /**< mythen 3 >*/
M_vIpreOut, /**< mythen 3 >*/
ZMQ_emin, /**< ZMQ */
ZMQ_emax,/**< ZMQ */
V_POWER_A = 100, /**new chiptest board */
V_POWER_B = 101, /**new chiptest board */
V_POWER_C = 102, /**new chiptest board */

View File

@ -4618,11 +4618,11 @@ int slsDetector::getDataBytesInclGapPixels() {
dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
dacs_t retval[2];
retval[0] = -1;
retval[1] = -1;
if (index!=ZMQ_emin && index!=ZMQ_emax) {
int fnum=F_SET_DAC;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
@ -4683,8 +4683,91 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
}
if(mV)
return retval[1];
} else if(thisDetector->myDetectorType==JUNGFRAUCTB) {
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Old json header: " << header << std::endl;
return retval[0];
if (index==ZMQ_emin) {
size_t pos0, pos1;
pos0=header.find(",\"eMin\"");
if (pos0==std::string::npos) {
pos0=header.find("\"eMin\"");
} else pos0++;
if (pos0!=std::string::npos) {
pos1=header.find_first_of(",",pos0);
// std::cout << pos0 << " " << pos1 << std::endl;
std::cout<< "Replacing old eMin: " << header.substr(pos0,pos1-pos0) << std::endl;
// if (pos1!=std::string::npos)
if (val>=0)
header.erase(pos0,pos1-pos0);
// else
// header.erase(pos0);
}
if (val>=0) {
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
// std::cout<< "Left: " << header << std::endl;
char h[1000];
sprintf(h,"\"eMin\":%d",val);
// std::cout<< "new ROI: " << h << std::endl;
header.append(h);
} else {
sscanf(header.substr(pos0,pos1-pos0).c_str(),"\"eMin\":%d",&val);
}
} else if (index==ZMQ_emax) {
size_t pos0, pos1;
pos0=header.find(",\"eMax\"");
if (pos0==std::string::npos) {
pos0=header.find("\"eMax\"");
} else pos0++;
if (pos0!=std::string::npos) {
pos1=header.find_first_of(",",pos0);
// std::cout << pos0 << " " << pos1 << std::endl;
std::cout<< "Replacing old eMax: " << header.substr(pos0,pos1-pos0) << std::endl;
// if (pos1!=std::string::npos)
if (val>=0)
header.erase(pos0,pos1-pos0);
// else
// header.erase(pos0);
}
if (val>=0) {
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
// std::cout<< "Left: " << header << std::endl;
char h[1000];
sprintf(h,"\"eMax\":%d",val);
// std::cout<< "new ROI: " << h << std::endl;
header.append(h);
} else {
sscanf(header.substr(pos0,pos1-pos0).c_str(),"\"eMax\":%d",&val);
}
}
std::cout<< "New json header: " << header << std::endl;
setReceiverOnline(ONLINE_FLAG);
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
/***** END FOR ZMQ HEADER */
retval[0]=val;
}
return retval[0];
}
@ -4892,7 +4975,7 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
thisDetector->roFlags=flag;
}
std::cout<< "***ZMQ: " << hex<< flag << std::endl;
// std::cout<< "***ZMQ: " << hex<< flag << std::endl;
if (flag & (PEDESTAL | NEWPEDESTAL | NEWFLAT | FLAT | FRAME)) {

View File

@ -1106,7 +1106,19 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
\section settingsdacs DACs
commands to configure DACs of detector
*/
/*! \page settings
- <b>emin [i] </b> Sets/gets detector minimum energy threshold for the CTB (soft setting)
*/
descrToFuncMap[i].m_pFuncName="emin"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
++i;
/*! \page settings
- <b>emax [i] </b> Sets/gets detector maximum energy threshold for the CTB (soft setting)
*/
descrToFuncMap[i].m_pFuncName="emax"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
++i;
/*! \page settings
- <b>vthreshold [i] [mv]</b> Sets/gets detector threshold voltage for single photon counters. Normally in DAC units unless \c mv is specified at the end of the command line. \c Returns \c (int ["mV"])
*/
@ -5228,6 +5240,10 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
dac=M_vIbiasSh;
else if (cmd== "vIpreOut")
dac=M_vIpreOut;
else if (cmd== "emin")
dac=ZMQ_emin;
else if (cmd== "emax")
dac=ZMQ_emax;
else
return string("cannot decode dac ")+cmd;