after some debugging at the beamline

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@137 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
x04sa 2012-03-09 14:40:10 +00:00
parent b070938f57
commit 7c07ae5a5a
8 changed files with 75 additions and 76 deletions

View File

@ -32,29 +32,18 @@ picassoServer: $(SRC_MYTHEN_SVC)
.cpp.o:
echo "short syntax"
$(CXX) -c -Wall $< -o $@ $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
%.o : %.cpp %.h
$(CXX) -Wall -o $@ -c $< $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
package: $(OBJS)
echo $(OBJS)
# $(CXX) -fPIC -g -o objs/slsDetectorCommand.o -c -Wall slsDetector/slsDetectorCommand.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/slsDetectorUtils.o -c -Wall slsDetector/slsDetectorUtils.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/slsDetector.o -c -Wall slsDetector/slsDetector.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/multiSlsDetector.o -c -Wall multiSlsDetector/multiSlsDetector.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/usersFunctions.o -c -Wall usersFunctions/usersFunctions.c $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
# $(CXX) -fPIC -g -o objs/MySocketTCP.o -c -Wall MySocketTCP/MySocketTCP.cpp $(INCLUDES) $(FLAGS)
$(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o objs/multiSlsDetector.o objs/usersFunctions.o objs/MySocketTCP.o -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
ln -sf libSlsDetector.so libSlsDetector.so.1
ln -sf libSlsDetector.so libSlsDetector.so.1.0.1
ar rcs libSlsDetector.a $(OBJS)
#objs/slsDetector.o objs/usersFunctions.o objs/MySocketTCP.o objs/multiSlsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o
clean:
rm -rf libSlsDetector.so.1 libSlsDetector.so.1.0.1 libSlsDetector.so core docs/* $(OBJS)
#objs/*

View File

@ -1,14 +1,18 @@
CFLAGS= -DC_ONLY
FLAGS=-DVERBOSE
#CFLAGS= -DC_ONLY
#FLAGS=-DVERBOSE
INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand
EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom
SRC_CLNT= slsDetector/slsDetector.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.c multiSlsDetector/multiSlsDetector.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp
SRC_CLNT= slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp usersFunctions/usersFunctions.cpp MySocketTCP/MySocketTCP.cpp
OBJS = $(SRC_CLNT:.cpp=.o)
SRC_MYTHEN_SVC = mythenDetectorServer/server.c mythenDetectorServer/server_funcs.c mythenDetectorServer/communication_funcs.c mythenDetectorServer/firmware_funcs.c mythenDetectorServer/mcb_funcs.c mythenDetectorServer/trimming_funcs.c
all: package mythenServer doc picassoServer
all: package doc
doc: $(SRC_H) $(SRC_CLNT)
doxygen doxy.config
@ -25,18 +29,19 @@ picassoServer: $(SRC_MYTHEN_SVC)
mv a.out picassoServer
%.o : %.cpp %.h
$(CXX) -Wall -o $@ -c $< $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
package: $(OBJS)
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
# $(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o $(OBJS) -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
# ln -sf libSlsDetector.so libSlsDetector.so.1
# ln -sf libSlsDetector.so libSlsDetector.so.1.0.1
ar rcs libSlsDetector.a $(OBJS)
package: $(SRC_CLNT)
$(CXX) -fPIC -g -o objs/slsDetectorCommand.o -c -Wall slsDetector/slsDetectorCommand.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/slsDetectorUtils.o -c -Wall slsDetector/slsDetectorUtils.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/slsDetector.o -c -Wall slsDetector/slsDetector.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/multiSlsDetector.o -c -Wall multiSlsDetector/multiSlsDetector.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/usersFunctions.o -c -Wall usersFunctions/usersFunctions.c $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
$(CXX) -fPIC -g -o objs/MySocketTCP.o -c -Wall MySocketTCP/MySocketTCP.cpp $(INCLUDES) $(FLAGS)
$(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o objs/multiSlsDetector.o objs/usersFunctions.o objs/MySocketTCP.o -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
ln -sf libSlsDetector.so libSlsDetector.so.1
ln -sf libSlsDetector.so libSlsDetector.so.1.0.1
ar rcs libSlsDetector.a objs/slsDetector.o objs/usersFunctions.o objs/MySocketTCP.o objs/multiSlsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o
clean:
rm -rf libSlsDetector.so.1 libSlsDetector.so.1.0.1 libSlsDetector.so core objs/* docs/*

View File

@ -917,7 +917,7 @@ int multiSlsDetector::stopAcquisition(){
}
for (i=0; i<thisMultiDetector->numberOfDetectors; i++) {
if (detectors[i]) {
ret=detectors[i]->startAcquisition();
ret=detectors[i]->stopAcquisition();
if (ret!=OK)
ret1=FAIL;
}
@ -1027,7 +1027,6 @@ int* multiSlsDetector::readFrame(){
memcpy(p,retdet,n);
delete [] retdet;
p+=n/sizeof(int);
} else {
#ifdef VERBOSE
cout << "Detector " << id << " does not have data left " << endl;
@ -1037,6 +1036,7 @@ int* multiSlsDetector::readFrame(){
}
}
}
dataQueue.push(retval);
return retval;
};
@ -1115,7 +1115,7 @@ int* multiSlsDetector::startAndReadAll(){
}
#ifdef VERBOSE
std::cout<< "recieved "<< i<< " frames" << std::endl;
std::cout<< "MMMM recieved "<< i<< " frames" << std::endl;
#endif
return dataQueue.front(); // check what we return!
@ -1751,12 +1751,12 @@ int multiSlsDetector::setBadChannelCorrection(int nbad, int *badlist, int ff) {
for (int ich=0; ich<nbad; ich++) {
if (detectors[idet]) {
if ((badlist[ich]-choff)>=detectors[idet]->getTotalNumberOfChannels()) {
if ((badlist[ich]-choff)>=detectors[idet]->getMaxNumberOfChannels()) {
#ifdef VERBOSE
cout << "setting " << nbaddet << " badchans to detector " << idet << endl;
#endif
detectors[idet]->setBadChannelCorrection(nbaddet,badlist,0);
choff+=detectors[idet]->getTotalNumberOfChannels();
choff+=detectors[idet]->getMaxNumberOfChannels();
nbaddet=0;
idet++;
if (detectors[idet]==NULL)
@ -1774,7 +1774,7 @@ int multiSlsDetector::setBadChannelCorrection(int nbad, int *badlist, int ff) {
cout << "setting " << nbaddet << " badchans to detector " << idet << endl;
#endif
detectors[idet]->setBadChannelCorrection(nbaddet,badlist,0);
choff+=detectors[idet]->getTotalNumberOfChannels();
choff+=detectors[idet]->getMaxNumberOfChannels();
nbaddet=0;
idet++;
}
@ -3040,21 +3040,11 @@ int multiSlsDetector::dumpDetectorSetup(string const fname, int level){
#ifdef VERBOSE
std::cout<< "wrote " <<iv << " lines to "<< fname1 << std::endl;
#endif
delete cmd;
return 0;
};
}
@ -3159,7 +3149,7 @@ int multiSlsDetector::retrieveDetectorSetup(string const fname1, int level){
return iline;
};
}
@ -3294,7 +3284,6 @@ int multiSlsDetector::readDataFile(string fname, float *data, float *err, float
}
int multiSlsDetector::readDataFile(string fname, int *data) {
#ifdef VERBOSE

View File

@ -778,14 +778,6 @@ class multiSlsDetector : public slsDetectorUtils {
float getCurrentProgress();
/**
get run status
\returns status mask
*/
//virtual runStatus getRunStatus()=0;
runStatus getRunStatus();
/**
set dacs value
\param val value (in V)
@ -824,6 +816,12 @@ class multiSlsDetector : public slsDetectorUtils {
/**
get run status
\returns status mask
*/
//virtual runStatus getRunStatus()=0;
runStatus getRunStatus();

View File

@ -711,14 +711,18 @@ string slsDetectorCommand::cmdData(int narg, char *args[], int action) {
#ifdef VERBOSE
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
#endif
int b;
if (action==PUT_ACTION) {
return string("cannot set");
} else if (action==HELP_ACTION) {
return helpData(narg,args,HELP_ACTION);
} else {
b=myDet->setThreadedProcessing(-1);
myDet->setThreadedProcessing(0);
myDet->setOnline(ONLINE_FLAG);
myDet->readAll();
myDet->processData(1);
myDet->setThreadedProcessing(b);
return string("ok");
}
}
@ -736,7 +740,7 @@ string slsDetectorCommand::helpData(int narg, char *args[], int action){
string slsDetectorCommand::cmdFrame(int narg, char *args[], int action) {
int b;
#ifdef VERBOSE
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
#endif
@ -745,9 +749,12 @@ string slsDetectorCommand::cmdFrame(int narg, char *args[], int action) {
} else if (action==HELP_ACTION) {
return helpFrame(narg,args,HELP_ACTION);
} else {
b=myDet->setThreadedProcessing(-1);
myDet->setThreadedProcessing(0);
myDet->setOnline(ONLINE_FLAG);
myDet->readFrame();
myDet->processData(1);
myDet->setThreadedProcessing(b);
return string("ok");
}
@ -1772,16 +1779,22 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
;
else
return string("invalid scan minimum")+string(args[1]);
if (sscanf(args[2],"%f",&fmin))
if (sscanf(args[2],"%f",&fmax))
;
else
return string("invalid scan minimum")+string(args[2]);
if (sscanf(args[2],"%f",&fstep))
return string("invalid scan maximum")+string(args[2]);
if (sscanf(args[3],"%f",&fstep))
;
else
return string("invalid scan step")+string(args[3]);
if (fstep==0)
return string("scan step cannot be 0!");
#ifdef VERBOSE
cout << fmin << " " << fmax << " " << fstep << endl;
#endif
ns=(fmax-fmin)/fstep;
if (ns<0)
@ -2176,7 +2189,7 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
}
return string(myDet->getSettingsFile());
} else if (cmd=="trim") {
if (action==GET_ACTION) {
if (action==GET_ACTION)
return string("cannot get!");
trimMode mode=NOISE_TRIMMING;
@ -2212,7 +2225,7 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
string sval=string(args[1]);
myDet->saveSettingsFile(sval, -1);
return string("done");
}
}
return string("unknown settings command ")+cmd;

View File

@ -1792,16 +1792,22 @@ void* slsDetectorUtils::processData(int delflag) {
}
pthread_mutex_unlock(&mp);
usleep(1000);
}
pthread_mutex_unlock(&mp);
pthread_mutex_lock(&mp);
#ifdef VERBOSE
// cout << "looping on dataque size" << endl;
#endif
}
//pthread_mutex_unlock(&mp);
//pthread_mutex_lock(&mp);
if (jointhread) {
pthread_mutex_unlock(&mp);
if (dataQueue.size()==0)
break;
} else
} else {
#ifdef VERBOSE
// cout << "waiting on jointhread "<< jointhread << " " << (*threadedProcessing) << endl;
#endif
pthread_mutex_unlock(&mp);
}
dum=0;
} // ????????????????????????
return 0;

View File

@ -152,7 +152,7 @@ float get_position() {
pos=value;
} else
printf(ca_message(status));
#endif;
#endif
@ -244,7 +244,7 @@ float get_i0() {
printf(ca_message(status));
#else
i0++;
#endif;
#endif
//"ca_get X04SA-ES2-SC:CH6"
return i0;

View File

@ -152,7 +152,7 @@ float get_position() {
pos=value;
} else
printf(ca_message(status));
#endif;
#endif
@ -171,12 +171,12 @@ int go_to_position(float p) {
int status;
if (ch_pos<0) return -1;
/* /\* caput and wait until done *\/ */
if ((status = caput(ch_pos, p)) == ECA_NORMAL)
if ((status = caput(ch_pos, p)) == ECA_NORMAL) {
;
#ifdef VERBOSE
printf("caput: success\n");
#endif
else
} else
printf(ca_message(status));
#else
pos=p;
@ -199,13 +199,12 @@ int go_to_position_no_wait(float p) {
int status;
if (ch_pos<0) return -1;
/* /\* caput and wait until done *\/ */
if ((status = caputq(ch_pos, p)) == ECA_NORMAL)
if ((status = caputq(ch_pos, p)) == ECA_NORMAL) {
;
#ifdef VERBOSE
printf("caputq: success\n");
#endif
else
} else
printf(ca_message(status));
#else
pos=p;
@ -244,7 +243,7 @@ float get_i0() {
printf(ca_message(status));
#else
i0++;
#endif;
#endif
//"ca_get X04SA-ES2-SC:CH6"
return i0;