mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
jungfrau server: added storage start, connected auto_comp_disable, changed adcphase, added ADC_PORT_INVERT_VAL, ADC_OFST_HALF_SPEED_VAL, minimum exposure time
This commit is contained in:
parent
e024774323
commit
bc70cc3a26
@ -93,6 +93,7 @@ using namespace std;
|
||||
#define TEMPERATURE_CONTROL 0x0000001000000000ULL
|
||||
#define AUTO_COMP_DISABLE 0x0000002000000000ULL
|
||||
#define CONFIG_FILE 0x0000004000000000ULL
|
||||
#define STORAGE_CELL_START 0x0000008000000000ULL
|
||||
// 0x000000FFFFFFFFFFULL
|
||||
|
||||
|
||||
|
@ -118,6 +118,7 @@ enum detFuncs{
|
||||
F_TEMP_EVENT, /** < set temperature event */
|
||||
|
||||
F_AUTO_COMP_DISABLE, /** < auto comp disable mode */
|
||||
F_STORAGE_CELL_START, /** < storage cell start */
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
/* Always append functions before!!! */
|
||||
|
@ -297,7 +297,33 @@
|
||||
|
||||
|
||||
/** DAQ Register */
|
||||
#define DAQ_REG (0x5D << MEM_MAP_SHIFT) //TBD in firmware
|
||||
#define DAQ_REG (0x5D << MEM_MAP_SHIFT)
|
||||
|
||||
#define DAQ_SETTINGS_MSK (DAQ_HIGH_GAIN_MSK | DAQ_FIX_GAIN_STG_1_MSK | DAQ_FIX_GAIN_STG_2_MSK | DAQ_FRCE_SWTCH_GAIN_STG_1_MSK | DAQ_FRCE_SWTCH_GAIN_STG_2_MSK)
|
||||
#define DAQ_HIGH_GAIN_OFST (0)
|
||||
#define DAQ_HIGH_GAIN_MSK (0x00000001 << DAQ_HIGH_GAIN_OFST)
|
||||
#define DAQ_FIX_GAIN_STG_1_OFST (1)
|
||||
#define DAQ_FIX_GAIN_STG_1_MSK (0x00000001 << DAQ_FIX_GAIN_STG_1_OFST)
|
||||
#define DAQ_FIX_GAIN_STG_2_OFST (2)
|
||||
#define DAQ_FIX_GAIN_STG_2_MSK (0x00000001 << DAQ_FIX_GAIN_STG_2_OFST)
|
||||
#define DAQ_CMP_RST_OFST (4)
|
||||
#define DAQ_CMP_RST_MSK (0x00000001 << DAQ_CMP_RST_OFST)
|
||||
#define DAQ_STRG_CELL_SLCT_OFST (8)
|
||||
#define DAQ_STRG_CELL_SLCT_MSK (0x0000000F << DAQ_STRG_CELL_SLCT_OFST)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_STG_1_OFST (12)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_STG_1_MSK (0x00000001 << DAQ_FRCE_SWTCH_GAIN_STG_1_OFST)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_STG_2_OFST (13)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_STG_2_MSK (0x00000001 << DAQ_FRCE_SWTCH_GAIN_STG_2_OFST)
|
||||
#define DAQ_ELCTRN_CLLCTN_MDE_OFST (14)
|
||||
#define DAQ_ELCTRN_CLLCTN_MDE_MSK (0x00000001 << DAQ_ELCTRN_CLLCTN_MDE_OFST)
|
||||
#define DAQ_G2_CNNT_OFST (15)
|
||||
#define DAQ_G2_CNNT_MSK (0x00000001 << DAQ_G2_CNNT_OFST)
|
||||
#define DAQ_CRRNT_SRC_ENBL_OFST (16)
|
||||
#define DAQ_CRRNT_SRC_ENBL_MSK (0x00000001 << DAQ_CRRNT_SRC_ENBL_OFST)
|
||||
#define DAQ_CRRNT_SRC_CLMN_FIX_OFST (17)
|
||||
#define DAQ_CRRNT_SRC_CLMN_FIX_MSK (0x00000001 << DAQ_CRRNT_SRC_CLMN_FIX_OFST)
|
||||
#define DAQ_CRRNT_SRC_CLMN_SLCT_OFST (20)
|
||||
#define DAQ_CRRNT_SRC_CLMN_SLCT_MSK (0x0000003F << DAQ_CRRNT_SRC_CLMN_SLCT_OFST)
|
||||
|
||||
/** Chip Power Register */
|
||||
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
||||
|
@ -388,7 +388,9 @@ void setupDetector() {
|
||||
cprintf(RED, "Warning: Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], retval[0]);
|
||||
}
|
||||
}
|
||||
|
||||
bus_w(DAQ_REG, 0x0); /* Only once at server startup */
|
||||
|
||||
setSpeed(CLOCK_DIVIDER, HALF_SPEED);
|
||||
cleanFifos();
|
||||
resetCore();
|
||||
@ -631,6 +633,15 @@ int setSpeed(enum speedVariable arg, int val) {
|
||||
|
||||
|
||||
/* parameters - timer */
|
||||
int selectStoragecellStart(int pos) {
|
||||
if (pos >= 0) {
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_STRG_CELL_SLCT_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | ((pos << DAQ_STRG_CELL_SLCT_OFST) & DAQ_STRG_CELL_SLCT_MSK));
|
||||
}
|
||||
return ((bus_r(DAQ_REG) & DAQ_STRG_CELL_SLCT_MSK) >> DAQ_STRG_CELL_SLCT_OFST);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
@ -647,9 +658,11 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
printf("\nSetting exptime: %lldns\n", (long long int)val);
|
||||
val *= (1E-3 * CLK_RUN); /*(-2)*/
|
||||
val *= (1E-3 * CLK_RUN);
|
||||
val -= ACQ_TIME_MIN_CLOCK;
|
||||
if(val < 0) val = 0;
|
||||
}
|
||||
retval = set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) / (1E-3 * CLK_RUN);/*(+2)*/
|
||||
retval = (set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) + ACQ_TIME_MIN_CLOCK) / (1E-3 * CLK_RUN);
|
||||
printf("Getting exptime: %lldns\n", (long long int)retval);
|
||||
break;
|
||||
|
||||
@ -799,38 +812,46 @@ int getModule(sls_detector_module *myMod){
|
||||
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
||||
if(sett == UNINITIALIZED){
|
||||
if(sett == UNINITIALIZED)
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
uint32_t val = -1;
|
||||
const int defaultIndex[NUM_SETTINGS] = DEFAULT_SETT_INDX;
|
||||
const int defaultvals[NUM_SETTINGS] = DEFAULT_SETT_VALS;
|
||||
const char defaultNames[NUM_SETTINGS][100]=DEFAULT_SETT_NAMES;
|
||||
|
||||
// set settings
|
||||
if(sett != GET_SETTINGS) {
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
printf("\nConfigured settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG));
|
||||
break;
|
||||
case DYNAMICHG0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_HIGH_GAIN_MSK);
|
||||
printf("\nConfigured settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n", bus_r(DAQ_REG));
|
||||
break;
|
||||
case FIXGAIN1:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_MSK);
|
||||
printf("\nConfigured settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG));
|
||||
break;
|
||||
case FIXGAIN2:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_MSK);
|
||||
printf("\nConfigured settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG));
|
||||
break;
|
||||
case FORCESWITCHG1:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_SWTCH_GAIN_STG_1_MSK);
|
||||
printf("\nConfigured settings - Force Switch Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG));
|
||||
break;
|
||||
case FORCESWITCHG2:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_SWTCH_GAIN_STG_2_MSK);
|
||||
printf("\nConfigured settings - Force Switch Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG));
|
||||
break;
|
||||
default:
|
||||
cprintf(RED, "Error: This settings is not defined for this detector %d\n", (int)sett);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// find gain val
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < NUM_SETTINGS; ++i) {
|
||||
if (sett == defaultIndex[i]) {
|
||||
val = defaultvals[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//not found
|
||||
if (val == -1) {
|
||||
cprintf(RED, "Error: This settings is not defined for this detector %d\n", (int)sett);
|
||||
return val;
|
||||
}
|
||||
|
||||
printf("\nConfiguring to settings %s (%d)\n"
|
||||
" Writing to DAQ Register with val:0x%x\n", defaultNames[i], sett, val);
|
||||
}
|
||||
bus_w(DAQ_REG, val);
|
||||
thisSettings = sett;
|
||||
}
|
||||
|
||||
@ -841,35 +862,39 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
||||
|
||||
enum detectorSettings getSettings(){
|
||||
|
||||
enum detectorSettings sett = -1;
|
||||
const int defaultIndex[NUM_SETTINGS] = DEFAULT_SETT_INDX;
|
||||
const int defaultvals[NUM_SETTINGS] = DEFAULT_SETT_VALS;
|
||||
const char defaultNames[NUM_SETTINGS][100]=DEFAULT_SETT_NAMES;
|
||||
|
||||
uint32_t val = bus_r(DAQ_REG);
|
||||
printf("\nGetting Settings\n Reading DAQ Register :0x%x\n", val);
|
||||
|
||||
//find setting
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < NUM_SETTINGS; ++i) {
|
||||
if (val == defaultvals[i]) {
|
||||
sett = defaultIndex[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//not found
|
||||
if (sett == -1) {
|
||||
cprintf(RED, "Error: Undefined settings read for this detector (DAQ Reg val: 0x%x)\n", val);
|
||||
thisSettings = UNDEFINED;
|
||||
return sett;
|
||||
}
|
||||
|
||||
thisSettings = sett;
|
||||
printf("Settings Read: %s (%d)\n", defaultNames[i], thisSettings);
|
||||
if (val & DAQ_FRCE_SWTCH_GAIN_STG_2_MSK) {
|
||||
thisSettings = FORCESWITCHG2;
|
||||
printf("Settings read: FORCESWITCHG2\n");
|
||||
}
|
||||
|
||||
else if (val & DAQ_FRCE_SWTCH_GAIN_STG_1_MSK) {
|
||||
thisSettings = FORCESWITCHG1;
|
||||
printf("Settings read: FORCESWITCHG1\n");
|
||||
}
|
||||
|
||||
else if (val & DAQ_FIX_GAIN_STG_2_MSK) {
|
||||
thisSettings = FIXGAIN2;
|
||||
printf("Settings read: FIXGAIN2\n");
|
||||
}
|
||||
|
||||
else if (val & DAQ_FIX_GAIN_STG_1_MSK) {
|
||||
thisSettings = FIXGAIN1;
|
||||
printf("Settings read: FIXGAIN1\n");
|
||||
}
|
||||
|
||||
else if (val & DAQ_HIGH_GAIN_MSK) {
|
||||
thisSettings = DYNAMICHG0;
|
||||
printf("Settings read: DYNAMICHG0\n");
|
||||
}
|
||||
|
||||
else {
|
||||
thisSettings = DYNAMICGAIN;
|
||||
printf("Settings read: DYNAMICGAIN\n");
|
||||
}
|
||||
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
|
@ -40,22 +40,6 @@ enum DACINDEX {VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VREF
|
||||
420 /* VREF_COMP */ \
|
||||
};
|
||||
|
||||
#define NUM_SETTINGS 6
|
||||
#define DEFAULT_SETT_INDX {DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2};
|
||||
#define DEFAULT_SETT_VALS { 0x0f00, /* DYNAMICGAIN */ \
|
||||
0x0f01, /* DYNAMICHG0 */ \
|
||||
0x0f02, /* FIXGAIN1 */ \
|
||||
0x0f06, /* FIXGAIN2 */ \
|
||||
0x1f00, /* FORCESWITCHG1 */ \
|
||||
0x3f00 /* FORCESWITCHG2 */ \
|
||||
};
|
||||
#define DEFAULT_SETT_NAMES { "Dynamic Gain", /* DYNAMICGAIN */ \
|
||||
"Dynamic High Gain 0", /* DYNAMICHG0 */ \
|
||||
"Fix Gain 1", /* FIXGAIN1 */ \
|
||||
"Fix Gain 2", /* FIXGAIN2 */ \
|
||||
"Force Switch Gain 1", /* FORCESWITCHG1*/ \
|
||||
"Force Switch Gain 2" /* FORCESWITCHG2*/ \
|
||||
};
|
||||
enum NETWORKINDEX { TXN_FRAME };
|
||||
|
||||
|
||||
@ -94,6 +78,7 @@ enum NETWORKINDEX { TXN_FRAME };
|
||||
#define MAX_TIMESLOT_VAL (0x1F)
|
||||
#define MAX_THRESHOLD_TEMP_VAL (127999) //millidegrees
|
||||
#define MAX_STORAGE_CELL_VAL (15) //0xF
|
||||
#define ACQ_TIME_MIN_CLOCK (2)
|
||||
|
||||
|
||||
#define SAMPLE_ADC_HALF_SPEED (SAMPLE_DECMT_FACTOR_2_VAL + SAMPLE_DGTL_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x1000 */
|
||||
|
@ -2072,6 +2072,42 @@ int64_t multiSlsDetector::getTimeLeft(timerIndex index){
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::setStoragecellStart(int pos) {
|
||||
int ret=-100;
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}else{
|
||||
//return storage values
|
||||
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 func1_t<int,int>(&slsDetector::setStoragecellStart,
|
||||
detectors[idet],pos,iret[idet]));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::setSpeed(speedVariable index, int value){
|
||||
int i;
|
||||
int ret1=-100, ret;
|
||||
|
@ -726,6 +726,13 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
*/
|
||||
int64_t getTimeLeft(timerIndex index);
|
||||
|
||||
/**
|
||||
* set storage cell that stores first acquisition of the series (Jungfrau only)
|
||||
* \param value storage cell index. Value can be 0 to 15. (-1 gets)
|
||||
* \returns the storage cell that stores the first acquisition of the series
|
||||
*/
|
||||
int setStoragecellStart(int pos=-1);
|
||||
|
||||
/* /\** */
|
||||
/* get current timer value */
|
||||
/* \param index timer index */
|
||||
|
@ -5267,6 +5267,38 @@ int64_t slsDetector::getTimeLeft(timerIndex index){
|
||||
};
|
||||
|
||||
|
||||
int slsDetector::setStoragecellStart(int pos) {
|
||||
int ret=FAIL;
|
||||
int fnum=F_STORAGE_CELL_START;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
int retval=-1;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending storage cell start index " << pos << endl;
|
||||
#endif
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&pos,sizeof(pos));
|
||||
//check opening error
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(STORAGE_CELL_START));
|
||||
}else
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Flags
|
||||
int slsDetector::setDynamicRange(int n){
|
||||
|
||||
|
@ -1246,7 +1246,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int64_t getTimeLeft(timerIndex index);
|
||||
|
||||
|
||||
/**
|
||||
* set storage cell that stores first acquisition of the series (Jungfrau only)
|
||||
* \param value storage cell index. Value can be 0 to 15. (-1 gets)
|
||||
* \returns the storage cell that stores the first acquisition of the series
|
||||
*/
|
||||
int setStoragecellStart(int pos=-1);
|
||||
|
||||
|
||||
/** sets/gets the value of important readout speed parameters
|
||||
|
@ -642,6 +642,12 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>storagecell_start [i]</b> sets/gets the storage cell that stores the first acquisition of the series. Default is 0. For very advanced users only! For JUNGFRAU only. Range: 0-15. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="storagecell_start"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
++i;
|
||||
|
||||
/* read only timers */
|
||||
|
||||
@ -5631,6 +5637,17 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
index=SAMPLES_JCTB;
|
||||
else if (cmd=="storagecells")
|
||||
index=STORAGE_CELL_NUMBER;
|
||||
else if (cmd=="storagecell_start") {
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
int ival =-1;
|
||||
if (!sscanf(args[1],"%d", &ival))
|
||||
return string("cannot scan storage cell start value ")+string(args[1]);
|
||||
myDet->setStoragecellStart(ival);
|
||||
}
|
||||
sprintf(answer,"%d", myDet->setStoragecellStart());
|
||||
return string(answer);
|
||||
}
|
||||
else
|
||||
return string("could not decode timer ")+cmd;
|
||||
|
||||
@ -5683,6 +5700,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
os << "probes t \t sets the number of probes to accumulate (max 3! cycles should be set to 1, frames to the number of pump-probe events)" << std::endl;
|
||||
os << "samples t \t sets the number of samples expected from the jctb" << std::endl;
|
||||
os << "storagecells t \t sets number of storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells+1)." << std::endl;
|
||||
os << "storagecell_start t \t sets the storage cell that stores the first acquisition of the series. Default is 0. For very advanced users only! For JUNGFRAU only. Range: 0-15." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
|
||||
@ -5698,6 +5716,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
os << "probes \t gets the number of probes to accumulate" << std::endl;
|
||||
os << "samples \t gets the number of samples expected from the jctb" << std::endl;
|
||||
os << "storagecells \t gets number of storage cells per acquisition.For JUNGFRAU only." << std::endl;
|
||||
os << "storagecell_start \t gets the storage cell that stores the first acquisition of the series." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
}
|
||||
|
@ -318,6 +318,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
*/
|
||||
virtual int64_t getTimeLeft(timerIndex index)=0;
|
||||
|
||||
/**
|
||||
* set storage cell that stores first acquisition of the series (Jungfrau only)
|
||||
* \param value storage cell index. Value can be 0 to 15. (-1 gets)
|
||||
* \returns the storage cell that stores the first acquisition of the series
|
||||
*/
|
||||
virtual int setStoragecellStart(int pos=-1)=0;
|
||||
|
||||
|
||||
|
||||
/** sets the number of trim energies and their value \sa sharedSlsDetector
|
||||
|
@ -106,6 +106,9 @@ int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||
#endif
|
||||
|
||||
// parameters - timer
|
||||
#ifdef JUNGFRAUD
|
||||
int selectStoragecellStart(int pos);
|
||||
#endif
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
#ifndef EIGERD
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
|
@ -193,6 +193,7 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_TEMP_CONTROL: return "F_TEMP_CONTROL";
|
||||
case F_TEMP_EVENT: return "F_TEMP_EVENT";
|
||||
case F_AUTO_COMP_DISABLE: return "F_AUTO_COMP_DISABLE";
|
||||
case F_STORAGE_CELL_START: return "F_STORAGE_CELL_START";
|
||||
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
@ -276,6 +277,7 @@ void function_table() {
|
||||
flist[F_TEMP_CONTROL] = &temp_control;
|
||||
flist[F_TEMP_EVENT] = &temp_event;
|
||||
flist[F_AUTO_COMP_DISABLE] = &auto_comp_disable;
|
||||
flist[F_STORAGE_CELL_START] = &storage_cell_start;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) {
|
||||
@ -5526,8 +5528,6 @@ int auto_comp_disable(int file_des) {
|
||||
sprintf(mess,"Function (Auto Comp Disable) is not yet implemented for this detector\n");
|
||||
cprintf(RED, "%s", mess);
|
||||
|
||||
/* will be connected after teh fpga upgrade
|
||||
|
||||
// receive arguments
|
||||
int arg=-1;
|
||||
n = receiveData(file_des,&arg,sizeof(arg),INT32);
|
||||
@ -5560,7 +5560,72 @@ int auto_comp_disable(int file_des) {
|
||||
#endif
|
||||
if (ret==OK && differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
*/
|
||||
#endif
|
||||
|
||||
// ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
// send ok / fail
|
||||
n = sendData(file_des,&ret1,sizeof(ret),INT32);
|
||||
// send return argument
|
||||
if (ret==FAIL) {
|
||||
n += sendData(file_des,mess,sizeof(mess),OTHER);
|
||||
} else
|
||||
n += sendData(file_des,&retval,sizeof(retval),INT32);
|
||||
|
||||
// return ok / fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int storage_cell_start(int file_des) {
|
||||
int ret=OK,ret1=OK;
|
||||
int n=0;
|
||||
int retval=-1;
|
||||
sprintf(mess,"storage cell start failed\n");
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
//to receive any arguments
|
||||
while (n > 0)
|
||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Function (Storage cell start) is not implemented for this detector\n");
|
||||
cprintf(RED, "%s", mess);
|
||||
#else
|
||||
|
||||
// receive arguments
|
||||
int arg=-1;
|
||||
n = receiveData(file_des,&arg,sizeof(arg),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// execute action
|
||||
if (differentClients && lockStatus && arg!=-1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
}
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
else {
|
||||
#ifdef VERBOSE
|
||||
printf("Storage cell start to %d\n", arg);
|
||||
#endif
|
||||
retval=selectStoragecellStart(arg);
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Storage cell start: %d\n",retval);
|
||||
#endif
|
||||
if (retval==arg || arg<0) {
|
||||
ret=OK;
|
||||
} else {
|
||||
sprintf(mess,"Storage cell start select failed, wrote %d but read %d\n", arg, retval);
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (ret==OK && differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
#endif
|
||||
|
||||
// ret could be swapped during sendData
|
||||
|
@ -92,5 +92,6 @@ int threshold_temp(int);
|
||||
int temp_control(int);
|
||||
int temp_event(int);
|
||||
int auto_comp_disable(int);
|
||||
int storage_cell_start(int);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user