fixed jungfrau problem, changed set receiver to updatedetector before

This commit is contained in:
Dhanya Maliakal
2016-11-04 17:14:47 +01:00
parent 25780a2b4f
commit 8caa9d8779
5 changed files with 31 additions and 15 deletions

View File

@ -1630,12 +1630,30 @@ int configureInterface(uint32_t destip,uint64_t destmac,uint64_t sourcemac,int
#endif #endif
bus_w(CONTROL_REG,GB10_RESET_BIT); bus_w(CONTROL_REG,GB10_RESET_BIT);
usleep(500 * 1000); //usleep(50 * 1000);
bus_w(CONTROL_REG,0); bus_w(CONTROL_REG,0);
usleep(10* 1000); //usleep(500* 1000);
//bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT);
printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG));
/*
bus_w(CONTROL_REG,GB10_RESET_BIT);
bus_w(CONTROL_REG,0);
usleep(500 * 1000);
bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT); bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT);
printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG)); printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG));
*/
printf("Reset mem machine fifos\n");
bus_w(MEM_MACHINE_FIFOS_REG,0x4000);
bus_w(MEM_MACHINE_FIFOS_REG,0x0);
printf("Reset run control\n");
bus_w(MEM_MACHINE_FIFOS_REG,0x0400);
bus_w(MEM_MACHINE_FIFOS_REG,0x0);
usleep(500 * 1000); usleep(500 * 1000);
return 0; //any value doesnt matter - dhanya return 0; //any value doesnt matter - dhanya
} }
@ -1674,11 +1692,7 @@ int configureMAC(uint32_t destip,uint64_t destmac,uint64_t sourcemac,int source
for (interface=0; interface <ngb; interface++) for (interface=0; interface <ngb; interface++)
configureInterface(destip, destmac, sourcemac+interface, sourceip+interface, ival, destport+interface, sourceport+interface, interface); configureInterface(destip, destmac, sourcemac+interface, sourceip+interface, ival, destport+interface, sourceport+interface, interface);
bus_w(CONTROL_REG,GB10_RESET_BIT);
bus_w(CONTROL_REG,0);
usleep(500 * 1000);
bus_w(CONFIG_REG,conf | GB10_NOT_CPU_BIT);
printf("System status register is %08x\n",bus_r(SYSTEM_STATUS_REG));
return OK; return OK;
} }

View File

@ -2024,7 +2024,7 @@ int set_dynamic_range(int file_des) {
int retval; int retval;
int ret=OK; int ret=OK;
printf("Set dynamic range?\n"); printf("Set dynamic range\n");
sprintf(mess,"can't set dynamic range\n"); sprintf(mess,"can't set dynamic range\n");

View File

@ -5101,7 +5101,6 @@ void multiSlsDetector::startReceivingDataThread(){
int ithread = currentThreadIndex; //set current thread value index int ithread = currentThreadIndex; //set current thread value index
char hostname[100] = "tcp://"; char hostname[100] = "tcp://";
char rx_hostname[100]; char rx_hostname[100];
strcpy(rx_hostname, detectors[ithread]->getReceiver()); strcpy(rx_hostname, detectors[ithread]->getReceiver());
cout<<"rx_hostname:"<<rx_hostname<<endl; cout<<"rx_hostname:"<<rx_hostname<<endl;
@ -5159,10 +5158,8 @@ void multiSlsDetector::startReceivingDataThread(){
sem_wait(&sem_singlewait[ithread]); //wait for it to be copied sem_wait(&sem_singlewait[ithread]); //wait for it to be copied
//check to exit thread //check to exit thread
if(killAllReceivingDataThreads){ if(killAllReceivingDataThreads)
delete [] singleframe[ithread];
break; break;
}
//scan header------------------------------------------------------------------- //scan header-------------------------------------------------------------------
zmq_msg_init (&message); zmq_msg_init (&message);
@ -5222,7 +5219,7 @@ void multiSlsDetector::startReceivingDataThread(){
//end of socket ("end") //end of socket ("end")
if (len < expectedsize ) { if (len < expectedsize ) {
if(len == 3){ if(len == 3){
cprintf(RED,"%d Received end of acquisition\n", ithread); //cprintf(RED,"%d Received end of acquisition\n", ithread);
singleframe[ithread] = NULL; singleframe[ithread] = NULL;
//break; //break;
}else{ }else{
@ -5255,6 +5252,9 @@ void multiSlsDetector::startReceivingDataThread(){
zmq_close(zmqsocket); zmq_close(zmqsocket);
zmq_ctx_destroy(context); zmq_ctx_destroy(context);
//free resources
delete [] image;
#ifdef DEBUG #ifdef DEBUG
cprintf(MAGENTA,"Receiving Data Thread %d:Goodbye!\n",ithread); cprintf(MAGENTA,"Receiving Data Thread %d:Goodbye!\n",ithread);
#endif #endif
@ -5363,7 +5363,7 @@ void multiSlsDetector::readFrameFromReceiver(){
//no interleaving, just add to the end //no interleaving, just add to the end
//numReadout always 1 here //numReadout always 1 here
else{ else{
memcpy((char*)multiframe,(char*)singleframe[ireadout],slsdatabytes); memcpy((char*)multiframe+slsdatabytes*ireadout,(char*)singleframe[ireadout],slsdatabytes);
} }
} }
} }
@ -5378,8 +5378,9 @@ void multiSlsDetector::readFrameFromReceiver(){
if ((fdata) && (dataReady)){ if ((fdata) && (dataReady)){
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentFileName.c_str(),nx,ny); thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentFileName.c_str(),nx,ny);
dataReady(thisData, currentFrameIndex, currentSubFrameIndex, pCallbackArg); dataReady(thisData, currentFrameIndex, currentSubFrameIndex, pCallbackArg);
delete thisData;
fdata = NULL; fdata = NULL;
cout<<"Send frame #"<< currentFrameIndex << " to gui"<<endl; //cout<<"Send frame #"<< currentFrameIndex << " to gui"<<endl;
} }
setCurrentProgress(currentAcquisitionIndex+1); setCurrentProgress(currentAcquisitionIndex+1);
} }

View File

@ -5545,6 +5545,7 @@ char* slsDetector::setReceiver(string receiverIP){
cprintf(RED,"Acquisition already running, Stopping it.\n"); cprintf(RED,"Acquisition already running, Stopping it.\n");
stopAcquisition(); stopAcquisition();
} }
updateDetector();
strcpy(thisDetector->receiver_hostname,receiverIP.c_str()); strcpy(thisDetector->receiver_hostname,receiverIP.c_str());