diff --git a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c index 5e28d88a6..ab12ef2af 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c @@ -64,6 +64,8 @@ int slaveadcphase = 0; int rsttosw1delay = 2; int startacqdelay = 1; +int detectorFirstServer = 1; + #ifdef MCB_FUNCS extern const int nChans; @@ -273,12 +275,20 @@ void setMasterSlaveConfiguration(){ } else { cprintf(RED,"could not scan masterflags %s value from config file\n",value); + fclose(fd); exit(EXIT_FAILURE); } + + if (!detectorFirstServer) { + cprintf(BLUE, "Server has been started up before. Ignoring rest of config file\n"); + fclose(fd); + return; + } } else { if(sscanf(value,"%d",&ival)<=0) { cprintf(RED,"could not scan patternphase %s value from config file\n",value); + fclose(fd); exit(EXIT_FAILURE); } @@ -298,6 +308,7 @@ void setMasterSlaveConfiguration(){ startacqdelay = ival; else { cprintf(RED,"could not scan parameter name %s from config file\n",key); + fclose(fd); exit(EXIT_FAILURE); } } @@ -384,6 +395,7 @@ int setPhaseShiftOnce(){ //bus_w(addr,0x0); //clear the reg if(reg==0){ + detectorFirstServer = 1; printf("\nImplementing phase shift of %d\n",phase_shift); for (i=1;i>(23-i))&0x1)<