gotthard and jungfrau servers do not need to send whole module for sending settings anymore

This commit is contained in:
2018-05-22 14:52:53 +02:00
parent 3f61206289
commit bdf9373e0d
17 changed files with 298 additions and 251 deletions

View File

@ -303,13 +303,14 @@ void setMasterSlaveConfiguration(){
}
}
cprintf(BLUE, "masterflags: %d\n"
cprintf(BLUE,
"masterflags: %d\n"
"masterdefaultdelay:%d\n"
"patternphase:%d\n"
"adcphase:%d\n"
"slavepatternphase:%d\n"
"slaveadcphase:%d\n"
"rsttosw1delay:%d\n",
"rsttosw1delay:%d\n"
"startacqdelay:%d\n",
masterflags,
masterdefaultdelay,

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 675d69392a6497d42b23057c7c8783c8dad768d0
Revision: 223
Branch: 3.1.0-rc
Repsitory UUID: 3f6120628938fb0820908fb82574418039a3b352
Revision: 230
Branch: developer
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 3447
Last Changed Date: 2018-02-27 14:04:08.000000002 +0100 ./server_funcs.c
Last Changed Rev: 3829
Last Changed Date: 2018-05-22 13:58:08.000000002 +0200 ./mcb_funcs.c

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "675d69392a6497d42b23057c7c8783c8dad768d0"
#define GITREPUUID "3f6120628938fb0820908fb82574418039a3b352"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x3447
#define GITDATE 0x20180227
#define GITBRANCH "3.1.0-rc"
#define GITREV 0x3829
#define GITDATE 0x20180522
#define GITBRANCH "developer"

View File

@ -114,6 +114,28 @@ int initDetector() {
}
int setDefaultDacs() {
printf("Setting Default Dac values\n");
int ret = OK;
int i = 0;
int retval[2]={-1,-1};
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
for(i = 0; i < NDAC; ++i) {
// if not already default, set it to default
if (setDACRegister(i, -1, -1) != defaultvals[i]) {
initDACbyIndexDACU(i, defaultvals[i], 0, 0, retval);
if (abs(retval[0] - defaultvals[i])<=3) {
cprintf(RED, "Warning: Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], retval[0]);
ret = FAIL;
}
}
}
return ret;
}
int copyChannel(sls_detector_channel *destChan, sls_detector_channel *srcChan) {

View File

@ -18,6 +18,16 @@
// DAC definitions
enum dacsVal{VREF_DS, VCASCN_PB, VCASCP_PB, VOUT_CM, VCASC_OUT, VIN_CM, VREF_COMP, IB_TESTC,HIGH_VOLTAGE, CONFGAIN};
#define DEFAULT_DAC_VALS { \
660, /* VREF_DS */ \
650, /* VCASCN_PB */ \
1480, /* VCASCP_PB */ \
1520, /* VOUT_CM */ \
1320, /* VCASC_OUT */ \
1350, /* VIN_CM */ \
350, /* VREF_COMP */ \
2001 /* IB_TESTC */ \
};
/* DAC adresses */
#define DACCS {0,0,1,1,2,2,3,3,4,4,5,5,6,6}
@ -84,6 +94,7 @@ enum adcVals{TEMP_FPGA, TEMP_ADC};
void showbits(int h);
int initDetector();
int setDefaultDacs();
int copyChannel(sls_detector_channel *destChan, sls_detector_channel *srcChan);
int copyChip(sls_detector_chip *destChip, sls_detector_chip *srcChip);
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);

View File

@ -87,9 +87,10 @@ int init_detector( int b) {
setPhaseShiftOnce();
configureADC();
setADC(-1); //already does setdaqreg and clean fifo
setSettings(GET_SETTINGS,-1);
setSettings(DYNAMICGAIN,-1);
setDefaultDacs();
//Initialization
//Initialization
setFrames(1);
setTrains(1);
setExposureTime(1e6);
@ -1660,19 +1661,43 @@ int set_settings(int file_des) {
sprintf(mess,"Detector locked by %s\n",lastClientIP);
} else {
#ifdef MCB_FUNCS
retval=setSettings(arg[0],imod);
#endif
switch(isett) {
case GET_SETTINGS:
case UNINITIALIZED:
case DYNAMICGAIN:
case HIGHGAIN:
case LOWGAIN:
case MEDIUMGAIN:
case VERYHIGHGAIN:
break;
default:
ret = FAIL;
sprintf(mess,"Setting (%d) is not implemented for this detector.\n"
"Options are dynamicgain, highgain, lowgain, mediumgain and "
"veryhighgain.\n", isett);
cprintf(RED, "Warning: %s", mess);
break;
}
if (ret != FAIL) {
retval=setSettings(isett,imod);
#ifdef VERBOSE
printf("Settings changed to %d\n",retval);
#endif
if (retval==isett || isett<0) {
ret=OK;
} else {
ret=FAIL;
printf("Changing settings of module %d: wrote %d but read %d\n", imod, isett, retval);
}
printf("Settings changed to %d\n",retval);
#endif
if (retval != isett && isett >= 0) {
ret=FAIL;
sprintf(mess, "Changing settings of module %d: wrote %d but read %d\n", imod, isett, retval);
printf("Warning: %s",mess);
}
else {
ret = setDefaultDacs();
if (ret == FAIL) {
strcpy(mess,"Could change settings, but could not set to default dacs\n");
cprintf(RED, "Warning: %s", mess);
}
}
}
#endif
}
if (ret==OK && differentClients==1)
ret=FORCE_UPDATE;