removed colon in commands. affects dac, adc and extsig

This commit is contained in:
maliakal_d 2019-06-04 12:10:26 +02:00
parent 1a2e252665
commit b74ce95b24
8 changed files with 42 additions and 50 deletions

View File

@ -485,22 +485,18 @@ int get_detector_type(int file_des) {
int set_external_signal_flag(int file_des) { int set_external_signal_flag(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int args[2] = {-1,-1}; int arg = -1;
enum externalSignalFlag retval= GET_EXTERNAL_SIGNAL_FLAG; enum externalSignalFlag retval= GET_EXTERNAL_SIGNAL_FLAG;
if (receiveData(file_des, args, sizeof(args), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
int signalindex = args[0]; enum externalSignalFlag flag = arg;
enum externalSignalFlag flag = args[1]; FILE_LOG(logDEBUG1, ("Setting external signal flag to %d\n", flag));
FILE_LOG(logDEBUG1, ("Setting external signal %d to flag %d\n", signalindex, flag));
#ifndef GOTTHARDD #ifndef GOTTHARDD
functionNotImplemented(); functionNotImplemented();
#else #else
if (signalindex > 0)
modeNotImplemented("Signal index", signalindex);
else {
// set // set
if ((flag != GET_EXTERNAL_SIGNAL_FLAG) && (Server_VerifyLock() == OK)) { if ((flag != GET_EXTERNAL_SIGNAL_FLAG) && (Server_VerifyLock() == OK)) {
setExtSignal(flag); setExtSignal(flag);
@ -509,7 +505,6 @@ int set_external_signal_flag(int file_des) {
retval = getExtSignal(); retval = getExtSignal();
validate((int)flag, (int)retval, "set external signal flag", DEC); validate((int)flag, (int)retval, "set external signal flag", DEC);
FILE_LOG(logDEBUG1, ("External Signal Flag: %d\n", retval)); FILE_LOG(logDEBUG1, ("External Signal Flag: %d\n", retval));
}
#endif #endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
} }

View File

@ -821,13 +821,12 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* Set/get external signal flags (to specify triggerinrising edge etc) * Set/get external signal flags (to specify triggerinrising edge etc)
* (Gotthard, Mythen) * (Gotthard, Mythen)
* @param pol external signal flag (-1 gets) * @param pol external signal flag (-1 gets)
* @param signalindex singal index (0 - 3)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns current timing mode * @returns current timing mode
*/ */
externalSignalFlag externalSignalFlag
setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG, setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG,
int signalindex = 0, int detPos = -1); int detPos = -1);
/** /**
* Set/get readout flags (Eiger, Mythen) * Set/get readout flags (Eiger, Mythen)

View File

@ -814,10 +814,9 @@ class slsDetector : public virtual slsDetectorDefs{
/** /**
* Set/get external signal flags (to specify triggerinrising edge etc) (Gotthard, Mythen) * Set/get external signal flags (to specify triggerinrising edge etc) (Gotthard, Mythen)
* @param pol external signal flag (-1 gets) * @param pol external signal flag (-1 gets)
* @param signalindex singal index (0 - 3)
* @returns current timing mode * @returns current timing mode
*/ */
externalSignalFlag setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG, int signalindex = 0); externalSignalFlag setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG);
/** /**
* Set/get readout flags (Eiger, Mythen) * Set/get readout flags (Eiger, Mythen)

View File

@ -1352,14 +1352,14 @@ multiSlsDetector::setExternalCommunicationMode(externalCommunicationMode pol, in
} }
slsDetectorDefs::externalSignalFlag slsDetectorDefs::externalSignalFlag
multiSlsDetector::setExternalSignalFlags(externalSignalFlag pol, int signalindex, int detPos) { multiSlsDetector::setExternalSignalFlags(externalSignalFlag pol, int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->setExternalSignalFlags(pol, signalindex); return detectors[detPos]->setExternalSignalFlags(pol);
} }
// multi // multi
auto r = parallelCall(&slsDetector::setExternalSignalFlags, pol, signalindex); auto r = parallelCall(&slsDetector::setExternalSignalFlags, pol);
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }

View File

@ -1707,15 +1707,13 @@ slsDetector::setExternalCommunicationMode(externalCommunicationMode pol) {
} }
slsDetectorDefs::externalSignalFlag slsDetectorDefs::externalSignalFlag
slsDetector::setExternalSignalFlags(externalSignalFlag pol, int signalindex) { slsDetector::setExternalSignalFlags(externalSignalFlag pol) {
int fnum = F_SET_EXTERNAL_SIGNAL_FLAG; int fnum = F_SET_EXTERNAL_SIGNAL_FLAG;
int args[]{signalindex, pol};
auto retval = GET_EXTERNAL_SIGNAL_FLAG; auto retval = GET_EXTERNAL_SIGNAL_FLAG;
FILE_LOG(logDEBUG1) << "Setting signal " << signalindex << " to flag " FILE_LOG(logDEBUG1) << "Setting signal flag to " << pol;
<< pol;
if (shm()->onlineFlag == ONLINE_FLAG) { if (shm()->onlineFlag == ONLINE_FLAG) {
sendToDetector(fnum, args, retval); sendToDetector(fnum, pol, retval);
FILE_LOG(logDEBUG1) << "Ext Signal (" << signalindex << "): " << retval; FILE_LOG(logDEBUG1) << "Ext Signal: " << retval;
} }
return retval; return retval;
} }

View File

@ -383,7 +383,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
++i; ++i;
/*! \page config /*! \page config
- <b>extsig:[i] [flag]</b> sets/gets the mode of the external signal i. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge, - <b>extsig [flag]</b> sets/gets the mode of the external signal. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge,
\c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge, \c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge,
\c ro_trigger_out_falling_edge. \n Used in GOTTHARDonly. \c Returns \c (string) \c ro_trigger_out_falling_edge. \n Used in GOTTHARDonly. \c Returns \c (string)
*/ */
@ -3879,11 +3879,14 @@ std::string slsDetectorCommand::cmdDAC(int narg, const char * const args[], int
char answer[1000]; char answer[1000];
int mode = 0; int mode = 0;
if (cmd == "dac") {
int idac = -1; int idac = -1;
if (sscanf(args[0], "dac:%d", &idac) == 1) { if (sscanf(args[1], "%d", &idac) != 1) {
//printf("chiptestboard!\n"); return std::string("Could not scan dac index") + std::string(args[1]);
}
dac = (dacIndex)idac; dac = (dacIndex)idac;
} else if (cmd == "adcvpp") }
else if (cmd == "adcvpp")
dac = ADC_VPP; dac = ADC_VPP;
else if (cmd == "vthreshold") else if (cmd == "vthreshold")
dac = THRESHOLD; dac = THRESHOLD;
@ -4218,8 +4221,6 @@ std::string slsDetectorCommand::helpDAC(int action) {
std::string slsDetectorCommand::cmdADC(int narg, const char * const args[], int action, int detPos) { std::string slsDetectorCommand::cmdADC(int narg, const char * const args[], int action, int detPos) {
dacIndex adc; dacIndex adc;
int idac;
// double val=-1;
char answer[1000]; char answer[1000];
if (action == HELP_ACTION) if (action == HELP_ACTION)
@ -4227,13 +4228,18 @@ std::string slsDetectorCommand::cmdADC(int narg, const char * const args[], int
else if (action == PUT_ACTION) else if (action == PUT_ACTION)
return std::string("cannot set ") + cmd; return std::string("cannot set ") + cmd;
if (sscanf(args[0],"adc:%d",&idac)==1) { if (cmd == "adc") {
// printf("chiptestboard!\n"); int idac = -1;
adc=(dacIndex)(idac+SLOW_ADC0); if (sscanf(args[1], "%d", &idac) != 1) {
if (idac < 0 || idac > SLOW_ADC_TEMP - SLOW_ADC0) return std::string("Could not scan adc index") + std::string(args[1]);
}
if (idac < 0 || idac > SLOW_ADC_TEMP - SLOW_ADC0) {
return (std::string ("cannot set adc, must be between ") + std::to_string(0) + return (std::string ("cannot set adc, must be between ") + std::to_string(0) +
std::string (" and ") + std::to_string(SLOW_ADC_TEMP - SLOW_ADC0)); std::string (" and ") + std::to_string(SLOW_ADC_TEMP - SLOW_ADC0));
} else if (cmd=="temp_adc") }
adc = (dacIndex)(idac + SLOW_ADC0);
}
else if (cmd=="temp_adc")
adc=TEMPERATURE_ADC; adc=TEMPERATURE_ADC;
else if (cmd=="temp_fpga") else if (cmd=="temp_fpga")
adc=TEMPERATURE_FPGA; adc=TEMPERATURE_FPGA;
@ -4817,11 +4823,6 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
} else if (cmd == "extsig") { } else if (cmd == "extsig") {
externalSignalFlag flag = GET_EXTERNAL_SIGNAL_FLAG; externalSignalFlag flag = GET_EXTERNAL_SIGNAL_FLAG;
int is = -1;
if (sscanf(args[0], "extsig:%d", &is))
;
else
return std::string("could not scan signal number ") + std::string(args[0]);
if (action == PUT_ACTION) { if (action == PUT_ACTION) {
flag = myDet->externalSignalType(args[1]); flag = myDet->externalSignalType(args[1]);
@ -4830,7 +4831,7 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
} }
myDet->setOnline(ONLINE_FLAG, detPos); myDet->setOnline(ONLINE_FLAG, detPos);
return myDet->externalSignalType(myDet->setExternalSignalFlags(flag, is, detPos)); return myDet->externalSignalType(myDet->setExternalSignalFlags(flag, detPos));
} else if (cmd == "programfpga") { } else if (cmd == "programfpga") {
if (action == GET_ACTION) if (action == GET_ACTION)
@ -4955,7 +4956,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
std::ostringstream os; std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION) { if (action == PUT_ACTION || action == HELP_ACTION) {
os << "extsig:i mode \t sets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; os << "extsig mode \t sets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overlow, nooverflow, unknown." << std::endl; os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overlow, nooverflow, unknown." << std::endl;
os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl; os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl;
@ -4970,7 +4971,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
} }
if (action == GET_ACTION || action == HELP_ACTION) { if (action == GET_ACTION || action == HELP_ACTION) {
os << "extsig:i \t gets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; os << "extsig \t gets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overflow, nooverflow, unknown" << std::endl; os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overflow, nooverflow, unknown" << std::endl;
os << "led \t returns led status (0 off, 1 on)" << std::endl; os << "led \t returns led status (0 off, 1 on)" << std::endl;

View File

@ -1,6 +1,5 @@
/** API versions */ /** API versions */
#define GITBRANCH "refgui" #define GITBRANCH "refgui"
#define APIGOTTHARD 0x190108
#define APIMOENCH 0x181108 #define APIMOENCH 0x181108
#define APILIB 0x190405 #define APILIB 0x190405
#define APIRECEIVER 0x190405 #define APIRECEIVER 0x190405
@ -8,3 +7,4 @@
#define APIEIGER 0x190531 #define APIEIGER 0x190531
#define APIJUNGFRAU 0x190531 #define APIJUNGFRAU 0x190531
#define APICTB 0x190603 #define APICTB 0x190603
#define APIGOTTHARD 0x190604