mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +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:
parent
d205e79106
commit
1882454cf3
@ -6,7 +6,7 @@
|
||||
CROSS = bfin-uclinux-
|
||||
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
|
||||
|
@ -2584,6 +2584,8 @@ dacs_t multiSlsDetector::getADC(dacIndex idac, int imod) {
|
||||
for (int idet=dmi; idet<dma; idet++) {
|
||||
if (detectors[idet]) {
|
||||
ret=detectors[idet]->getADC(idac, im);
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
if (ret1==-100)
|
||||
ret1=ret;
|
||||
else if (ret!=ret1)
|
||||
|
@ -1952,7 +1952,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}else setCannotConnectToDetector();
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
@ -5338,8 +5338,8 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
|
||||
names[11]="detectorip";
|
||||
names[12]= "rx_tcpport";
|
||||
names[13]= "rx_udpport";
|
||||
names[14]="rx_hostname";
|
||||
names[15]="rx_udpip";
|
||||
names[14]="rx_udpip";
|
||||
names[15]="rx_hostname";
|
||||
names[16]="outdir";
|
||||
names[17]="vhighvoltage";
|
||||
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();
|
||||
|
||||
/** 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 */
|
||||
char* getDetectorMAC() {return thisDetector->detectorMAC;};
|
||||
/** returns the detector IP address\sa sharedSlsDetector */
|
||||
|
@ -2968,7 +2968,6 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
|
||||
dacIndex dac;
|
||||
dacs_t val=-1;
|
||||
char answer[1000];
|
||||
|
||||
if (cmd=="vthreshold")
|
||||
dac=THRESHOLD;
|
||||
else if (cmd=="vcalibration")
|
||||
@ -3007,15 +3006,7 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
|
||||
dac=G_VREF_COMP;
|
||||
else if (cmd=="ib_test_c")
|
||||
dac=G_IB_TESTC;
|
||||
else if (cmd=="temp_adc") {
|
||||
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
|
||||
else
|
||||
return string("cannot decode dac ")+cmd;
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
@ -3144,6 +3135,8 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
#else
|
||||
sprintf(answer,"%f",myDet->getADC(adc));
|
||||
#endif
|
||||
if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
|
||||
strcat(answer,"°C");
|
||||
return string(answer);
|
||||
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ void* postProcessing::processData(int delflag) {
|
||||
cout.flush();
|
||||
cout<<flush;
|
||||
if (checkJoinThread()) break;
|
||||
usleep(200000);
|
||||
usleep(20000);
|
||||
|
||||
pthread_mutex_lock(&mg);
|
||||
caught=getReceiverCurrentFrameIndex();
|
||||
|
@ -538,13 +538,22 @@ int slsReceiverFuncs::setup_udp(){
|
||||
}
|
||||
else{
|
||||
strcpy(eth,temp.c_str());
|
||||
if (strchr(eth,'.')!=NULL) {
|
||||
strcpy(eth,"");
|
||||
ret = FAIL;
|
||||
}
|
||||
cout<<"eth:"<<eth<<endl;
|
||||
slsReceiverList->setEthernetInterface(eth);
|
||||
|
||||
//get mac address from ethernet interface
|
||||
temp = genericSocket::nameToMac(eth);
|
||||
if(temp=="00:00:00:00:00:00"){
|
||||
if (ret != FAIL)
|
||||
temp = genericSocket::nameToMac(eth);
|
||||
|
||||
|
||||
if ((temp=="00:00:00:00:00:00") || (ret == FAIL)){
|
||||
ret = FAIL;
|
||||
strcpy(mess,"failed to get mac adddress to listen to\n");
|
||||
cout << "mess:" << mess << endl;
|
||||
}
|
||||
else{
|
||||
strcpy(retval,temp.c_str());
|
||||
@ -817,43 +826,50 @@ int slsReceiverFuncs::read_frame(){
|
||||
|
||||
}else{
|
||||
//for full frames
|
||||
while(count<20){
|
||||
while(count<10){
|
||||
//get frame
|
||||
slsReceiverList->readFrame(fName,&raw);
|
||||
if (raw != NULL){
|
||||
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");
|
||||
if (raw == NULL){
|
||||
count = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
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);
|
||||
count++;
|
||||
}
|
||||
|
||||
if(count==20){
|
||||
cout << "same type: index:" << index << "\tindex2:" << index2 << endl;
|
||||
if ((count==20) || (count == -1)){
|
||||
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*/
|
||||
index = startIndex;
|
||||
memcpy(retval,((char*) origVal)+4, onedatasize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user