diff --git a/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c index 557630b74..125df1c2d 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c @@ -136,7 +136,6 @@ int acceptConnection() { if (socketDescriptor>0) { - //if ((file_des = accept(socketDescriptor,(struct sockaddr *) &addressC, &address_length)) < 0) { if ((file_des = accept(socketDescriptor,(struct sockaddr *) &addressC, &address_length)) < 0) { @@ -195,8 +194,34 @@ int acceptConnection() { socketDescriptor=-1; } #ifdef VERBOSE + + +struct sockaddr_in6 sa; +char str[INET6_ADDRSTRLEN]; + +// store this IP address in sa: +inet_pton(AF_INET6, "2001:db8:8714:3a90::12", &(sa.sin6_addr)); + +// now get it back and print it +inet_ntop(AF_INET6, &(sa.sin6_addr), str, INET6_ADDRSTRLEN); + +printf("%s\n\n", str); // prints "2001:db8:8714:3a90::12" + + printf("client connected %d\n", file_des); + printf("addressC family %d port %d addr %s\n",addressC.sin_family,addressC.sin_port,inet_ntoa(addressC.sin_addr));//edited #endif + + //strcpy(lastClientIP,inet_ntoa(addressC.sin_addr)); //In case you want to lock the server... + + + // struct sockaddr_in + //{ + //short int sin_family; /* Famyly of the address*/ + //unsigned short int sin_port; /* Port */ + //struct in_addr sin_addr; /* Network address */ + //unsigned char sin_zero[8]; /* Same size of struct sockaddr */ + //}; } diff --git a/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c index cadefce9a..cbce22ebb 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c @@ -860,20 +860,20 @@ int setSettings(int i) for (ind=0; ind=HIGHGAIN) && (i<= GAIN3))) - { - v[VREF_DS]=vrefds[i]; - v[VCASCN_PB]=vcascn[i]; - v[VCASCP_PB]=vcascp[i]; - v[VOUT_CM]=voutcm[i]; - v[VCASC_OUT]=vcascout[i]; - v[VIN_CM]=vincm[i]; - v[VREF_COMP]=vrefcomp[i]; - v[IB_TESTC]=ibtestc[i]; + //if not get settings + if ((i>=HIGHGAIN) && (i<= GAIN3)) { + v[VREF_DS]=vrefds[i]; + v[VCASCN_PB]=vcascn[i]; + v[VCASCP_PB]=vcascp[i]; + v[VOUT_CM]=voutcm[i]; + v[VCASC_OUT]=vcascout[i]; + v[VIN_CM]=vincm[i]; + v[VREF_COMP]=vrefcomp[i]; + v[IB_TESTC]=ibtestc[i]; - initDACs(v,ALLMOD); - thisSettings=i; - } + initDACs(v,ALLMOD); + thisSettings=i; + } //check settings for module 0 imod=0; @@ -934,7 +934,6 @@ int setSettings(int i) ; else thisSettings=isett; - return thisSettings; } @@ -1651,7 +1650,13 @@ int initModulebyNumber(sls_detector_module myMod) { } } thisSettings=UNDEFINED; - setSettings(GET_SETTINGS); + int modSet=setSettings(GET_SETTINGS); + printf("\n\n modSet:%d\n\n",modSet); + //changing the confGain register + //retval=initConfGainByModule(val,imod); + //if(retval==-3) + // strcpy(mess,"Weird value read back\n"); + return myMod.reg; } diff --git a/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.h b/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.h index 7049c1d4c..aa3e0d3a6 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.h @@ -9,6 +9,7 @@ #define RGSH1VALS {300,200,400} #define RGSH2VALS {260,300,260} +//high,dynamic,low,medium,very high #define VREFDS_VALS {0,0,200,300,400,500,600} #define VCASCN_VALS {0,0,220,320,420,520,620} #define VCASCP_VALS {0,0,240,340,440,540,640} @@ -17,6 +18,7 @@ #define VINCM_VALS {0,0,300,400,500,600,700} #define VREFCOMP_VALS {0,0,320,420,520,620,720} #define IBTESTC_VALS {0,0,340,440,540,640,740} +#define CONF_GAIN {0,0, 0, 1, 6, 2, 1}//dynamic gain confgain yet to be figured out #define DEFAULTGAIN {11.66,9.32,14.99} diff --git a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c index 343215d08..216b54b4d 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c @@ -855,9 +855,6 @@ int set_dac(int fnum) { case HV_POT: ireg=HIGH_VOLTAGE; break; - case G_CONF_GAIN: - ireg=CONFGAIN; - break; default: printf("Unknown DAC/TEMP/HV index %d\n",ind); sprintf(mess,"Unknown DAC/TEMP/HV index %d\n",ind); @@ -869,11 +866,8 @@ int set_dac(int fnum) { if(ireg==-1) retval=initDACbyIndexDACU(idac,val,imod); else - {//Conf gain - if (ireg==CONFGAIN) - retval=initConfGainByModule(val,imod); - //HV or conf gain - else if(ireg==HIGH_VOLTAGE) + { //HV or conf gain + if(ireg==HIGH_VOLTAGE) retval=initHighVoltageByModule(val,imod); //Temp else @@ -885,7 +879,7 @@ int set_dac(int fnum) { printf("DAC/TEMP/HV set to %f V\n", retval); #endif ret=FAIL; - if((ireg==HIGH_VOLTAGE)||(ireg==CONFGAIN)){ + if(ireg==HIGH_VOLTAGE){ if(retval==-2) strcpy(mess,"Invalid Voltage.Valid values are 0,90,110,120,150,180,200"); else if(retval==-3) @@ -1326,6 +1320,7 @@ int set_module(int fnum) { if (ret==OK) { #ifdef MCB_FUNCS retval=initModulebyNumber(myModule); + #endif }