mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-11 23:20:03 +02:00
versions at the beamline
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@136 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
461fd8824f
commit
b070938f57
@ -1,14 +1,20 @@
|
||||
CFLAGS= -DC_ONLY
|
||||
FLAGS=-DVERBOSE
|
||||
#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
|
||||
CC=g++
|
||||
|
||||
|
||||
SRC_CLNT= slsDetector/slsDetector.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp multiSlsDetector/multiSlsDetector.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp
|
||||
|
||||
OBJS = $(SRC_CLNT:.cpp=.o)
|
||||
|
||||
|
||||
SRC_CLNT= slsDetector/slsDetector.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.c multiSlsDetector/multiSlsDetector.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp
|
||||
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 $(SRC_CLNT)
|
||||
echo "compiling all"
|
||||
|
||||
doc: $(SRC_H) $(SRC_CLNT)
|
||||
doxygen doxy.config
|
||||
@ -26,21 +32,32 @@ picassoServer: $(SRC_MYTHEN_SVC)
|
||||
|
||||
|
||||
|
||||
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)
|
||||
.cpp.o:
|
||||
echo "short syntax"
|
||||
$(CXX) -c -Wall $< -o $@ $(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/slsDetector.o objs/usersFunctions.o objs/MySocketTCP.o objs/multiSlsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o
|
||||
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 objs/* docs/*
|
||||
|
||||
rm -rf libSlsDetector.so.1 libSlsDetector.so.1.0.1 libSlsDetector.so core docs/* $(OBJS)
|
||||
#objs/*
|
||||
#-------------------------------------------------------------------------------
|
||||
lib: package
|
||||
|
||||
|
66
slsDetectorSoftware/Makefile.x04sa
Normal file
66
slsDetectorSoftware/Makefile.x04sa
Normal file
@ -0,0 +1,66 @@
|
||||
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_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
|
||||
|
||||
doc: $(SRC_H) $(SRC_CLNT)
|
||||
doxygen doxy.config
|
||||
|
||||
|
||||
|
||||
mythenServer: $(SRC_MYTHEN_SVC)
|
||||
$(CC) $(SRC_MYTHEN_SVC) $(CFLAGS) $(FLAGS) $(INCLUDES) -ImythenDetectorServer -DVIRTUAL -lm -D MCB_FUNCS -DC_ONLY -DVERBOSE
|
||||
mv a.out mythenServer
|
||||
|
||||
|
||||
picassoServer: $(SRC_MYTHEN_SVC)
|
||||
$(CC) $(SRC_MYTHEN_SVC) $(CFLAGS) $(FLAGS) $(INCLUDES) -ImythenDetectorServer -D VIRTUAL -lm -DMCB_FUNCS -DPICASSOD -DC_ONLY
|
||||
mv a.out picassoServer
|
||||
|
||||
|
||||
|
||||
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/*
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
lib: package
|
||||
|
||||
|
||||
# added install target, HBl
|
||||
install_lib: lib
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
cp -P libSlsDetector.so.1.0.1 libSlsDetector.so libSlsDetector.so.1 $(DESTDIR)
|
||||
|
||||
install_inc:
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
cp -P ../slsDetectorSoftware/MySocketTCP/MySocketTCP.h $(DESTDIR)
|
||||
cp -P ../slsDetectorSoftware/slsDetector/slsDetectorBase.h $(DESTDIR)
|
||||
cp -P ../slsDetectorSoftware/slsDetector/slsDetector.h $(DESTDIR)
|
||||
cp -P ../slsDetectorSoftware/slsDetector/slsDetectorUtils.h $(DESTDIR)
|
||||
cp -P ../slsDetectorSoftware/slsDetector/slsDetectorCommand.h $(DESTDIR)
|
||||
cp -P ../slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h $(DESTDIR)
|
||||
cp -P ../slsDetectorSoftware/commonFiles/sls_detector_defs.h $(DESTDIR)
|
||||
cp -P ../slsDetectorSoftware/usersFunctions/usersFunctions.h $(DESTDIR)
|
||||
|
||||
install_doc:
|
||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||
cp -Pr docs/* $(DESTDIR)
|
@ -1303,7 +1303,9 @@ string slsDetectorCommand::cmdFlatField(int narg, char *args[], int action){
|
||||
return string("none");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
return string("could not decode flat field action ")+cmd;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ int connect_channel(const char *name, chid *ch_id) {
|
||||
int status = ECA_NORMAL;
|
||||
status = ca_create_channel(name, NULL, NULL, CA_PRIORITY_DEFAULT, ch_id);
|
||||
if (status != ECA_NORMAL)
|
||||
return status;
|
||||
return status;
|
||||
|
||||
status = ca_pend_io(timeout);
|
||||
return status;
|
||||
@ -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,12 +199,13 @@ 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;
|
||||
@ -243,7 +244,7 @@ float get_i0() {
|
||||
printf(ca_message(status));
|
||||
#else
|
||||
i0++;
|
||||
#endif
|
||||
#endif;
|
||||
|
||||
//"ca_get X04SA-ES2-SC:CH6"
|
||||
return i0;
|
||||
@ -292,11 +293,12 @@ int connect_channels() {
|
||||
printf(ca_message(status));
|
||||
//ch_getpos=-1;;
|
||||
}
|
||||
|
||||
|
||||
// caget X04SA-ES2-TH2:RO.RBV
|
||||
|
||||
//cawait -nounit -timeout 3600 X04SA-ES2-TH2:RO.DMOV '==1'
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int disconnect_channels() {
|
||||
@ -309,6 +311,7 @@ int disconnect_channels() {
|
||||
/* delete channel access context before program exits */
|
||||
ca_context_destroy();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
321
slsDetectorSoftware/usersFunctions/usersFunctions.cpp
Normal file
321
slsDetectorSoftware/usersFunctions/usersFunctions.cpp
Normal file
@ -0,0 +1,321 @@
|
||||
#include "usersFunctions.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
float pos;
|
||||
float i0=0;
|
||||
#ifdef EPICS
|
||||
|
||||
#include <cadef.h>
|
||||
#include <epicsEvent.h>
|
||||
|
||||
static double timeout = 3.0;
|
||||
|
||||
chid ch_pos,ch_i0, ch_getpos;
|
||||
|
||||
|
||||
|
||||
|
||||
/* connect to a PV */
|
||||
int connect_channel(const char *name, chid *ch_id) {
|
||||
int status = ECA_NORMAL;
|
||||
status = ca_create_channel(name, NULL, NULL, CA_PRIORITY_DEFAULT, ch_id);
|
||||
if (status != ECA_NORMAL)
|
||||
return status;
|
||||
|
||||
status = ca_pend_io(timeout);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* disconnect to a PV */
|
||||
int disconnect_channel(chid ch_id)
|
||||
{
|
||||
ca_clear_channel(ch_id);
|
||||
ca_flush_io();
|
||||
}
|
||||
|
||||
int caget(chid ch_id, double *value) {
|
||||
|
||||
int status = ECA_NORMAL;
|
||||
|
||||
status = ca_get(DBR_DOUBLE, ch_id, value);
|
||||
if (status != ECA_NORMAL) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = ca_pend_io(timeout);
|
||||
if (status != ECA_NORMAL) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int caputq(chid ch_id, double value) {
|
||||
// does not wait!
|
||||
int status = ECA_NORMAL;
|
||||
|
||||
status = ca_put(DBR_DOUBLE, ch_id, &value);
|
||||
if (status != ECA_NORMAL)
|
||||
return status;
|
||||
|
||||
status = ca_pend_io(timeout);
|
||||
if (status != ECA_NORMAL) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void put_callback(struct event_handler_args args)
|
||||
{
|
||||
epicsEventId eid = (epicsEventId)args.usr;
|
||||
epicsEventSignal(eid);
|
||||
}
|
||||
|
||||
int caput(chid ch_id, double value) {
|
||||
|
||||
// waits!
|
||||
int status = ECA_NORMAL;
|
||||
epicsEventId eid = epicsEventCreate(epicsEventEmpty);
|
||||
|
||||
status = ca_put_callback(DBR_DOUBLE,
|
||||
ch_id,
|
||||
&value,
|
||||
put_callback,
|
||||
eid);
|
||||
status = ca_pend_io(timeout);
|
||||
if (status != ECA_NORMAL)
|
||||
return status;
|
||||
|
||||
if (epicsEventWait(eid) != epicsEventWaitOK)
|
||||
status = ECA_TIMEOUT;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//int main(int argc, char *argv[]) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
contains the conversion channel-angle for a module channel
|
||||
conv_r=pitch/radius
|
||||
*/
|
||||
|
||||
|
||||
float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction) {
|
||||
|
||||
|
||||
(void) tilt; /* to avoid warning: unused parameter */
|
||||
float ang;
|
||||
|
||||
ang=180./PI*(center*conv_r+atan((float)(ichan-center)*conv_r))+encoder+totalOffset+offset;
|
||||
|
||||
return direction*ang;
|
||||
|
||||
}
|
||||
|
||||
/* reads the encoder and returns the position */
|
||||
|
||||
float get_position() {
|
||||
#ifdef VERBOSE
|
||||
printf("Getting motor position \n");
|
||||
#endif
|
||||
// caget X04SA-ES2-TH2:RO.RBV
|
||||
|
||||
#ifdef EPICS
|
||||
int status;
|
||||
|
||||
double value = 256;
|
||||
if (ch_getpos<0) return -1;
|
||||
|
||||
/* /\* caget *\/ */
|
||||
if (caget(ch_getpos, &value) == ECA_NORMAL) {
|
||||
#ifdef VERBOSE
|
||||
printf("caget: %f\n", value);
|
||||
#endif
|
||||
pos=value;
|
||||
} else
|
||||
printf(ca_message(status));
|
||||
#endif;
|
||||
|
||||
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
/* moves the encoder to position p */
|
||||
|
||||
|
||||
int go_to_position(float p) {
|
||||
#ifdef VERBOSE
|
||||
printf("Setting motor position \n");
|
||||
#endif
|
||||
|
||||
#ifdef EPICS
|
||||
int status;
|
||||
if (ch_pos<0) return -1;
|
||||
/* /\* caput and wait until done *\/ */
|
||||
if ((status = caput(ch_pos, p)) == ECA_NORMAL)
|
||||
;
|
||||
#ifdef VERBOSE
|
||||
printf("caput: success\n");
|
||||
#endif
|
||||
else
|
||||
printf(ca_message(status));
|
||||
#else
|
||||
pos=p;
|
||||
#endif
|
||||
//"caputq X04SA-ES2-TH2:RO p"
|
||||
//cawait -nounit -timeout 3600 X04SA-ES2-TH2:RO.DMOV '==1'
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/* moves the encoder to position p without waiting */
|
||||
|
||||
int go_to_position_no_wait(float p) {
|
||||
#ifdef VERBOSE
|
||||
printf("Setting motor position no wait \n");
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef EPICS
|
||||
int status;
|
||||
if (ch_pos<0) return -1;
|
||||
/* /\* caput and wait until done *\/ */
|
||||
if ((status = caputq(ch_pos, p)) == ECA_NORMAL)
|
||||
;
|
||||
#ifdef VERBOSE
|
||||
printf("caputq: success\n");
|
||||
#endif
|
||||
|
||||
else
|
||||
printf(ca_message(status));
|
||||
#else
|
||||
pos=p;
|
||||
#endif
|
||||
//"caputq X04SA-ES2-TH2:RO p"
|
||||
|
||||
return p;
|
||||
|
||||
|
||||
|
||||
|
||||
pos=p;
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
/* reads I0 and returns the intensity */
|
||||
|
||||
float get_i0() {
|
||||
#ifdef VERBOSE
|
||||
printf("Getting I0 readout \n");
|
||||
#endif
|
||||
|
||||
#ifdef EPICS
|
||||
int status;
|
||||
|
||||
double value = 256;
|
||||
/* /\* caget *\/ */
|
||||
if (ch_i0<0) return -1;
|
||||
if (caget(ch_i0, &value) == ECA_NORMAL) {
|
||||
#ifdef VERBOSE
|
||||
printf("caget: %f\n", value);
|
||||
#endif
|
||||
i0=value;
|
||||
} else
|
||||
printf(ca_message(status));
|
||||
#else
|
||||
i0++;
|
||||
#endif;
|
||||
|
||||
//"ca_get X04SA-ES2-SC:CH6"
|
||||
return i0;
|
||||
}
|
||||
|
||||
|
||||
int connect_channels() {
|
||||
#ifdef EPICS
|
||||
//double value = 256;
|
||||
/* channel name */
|
||||
//const char *name = "ARIDI-PCT:CURRENT";
|
||||
/* channel id */
|
||||
/* status code */
|
||||
int status;
|
||||
|
||||
printf("starting...\n");
|
||||
|
||||
/* init channel access context before any caget/put */
|
||||
ca_context_create(ca_enable_preemptive_callback);
|
||||
|
||||
printf("context created\n");
|
||||
|
||||
//"caputq X04SA-ES2-TH2:RO p"
|
||||
|
||||
//"ca_get X04SA-ES2-SC:CH6"
|
||||
|
||||
/* open the channel by name and return ch_id */
|
||||
status = connect_channel("X04SA-ES2-SC:CH6", &ch_i0);
|
||||
if (status == ECA_NORMAL)
|
||||
printf("I0 channel connected \n");
|
||||
else {
|
||||
printf(ca_message(status));
|
||||
//ch_i0=-1;;
|
||||
}
|
||||
status = connect_channel("X04SA-ES2-TH2:RO", &ch_pos);
|
||||
if (status == ECA_NORMAL)
|
||||
printf("Detector position channel connected \n");
|
||||
else {
|
||||
printf(ca_message(status));
|
||||
//ch_i0=-1;;
|
||||
}
|
||||
status = connect_channel("X04SA-ES2-TH2:RO.RBV", &ch_getpos);
|
||||
if (status == ECA_NORMAL)
|
||||
printf("Detector get position channel connected \n");
|
||||
else {
|
||||
printf(ca_message(status));
|
||||
//ch_getpos=-1;;
|
||||
}
|
||||
|
||||
// caget X04SA-ES2-TH2:RO.RBV
|
||||
|
||||
//cawait -nounit -timeout 3600 X04SA-ES2-TH2:RO.DMOV '==1'
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int disconnect_channels() {
|
||||
#ifdef EPICS
|
||||
/* close channel connect */
|
||||
disconnect_channel(ch_i0);
|
||||
disconnect_channel(ch_pos);
|
||||
disconnect_channel(ch_getpos);
|
||||
|
||||
/* delete channel access context before program exits */
|
||||
ca_context_destroy();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user