mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
udpip and hostname order for write config,receiver returns quicker when no data or mismatched indices
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@491 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
CROSS = bfin-uclinux-
|
CROSS = bfin-uclinux-
|
||||||
CC = $(CROSS)gcc
|
CC = $(CROSS)gcc
|
||||||
|
|
||||||
CFLAGS += -Wall -DMCB_FUNCS -DDACS_INT -DDEBUG #-DVERBOSE -DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
CFLAGS += -Wall -DMCB_FUNCS -DDACS_INT -DDEBUG #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||||
|
|
||||||
|
|
||||||
PROGS= gotthardDetectorServer
|
PROGS= gotthardDetectorServer
|
||||||
|
@ -2584,6 +2584,8 @@ dacs_t multiSlsDetector::getADC(dacIndex idac, int imod) {
|
|||||||
for (int idet=dmi; idet<dma; idet++) {
|
for (int idet=dmi; idet<dma; idet++) {
|
||||||
if (detectors[idet]) {
|
if (detectors[idet]) {
|
||||||
ret=detectors[idet]->getADC(idac, im);
|
ret=detectors[idet]->getADC(idac, im);
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
if (ret1==-100)
|
if (ret1==-100)
|
||||||
ret1=ret;
|
ret1=ret;
|
||||||
else if (ret!=ret1)
|
else if (ret!=ret1)
|
||||||
|
@ -1952,7 +1952,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
|||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}else setCannotConnectToDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -5338,8 +5338,8 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
|
|||||||
names[11]="detectorip";
|
names[11]="detectorip";
|
||||||
names[12]= "rx_tcpport";
|
names[12]= "rx_tcpport";
|
||||||
names[13]= "rx_udpport";
|
names[13]= "rx_udpport";
|
||||||
names[14]="rx_hostname";
|
names[14]="rx_udpip";
|
||||||
names[15]="rx_udpip";
|
names[15]="rx_hostname";
|
||||||
names[16]="outdir";
|
names[16]="outdir";
|
||||||
names[17]="vhighvoltage";
|
names[17]="vhighvoltage";
|
||||||
nvar=18;
|
nvar=18;
|
||||||
@ -6270,4 +6270,14 @@ int64_t slsDetector::clearAllErrorMask(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetector::setCannotConnectToDetector(){
|
||||||
|
std::cout << "cannot connect to detector" << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_DETECTOR));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetector::setCannotConnectToReceiver(){
|
||||||
|
std::cout << "cannot connect to Receiver" << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1554,6 +1554,14 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
int64_t clearAllErrorMask();
|
int64_t clearAllErrorMask();
|
||||||
|
|
||||||
|
/** Sets Cannot connect to Detector error mask and prints it
|
||||||
|
*/
|
||||||
|
void setCannotConnectToDetector();
|
||||||
|
|
||||||
|
/** Sets Cannot connect to Detector error mask and prints it
|
||||||
|
*/
|
||||||
|
void setCannotConnectToReceiver();
|
||||||
|
|
||||||
/** returns the detector MAC address\sa sharedSlsDetector */
|
/** returns the detector MAC address\sa sharedSlsDetector */
|
||||||
char* getDetectorMAC() {return thisDetector->detectorMAC;};
|
char* getDetectorMAC() {return thisDetector->detectorMAC;};
|
||||||
/** returns the detector IP address\sa sharedSlsDetector */
|
/** returns the detector IP address\sa sharedSlsDetector */
|
||||||
|
@ -2968,7 +2968,6 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
|
|||||||
dacIndex dac;
|
dacIndex dac;
|
||||||
dacs_t val=-1;
|
dacs_t val=-1;
|
||||||
char answer[1000];
|
char answer[1000];
|
||||||
|
|
||||||
if (cmd=="vthreshold")
|
if (cmd=="vthreshold")
|
||||||
dac=THRESHOLD;
|
dac=THRESHOLD;
|
||||||
else if (cmd=="vcalibration")
|
else if (cmd=="vcalibration")
|
||||||
@ -3007,15 +3006,7 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
|
|||||||
dac=G_VREF_COMP;
|
dac=G_VREF_COMP;
|
||||||
else if (cmd=="ib_test_c")
|
else if (cmd=="ib_test_c")
|
||||||
dac=G_IB_TESTC;
|
dac=G_IB_TESTC;
|
||||||
else if (cmd=="temp_adc") {
|
else
|
||||||
dac=TEMPERATURE_ADC;
|
|
||||||
if (action==PUT_ACTION)
|
|
||||||
return string("cannot set ")+cmd;
|
|
||||||
} else if (cmd=="temp_fpga") {
|
|
||||||
dac=TEMPERATURE_FPGA;
|
|
||||||
if (action==PUT_ACTION)
|
|
||||||
return string("cannot set ")+cmd;
|
|
||||||
} else
|
|
||||||
return string("cannot decode dac ")+cmd;
|
return string("cannot decode dac ")+cmd;
|
||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
@ -3144,6 +3135,8 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
|||||||
#else
|
#else
|
||||||
sprintf(answer,"%f",myDet->getADC(adc));
|
sprintf(answer,"%f",myDet->getADC(adc));
|
||||||
#endif
|
#endif
|
||||||
|
if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
|
||||||
|
strcat(answer,"°C");
|
||||||
return string(answer);
|
return string(answer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
cout.flush();
|
cout.flush();
|
||||||
cout<<flush;
|
cout<<flush;
|
||||||
if (checkJoinThread()) break;
|
if (checkJoinThread()) break;
|
||||||
usleep(200000);
|
usleep(20000);
|
||||||
|
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
caught=getReceiverCurrentFrameIndex();
|
caught=getReceiverCurrentFrameIndex();
|
||||||
|
@ -538,13 +538,22 @@ int slsReceiverFuncs::setup_udp(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy(eth,temp.c_str());
|
strcpy(eth,temp.c_str());
|
||||||
|
if (strchr(eth,'.')!=NULL) {
|
||||||
|
strcpy(eth,"");
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
cout<<"eth:"<<eth<<endl;
|
cout<<"eth:"<<eth<<endl;
|
||||||
slsReceiverList->setEthernetInterface(eth);
|
slsReceiverList->setEthernetInterface(eth);
|
||||||
|
|
||||||
//get mac address from ethernet interface
|
//get mac address from ethernet interface
|
||||||
temp = genericSocket::nameToMac(eth);
|
if (ret != FAIL)
|
||||||
if(temp=="00:00:00:00:00:00"){
|
temp = genericSocket::nameToMac(eth);
|
||||||
|
|
||||||
|
|
||||||
|
if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,"failed to get mac adddress to listen to\n");
|
strcpy(mess,"failed to get mac adddress to listen to\n");
|
||||||
|
cout << "mess:" << mess << endl;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
strcpy(retval,temp.c_str());
|
strcpy(retval,temp.c_str());
|
||||||
@ -817,43 +826,50 @@ int slsReceiverFuncs::read_frame(){
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
//for full frames
|
//for full frames
|
||||||
while(count<20){
|
while(count<10){
|
||||||
//get frame
|
//get frame
|
||||||
slsReceiverList->readFrame(fName,&raw);
|
slsReceiverList->readFrame(fName,&raw);
|
||||||
if (raw != NULL){
|
if (raw == NULL){
|
||||||
index=(int)(*(int*)raw);
|
count = -1;
|
||||||
index2= (int)(*((int*)((char*)(raw+onebuffersize))));
|
break;
|
||||||
memcpy(origVal,raw,bufferSize);
|
|
||||||
raw=NULL;
|
|
||||||
//cout<<"funcs\tindex:"<<index<<"\tindex2:"<<index2<<endl;
|
|
||||||
|
|
||||||
|
|
||||||
//1 odd, 1 even
|
|
||||||
if((index%2)!=index2%2){
|
|
||||||
//ideal situation (should be odd, even(index+1))
|
|
||||||
if(index%2){
|
|
||||||
memcpy(retval,((char*) origVal)+4, onedatasize);
|
|
||||||
memcpy((((char*)retval)+onedatasize), ((char*) origVal)+10+onedatasize, onedatasize);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//swap to even,odd
|
|
||||||
if(index2%2){
|
|
||||||
memcpy((((char*)retval)+onedatasize),((char*) origVal)+4, onedatasize);
|
|
||||||
memcpy(retval, ((char*) origVal)+10+onedatasize, onedatasize);
|
|
||||||
index=index2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
strcpy(mess,"could not read frame due to more than 20 mismatched indices\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index=(int)(*(int*)raw);
|
||||||
|
index2= (int)(*((int*)((char*)(raw+onebuffersize))));
|
||||||
|
memcpy(origVal,raw,bufferSize);
|
||||||
|
raw=NULL;
|
||||||
|
//cout<<"funcs\tindex:"<<index<<"\tindex2:"<<index2<<endl;
|
||||||
|
|
||||||
|
|
||||||
|
//1 odd, 1 even
|
||||||
|
if((index%2)!=index2%2){
|
||||||
|
//ideal situation (should be odd, even(index+1))
|
||||||
|
if(index%2){
|
||||||
|
memcpy(retval,((char*) origVal)+4, onedatasize);
|
||||||
|
memcpy((((char*)retval)+onedatasize), ((char*) origVal)+10+onedatasize, onedatasize);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//swap to even,odd
|
||||||
|
if(index2%2){
|
||||||
|
memcpy((((char*)retval)+onedatasize),((char*) origVal)+4, onedatasize);
|
||||||
|
memcpy(retval, ((char*) origVal)+10+onedatasize, onedatasize);
|
||||||
|
index=index2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
strcpy(mess,"could not read frame due to more than 20 mismatched indices\n");
|
||||||
|
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count==20){
|
if ((count==20) || (count == -1)){
|
||||||
cout << "same type: index:" << index << "\tindex2:" << index2 << endl;
|
if (count == -20)
|
||||||
|
cout << "same type: index:" << index << "\tindex2:" << index2 << endl;
|
||||||
|
else
|
||||||
|
cout << "no data to read for gui" << endl;
|
||||||
/**send garbage with -1 index to try again*/
|
/**send garbage with -1 index to try again*/
|
||||||
index = startIndex;
|
index = startIndex;
|
||||||
memcpy(retval,((char*) origVal)+4, onedatasize);
|
memcpy(retval,((char*) origVal)+4, onedatasize);
|
||||||
|
Reference in New Issue
Block a user