diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index b8510da7e..10a97b41a 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -65,7 +65,7 @@ int default_dac_values[16] = { 1100, //rxb_rb 1100, //rxb_lb 1000, //Vcmp_rr - 200, //Vcp + 1000, //Vcp 2000, //Vcn 1550 //Vis }; @@ -366,7 +366,7 @@ int detectorTest( enum digitalTestMode arg){ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){ if(ind == VTHRESHOLD){ - int ret[4]; + int ret[5]; setDAC(VCMP_LL,val,imod,mV,retval); ret[0] = retval[mV]; setDAC(VCMP_LR,val,imod,mV,retval); @@ -375,15 +375,19 @@ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){ ret[2] = retval[mV]; setDAC(VCMP_RR,val,imod,mV,retval); ret[3] = retval[mV]; + setDAC(VCP,val,imod,mV,retval); + ret[4] = retval[mV]; + if((ret[0]== ret[1])&& (ret[1]==ret[2])&& - (ret[2]==ret[3])) - cprintf(GREEN,"vthreshold match\n"); + (ret[2]==ret[3]) && + (ret[3]==ret[4])) + cprintf(GREEN,"vthreshold match\n"); else{ - retval[0] = -1;retval[1] = -1; - cprintf(RED,"vthreshold mismatch 0:%d 1:%d 2:%d 3:%d\n", - ret[0],ret[1],ret[2],ret[3]); + retval[0] = -1;retval[1] = -1; + cprintf(RED,"vthreshold mismatch 0:%d 1:%d 2:%d 3:%d\n", + ret[0],ret[1],ret[2],ret[3]); } return; } @@ -657,26 +661,39 @@ int setThresholdEnergy(int ev, int imod){ printf(" Setting threshold energy:%d\n",ev); int retval[2],i; int thrvalue[NGAIN]; + int average=0; + if(ev >= 0) { - if(ev >= 0){ - eiger_photonenergy = ev; - //calculate thrvalues for dacs - for(i=0;i=0 && thrvalue[i]<2001)valid++; + }//ngains - //setdacs - setDAC(VCMP_LL,thrvalue[0],-1,0,retval);if(retval[0] != thrvalue[0]) cprintf(BG_RED,"Failed to set vcmp_ll to %d, got %d\n",retval[0],thrvalue[0]); - setDAC(VCMP_LR,thrvalue[1],-1,0,retval);if(retval[0] != thrvalue[1]) cprintf(BG_RED,"Failed to set vcmp_lr to %d, got %d\n",retval[0],thrvalue[1]); - setDAC(VCMP_RL,thrvalue[2],-1,0,retval);if(retval[0] != thrvalue[2]) cprintf(BG_RED,"Failed to set vcmp_rl to %d, got %d\n",retval[0],thrvalue[2]); - setDAC(VCMP_RR,thrvalue[3],-1,0,retval);if(retval[0] != thrvalue[3]) cprintf(BG_RED,"Failed to set vcmp_rr to %d, got %d\n",retval[0],thrvalue[3]); + if( valid == NGAIN){ + eiger_photonenergy = ev; + for(i=0;i