mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
fixing the 32 bit crash and empty plot using zmq
This commit is contained in:
@ -91,7 +91,8 @@ u_int32_t progressMask=0;
|
|||||||
int phase_shift=0;//DEFAULT_PHASE_SHIFT;
|
int phase_shift=0;//DEFAULT_PHASE_SHIFT;
|
||||||
int ipPacketSize=DEFAULT_IP_PACKETSIZE;
|
int ipPacketSize=DEFAULT_IP_PACKETSIZE;
|
||||||
int udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
int udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
||||||
int clockdivider = 40;
|
int clockdivider_exptime = 40;
|
||||||
|
int clockdivider_fc = 20;
|
||||||
/*
|
/*
|
||||||
#ifndef NEW_PLL_RECONFIG
|
#ifndef NEW_PLL_RECONFIG
|
||||||
u_int32_t clkDivider[2]={32,16};
|
u_int32_t clkDivider[2]={32,16};
|
||||||
@ -496,7 +497,7 @@ void configurePll(int i) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (i<2) {
|
if (i<2) {
|
||||||
tot= PLL_VCO_FREQ_MHZ/clockdivider; /* check if it always reads clock */
|
tot= PLL_VCO_FREQ_MHZ/clockdivider_fc; /* which clock divider?????? Is it called? clean up!! */
|
||||||
l=tot/2;
|
l=tot/2;
|
||||||
h=l;
|
h=l;
|
||||||
if (tot>2*l) {
|
if (tot>2*l) {
|
||||||
@ -1192,15 +1193,15 @@ int64_t getFrames(){
|
|||||||
int64_t setExposureTime(int64_t value){
|
int64_t setExposureTime(int64_t value){
|
||||||
if (value!=-1){
|
if (value!=-1){
|
||||||
printf("\nSetting exptime to %lldns\n",(long long int)value);
|
printf("\nSetting exptime to %lldns\n",(long long int)value);
|
||||||
value*=(1E-3*clockdivider);
|
value*=(1E-3*clockdivider_exptime);
|
||||||
}
|
}
|
||||||
int64_t retval = set64BitReg(value,SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ);
|
int64_t retval = set64BitReg(value,SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG)/(1E-3*clockdivider_exptime);//(1E-9*CLK_FREQ);
|
||||||
printf("Getting exptime: %lldns\n",(long long int)retval);
|
printf("Getting exptime: %lldns\n",(long long int)retval);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getExposureTime(){
|
int64_t getExposureTime(){
|
||||||
return get64BitReg(GET_EXPTIME_LSB_REG, GET_EXPTIME_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ);
|
return get64BitReg(GET_EXPTIME_LSB_REG, GET_EXPTIME_MSB_REG)/(1E-3*clockdivider_exptime);//(1E-9*CLK_FREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setGates(int64_t value){
|
int64_t setGates(int64_t value){
|
||||||
@ -1219,31 +1220,31 @@ int64_t getGates(){
|
|||||||
int64_t setPeriod(int64_t value){
|
int64_t setPeriod(int64_t value){
|
||||||
if (value!=-1){
|
if (value!=-1){
|
||||||
printf("\nSetting period to %lldns\n",(long long int)value);
|
printf("\nSetting period to %lldns\n",(long long int)value);
|
||||||
value*=(1E-3*clockdivider);
|
value*=(1E-3*clockdivider_fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t retval = set64BitReg(value,SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ);
|
int64_t retval = set64BitReg(value,SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/(1E-3*clockdivider_fc);//(1E-9*CLK_FREQ);
|
||||||
printf("Getting period: %lldns\n",(long long int)retval);
|
printf("Getting period: %lldns\n",(long long int)retval);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getPeriod(){
|
int64_t getPeriod(){
|
||||||
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ);
|
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG)/(1E-3*clockdivider_fc);//(1E-9*CLK_FREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setDelay(int64_t value){
|
int64_t setDelay(int64_t value){
|
||||||
if (value!=-1){
|
if (value!=-1){
|
||||||
printf("\nSetting delay to %lldns\n",(long long int)value);
|
printf("\nSetting delay to %lldns\n",(long long int)value);
|
||||||
value*=(1E-3*clockdivider);
|
value*=(1E-3*clockdivider_fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t retval = set64BitReg(value,SET_DELAY_LSB_REG, SET_DELAY_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ);
|
int64_t retval = set64BitReg(value,SET_DELAY_LSB_REG, SET_DELAY_MSB_REG)/(1E-3*clockdivider_fc);//(1E-9*CLK_FREQ);
|
||||||
printf("Getting delay: %lldns\n",(long long int)retval);
|
printf("Getting delay: %lldns\n",(long long int)retval);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getDelay(){
|
int64_t getDelay(){
|
||||||
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ);
|
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG)/(1E-3*clockdivider_fc);//(1E-9*CLK_FREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setTrains(int64_t value){
|
int64_t setTrains(int64_t value){
|
||||||
|
Binary file not shown.
@ -2266,6 +2266,7 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return dataout;
|
return dataout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5246,11 +5247,6 @@ void multiSlsDetector::startReceivingDataThread(){
|
|||||||
memcpy((char*)(singleframe[ithread]),(char*)zmq_msg_data(&message),singleDatabytes/numReadoutPerDetector);
|
memcpy((char*)(singleframe[ithread]),(char*)zmq_msg_data(&message),singleDatabytes/numReadoutPerDetector);
|
||||||
//cprintf(GREEN,"%d copied data %d\n",ithread,singleDatabytes/numReadoutPerDetector);
|
//cprintf(GREEN,"%d copied data %d\n",ithread,singleDatabytes/numReadoutPerDetector);
|
||||||
|
|
||||||
if(!ithread){
|
|
||||||
for(int i=0;i<30;i++)
|
|
||||||
cprintf(BLUE,"value[%d]:%d\n",i,(short int)singleframe[ithread][i]);
|
|
||||||
|
|
||||||
}
|
|
||||||
//jungfrau masking adcval
|
//jungfrau masking adcval
|
||||||
if(jungfrau){
|
if(jungfrau){
|
||||||
for(unsigned int i=0;i<nel;i++){
|
for(unsigned int i=0;i<nel;i++){
|
||||||
@ -5353,6 +5349,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
|
|
||||||
//assemble data
|
//assemble data
|
||||||
if(maxX){
|
if(maxX){
|
||||||
|
|
||||||
//eiger, so interleaving between ports in one readout itself
|
//eiger, so interleaving between ports in one readout itself
|
||||||
offsetY = (maxY - (thisMultiDetector->offsetY[idet] + slsmaxY)) * maxX * bytesperchannel;
|
offsetY = (maxY - (thisMultiDetector->offsetY[idet] + slsmaxY)) * maxX * bytesperchannel;
|
||||||
//the left half or right half
|
//the left half or right half
|
||||||
@ -5361,19 +5358,12 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
else
|
else
|
||||||
offsetX = thisMultiDetector->offsetX[idet] + halfreadoutoffset;
|
offsetX = thisMultiDetector->offsetX[idet] + halfreadoutoffset;
|
||||||
offsetX *= bytesperchannel;
|
offsetX *= bytesperchannel;
|
||||||
//cprintf(BLUE,"ireadout:%d, offsetx:%d offsety:%d maxx:%d slsmaxX:%d slsmaxY:%d bytesperchannel:%d\n",
|
|
||||||
// ireadout, offsetX,offsetY,maxX,slsmaxX,slsmaxY,bytesperchannel);
|
|
||||||
// cprintf(BLUE,"copying bytes:%d\n", (slsmaxX/numReadoutPerDetector)*bytesperchannel);
|
|
||||||
|
|
||||||
//interleaving with other detectors
|
//interleaving with other detectors
|
||||||
|
|
||||||
//bottom
|
//bottom
|
||||||
if(((idet+1)%2) == 0){
|
if(((idet+1)%2) == 0){
|
||||||
for(int i=0;i<slsmaxY;++i){
|
for(int i=0;i<slsmaxY;++i){
|
||||||
// cprintf(BLUE,"%d i:%d gonna copy sourceoffset:%d destoffset:%d\n",ireadout,i,
|
memcpy(((char*)multiframe) + offsetY + offsetX + ((slsmaxY-1-i)*maxX*bytesperchannel),
|
||||||
// i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
|
||||||
// offsetY + offsetX +((slsmaxY-i)*maxX*bytesperchannel));
|
|
||||||
memcpy(((char*)multiframe) + offsetY + offsetX + ((slsmaxY-i)*maxX*bytesperchannel),
|
|
||||||
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
||||||
(slsmaxX/numReadoutPerDetector)*bytesperchannel);
|
(slsmaxX/numReadoutPerDetector)*bytesperchannel);
|
||||||
}
|
}
|
||||||
@ -5381,10 +5371,6 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
//top
|
//top
|
||||||
else{
|
else{
|
||||||
for(int i=0;i<slsmaxY;++i){
|
for(int i=0;i<slsmaxY;++i){
|
||||||
//cprintf(BLUE,"%d i:%d gonna copy sourceoffset:%d destoffset:%d \n",ireadout,i,
|
|
||||||
// i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
|
||||||
// offsetY + offsetX + (i*maxX*bytesperchannel));
|
|
||||||
|
|
||||||
memcpy(((char*)multiframe) + offsetY + offsetX + (i*maxX*bytesperchannel),
|
memcpy(((char*)multiframe) + offsetY + offsetX + (i*maxX*bytesperchannel),
|
||||||
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
||||||
(slsmaxX/numReadoutPerDetector)*bytesperchannel);
|
(slsmaxX/numReadoutPerDetector)*bytesperchannel);
|
||||||
@ -5403,9 +5389,10 @@ void multiSlsDetector::readFrameFromReceiver(){
|
|||||||
if(!dataThreadMask)
|
if(!dataThreadMask)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
//send data to callback
|
//send data to callback
|
||||||
fdata = decodeData(multiframe);
|
fdata = decodeData(multiframe);
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
|
@ -4940,7 +4940,7 @@ double* slsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ichan=0; ichan<nch; ichan++) {
|
for (ichan=0; ichan<nch; ichan++) {
|
||||||
dataout[ichan]=ival;
|
dataout[ichan]=datain[ichan];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4955,7 +4955,6 @@ double* slsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
std::cout<< "decoded "<< ichan << " channels" << std::endl;
|
std::cout<< "decoded "<< ichan << " channels" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
return dataout;
|
return dataout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user