mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
gotthard server: possible fix for master and slave sync problem when configuring mac for different frames and sending dummy image, still problem of missing or extra 2 packets inslave or master not sending any frames sometimes, multi: possible fix of image reconstruction in x direction in gui
This commit is contained in:
parent
2f11681d3f
commit
3c2bbf6ad4
@ -2,4 +2,4 @@
|
|||||||
#define APIRECEIVER 0x180823
|
#define APIRECEIVER 0x180823
|
||||||
#define APIEIGER 0x181130
|
#define APIEIGER 0x181130
|
||||||
#define APIJUNGFRAU 0x190107
|
#define APIJUNGFRAU 0x190107
|
||||||
#define APIGOTTHARD 0x190130
|
#define APIGOTTHARD 0x190201
|
||||||
|
@ -887,7 +887,7 @@ int64_t get64BitReg(int aLSB, int aMSB){
|
|||||||
return v64;
|
return v64;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setFrames(int64_t value){
|
int64_t setFrames(int64_t value){printf("setting frames to %lld\n", (long long int)value);
|
||||||
return set64BitReg(value, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
return set64BitReg(value, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,7 +895,7 @@ int64_t getFrames(){
|
|||||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setExposureTime(int64_t value){
|
int64_t setExposureTime(int64_t value){printf("setting exptime to %lld ns\n", (long long int)value);
|
||||||
/* time is in ns */
|
/* time is in ns */
|
||||||
if (value!=-1) {
|
if (value!=-1) {
|
||||||
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
|
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
|
||||||
@ -909,7 +909,7 @@ int64_t getExposureTime(){
|
|||||||
(1E-3 * CLK_FREQ)) + 0.5;
|
(1E-3 * CLK_FREQ)) + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setGates(int64_t value){
|
int64_t setGates(int64_t value){printf("setting gates to %lld\n", (long long int)value);
|
||||||
return set64BitReg(value, SET_GATES_LSB_REG, SET_GATES_MSB_REG);
|
return set64BitReg(value, SET_GATES_LSB_REG, SET_GATES_MSB_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,7 +917,7 @@ int64_t getGates(){
|
|||||||
return get64BitReg(GET_GATES_LSB_REG, GET_GATES_MSB_REG);
|
return get64BitReg(GET_GATES_LSB_REG, GET_GATES_MSB_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setPeriod(int64_t value){
|
int64_t setPeriod(int64_t value){printf("setting period to %lld ns\n", (long long int)value);
|
||||||
/* time is in ns */
|
/* time is in ns */
|
||||||
if (value!=-1) {
|
if (value!=-1) {
|
||||||
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
|
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
|
||||||
@ -931,7 +931,7 @@ int64_t getPeriod(){
|
|||||||
(1E-3 * CLK_FREQ)) + 0.5;
|
(1E-3 * CLK_FREQ)) + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setDelay(int64_t value){
|
int64_t setDelay(int64_t value){printf("setting delay to %lld ns\n", (long long int)value);
|
||||||
/* time is in ns */
|
/* time is in ns */
|
||||||
if (value!=-1) {
|
if (value!=-1) {
|
||||||
if (masterflags == IS_MASTER) {
|
if (masterflags == IS_MASTER) {
|
||||||
@ -955,7 +955,7 @@ int64_t getDelay(){
|
|||||||
(1E-3 * CLK_FREQ)) + 0.5;
|
(1E-3 * CLK_FREQ)) + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setTrains(int64_t value){
|
int64_t setTrains(int64_t value){printf("setting cycles to %lld\n", (long long int)value);
|
||||||
return set64BitReg(value, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
return set64BitReg(value, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1449,20 +1449,34 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
|||||||
uint64_t oldExptime = setExposureTime(-1);
|
uint64_t oldExptime = setExposureTime(-1);
|
||||||
|
|
||||||
// set to basic parameters
|
// set to basic parameters
|
||||||
printf("Setting basic parameters\n");
|
cprintf(BLUE,"Setting basic parameters\n"
|
||||||
|
"\tTiming: auto, frames: 1, cycles: 1, period: 1s, exptime: 900ms\n");
|
||||||
setTiming(AUTO_TIMING);
|
setTiming(AUTO_TIMING);
|
||||||
setFrames(1);
|
setFrames(1);
|
||||||
setTrains(1);
|
setTrains(1);
|
||||||
setPeriod(1e6);
|
setPeriod(1e9); // important to keep this until we have to wait for acquisition to start
|
||||||
setExposureTime(1e5);
|
setExposureTime(900 * 1000);
|
||||||
|
|
||||||
// take an image
|
// take an image
|
||||||
|
if (masterflags == IS_MASTER)
|
||||||
|
usleep(1 * 1000 * 1000); // required to ensure master starts acquisition only after slave has changed to basic parameters and is waiting
|
||||||
|
|
||||||
|
int loop = 0;
|
||||||
startStateMachine();
|
startStateMachine();
|
||||||
|
// wait for acquisition to start (trigger from master)
|
||||||
|
printf(" Waiting for acquisition to start\n");
|
||||||
|
while(!runBusy()) {
|
||||||
|
usleep(0);
|
||||||
|
++loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
cprintf(MAGENTA, "waited %d loops to start\n", loop);
|
||||||
|
cprintf(BLUE, " Waiting for acquisition to end (frames left: %lld)\n", (long long int)getFrames());
|
||||||
waitForAcquisitionFinish();
|
waitForAcquisitionFinish();
|
||||||
|
|
||||||
// set to previous parameters
|
// set to previous parameters
|
||||||
printf("Setting previous parameters: "
|
cprintf(BLUE,"Setting previous parameters:\n"
|
||||||
"Timing: %d, "
|
"\tTiming: %d, "
|
||||||
"frames: %lld, "
|
"frames: %lld, "
|
||||||
"cycles: %lld, "
|
"cycles: %lld, "
|
||||||
"period: %lld ns, "
|
"period: %lld ns, "
|
||||||
@ -1484,6 +1498,7 @@ int getAdcConfigured(){
|
|||||||
|
|
||||||
u_int32_t runBusy(void) {
|
u_int32_t runBusy(void) {
|
||||||
u_int32_t s = bus_r(STATUS_REG) & RUN_BUSY_BIT;
|
u_int32_t s = bus_r(STATUS_REG) & RUN_BUSY_BIT;
|
||||||
|
//printf("runBusy: 0x%08x\n", s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1515,6 +1530,7 @@ int startStateMachine(){
|
|||||||
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cprintf(GREEN,"*******Starting State Machine*******\n");
|
cprintf(GREEN,"*******Starting State Machine*******\n");
|
||||||
|
cprintf(GREEN,"Number of frames to acquire:%lld\n", (long long int)setFrames(-1));
|
||||||
//#endif
|
//#endif
|
||||||
cleanFifo();
|
cleanFifo();
|
||||||
// fifoReset();
|
// fifoReset();
|
||||||
@ -1615,6 +1631,7 @@ void waitForAcquisitionFinish(){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t = bus_r(LOOK_AT_ME_REG);
|
t = bus_r(LOOK_AT_ME_REG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: 12f8166d257e14485cc37392689d03ed8ec6dbb9
|
Repsitory UUID: 2f11681d3f2bd2e437cd23fa28dc618dbbd39c68
|
||||||
Revision: 246
|
Revision: 247
|
||||||
Branch: 4.0.1-rc
|
Branch: 4.0.1-rc
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 4056
|
Last Changed Rev: 4057
|
||||||
Last Changed Date: 2019-01-30 18:21:07.000000002 +0100 ./firmware_funcs.c
|
Last Changed Date: 2019-02-01 11:47:52.000000002 +0100 ./firmware_funcs.c
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "12f8166d257e14485cc37392689d03ed8ec6dbb9"
|
#define GITREPUUID "2f11681d3f2bd2e437cd23fa28dc618dbbd39c68"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x4056
|
#define GITREV 0x4057
|
||||||
#define GITDATE 0x20190130
|
#define GITDATE 0x20190201
|
||||||
#define GITBRANCH "4.0.1-rc"
|
#define GITBRANCH "4.0.1-rc"
|
||||||
|
Binary file not shown.
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.4
Executable file
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.1.4
Executable file
Binary file not shown.
@ -1829,7 +1829,7 @@ int get_run_status(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
retval= runState();
|
retval= runState();
|
||||||
printf("\n\nSTATUS=%08x\n",retval);
|
printf("STATUS=%08x\n",retval);
|
||||||
|
|
||||||
|
|
||||||
//stopped (external stop, also maybe fifo full)
|
//stopped (external stop, also maybe fifo full)
|
||||||
@ -2046,9 +2046,9 @@ int set_timer(int file_des) {
|
|||||||
printf(mess);
|
printf(mess);
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("setting timer %d to %lld ns\n",ind,tns);
|
printf("setting timer %d to %lld ns\n",ind,tns);
|
||||||
//#endif
|
#endif
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
|
|
||||||
if (differentClients==1 && lockStatus==1 && tns!=-1) {
|
if (differentClients==1 && lockStatus==1 && tns!=-1) {
|
||||||
|
@ -1235,10 +1235,10 @@ void multiSlsDetector::setDetectorOffset(dimension d, int off, int pos) {
|
|||||||
|
|
||||||
void multiSlsDetector::updateOffsets() {
|
void multiSlsDetector::updateOffsets() {
|
||||||
//cannot paralllize due to slsdetector calling this via parentdet->
|
//cannot paralllize due to slsdetector calling this via parentdet->
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << endl
|
cout << endl
|
||||||
<< "Updating Multi-Detector Offsets" << endl;
|
<< "Updating Multi-Detector Offsets" << endl;
|
||||||
#endif
|
//#endif
|
||||||
int offsetX = 0, offsetY = 0, numX = 0, numY = 0, maxX = 0, maxY = 0;
|
int offsetX = 0, offsetY = 0, numX = 0, numY = 0, maxX = 0, maxY = 0;
|
||||||
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
int maxChanX = thisMultiDetector->maxNumberOfChannelsPerDetector[X];
|
||||||
int maxChanY = thisMultiDetector->maxNumberOfChannelsPerDetector[Y];
|
int maxChanY = thisMultiDetector->maxNumberOfChannelsPerDetector[Y];
|
||||||
@ -1298,9 +1298,9 @@ void multiSlsDetector::updateOffsets() {
|
|||||||
maxY_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(Y);
|
maxY_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(Y);
|
||||||
++thisMultiDetector->numberOfDetector[X];
|
++thisMultiDetector->numberOfDetector[X];
|
||||||
++thisMultiDetector->numberOfDetector[Y];
|
++thisMultiDetector->numberOfDetector[Y];
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "incrementing in both direction" << endl;
|
cout << "incrementing in both direction" << endl;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//incrementing in y direction
|
//incrementing in y direction
|
||||||
@ -1315,10 +1315,12 @@ void multiSlsDetector::updateOffsets() {
|
|||||||
numY_gp += detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
numY_gp += detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
||||||
maxY += detectors[idet]->getMaxNumberOfChannels(Y);
|
maxY += detectors[idet]->getMaxNumberOfChannels(Y);
|
||||||
maxY_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(Y);
|
maxY_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(Y);
|
||||||
|
// increment in y again only in the first column (else you double increment)
|
||||||
|
if (thisMultiDetector->numberOfDetector[X] == 1)
|
||||||
++thisMultiDetector->numberOfDetector[Y];
|
++thisMultiDetector->numberOfDetector[Y];
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "incrementing in y direction" << endl;
|
cout << "incrementing in y direction" << endl;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//incrementing in x direction
|
//incrementing in x direction
|
||||||
@ -1346,9 +1348,9 @@ void multiSlsDetector::updateOffsets() {
|
|||||||
maxX += detectors[idet]->getMaxNumberOfChannels(X);
|
maxX += detectors[idet]->getMaxNumberOfChannels(X);
|
||||||
maxX_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(X);
|
maxX_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(X);
|
||||||
++thisMultiDetector->numberOfDetector[X];
|
++thisMultiDetector->numberOfDetector[X];
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "incrementing in x direction" << endl;
|
cout << "incrementing in x direction" << endl;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
double bytesperchannel = (double)detectors[idet]->getDataBytes() /
|
double bytesperchannel = (double)detectors[idet]->getDataBytes() /
|
||||||
@ -1381,7 +1383,7 @@ void multiSlsDetector::updateOffsets() {
|
|||||||
if (maxY_gp > thisMultiDetector->maxNumberOfChannelInclGapPixels[Y])
|
if (maxY_gp > thisMultiDetector->maxNumberOfChannelInclGapPixels[Y])
|
||||||
thisMultiDetector->maxNumberOfChannelInclGapPixels[Y] = maxY_gp;
|
thisMultiDetector->maxNumberOfChannelInclGapPixels[Y] = maxY_gp;
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "Number of Channels in X direction:" << thisMultiDetector->numberOfChannel[X] << endl;
|
cout << "Number of Channels in X direction:" << thisMultiDetector->numberOfChannel[X] << endl;
|
||||||
cout << "Number of Channels in Y direction:" << thisMultiDetector->numberOfChannel[Y] << endl
|
cout << "Number of Channels in Y direction:" << thisMultiDetector->numberOfChannel[Y] << endl
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -1390,7 +1392,7 @@ void multiSlsDetector::updateOffsets() {
|
|||||||
cout << "Number of Channels in Y direction with Gap Pixels:" <<
|
cout << "Number of Channels in Y direction with Gap Pixels:" <<
|
||||||
thisMultiDetector->numberOfChannelInclGapPixels[Y] << endl
|
thisMultiDetector->numberOfChannelInclGapPixels[Y] << endl
|
||||||
<< endl;
|
<< endl;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5065,7 +5067,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
|||||||
nPixelsX = doc["shape"][0].GetUint();
|
nPixelsX = doc["shape"][0].GetUint();
|
||||||
nPixelsY = doc["shape"][1].GetUint();
|
nPixelsY = doc["shape"][1].GetUint();
|
||||||
|
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cprintf(BLUE, "(Debug) One Time Header Info:\n"
|
cprintf(BLUE, "(Debug) One Time Header Info:\n"
|
||||||
"size: %u\n"
|
"size: %u\n"
|
||||||
"multisize: %u\n"
|
"multisize: %u\n"
|
||||||
@ -5075,7 +5077,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
|||||||
"nPixelsY: %u\n",
|
"nPixelsY: %u\n",
|
||||||
size, multisize, dynamicRange, bytesPerPixel,
|
size, multisize, dynamicRange, bytesPerPixel,
|
||||||
nPixelsX, nPixelsY);
|
nPixelsX, nPixelsY);
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
// each time, parse rest of header
|
// each time, parse rest of header
|
||||||
currentFileName = doc["fname"].GetString();
|
currentFileName = doc["fname"].GetString();
|
||||||
@ -5084,12 +5086,12 @@ void multiSlsDetector::readFrameFromReceiver() {
|
|||||||
currentFileIndex = doc["fileIndex"].GetUint64();
|
currentFileIndex = doc["fileIndex"].GetUint64();
|
||||||
currentSubFrameIndex = doc["expLength"].GetUint();
|
currentSubFrameIndex = doc["expLength"].GetUint();
|
||||||
coordY = doc["row"].GetUint();
|
coordY = doc["row"].GetUint();
|
||||||
coordX = doc["column"].GetUint();
|
coordX = doc["column"].GetUint();cprintf(BLUE, "row:%d, col:%d,ny:%d\n", coordY, coordX, nY);
|
||||||
if (eiger)
|
if (eiger)
|
||||||
coordY = (nY - 1) - coordY;
|
coordY = (nY - 1) - coordY;
|
||||||
//cout << "X:" << doc["row"].GetUint() <<" Y:"<<doc["column"].GetUint();
|
//cout << "X:" << doc["row"].GetUint() <<" Y:"<<doc["column"].GetUint();
|
||||||
flippedDataX = doc["flippedDataX"].GetUint();
|
flippedDataX = doc["flippedDataX"].GetUint();
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cprintf(BLUE, "(Debug) Header Info:\n"
|
cprintf(BLUE, "(Debug) Header Info:\n"
|
||||||
"currentFileName: %s\n"
|
"currentFileName: %s\n"
|
||||||
"currentAcquisitionIndex: %lu\n"
|
"currentAcquisitionIndex: %lu\n"
|
||||||
@ -5103,7 +5105,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
|||||||
currentFrameIndex, currentFileIndex, currentSubFrameIndex,
|
currentFrameIndex, currentFileIndex, currentSubFrameIndex,
|
||||||
coordX, coordY,
|
coordX, coordY,
|
||||||
flippedDataX);
|
flippedDataX);
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// DATA
|
// DATA
|
||||||
@ -5116,14 +5118,14 @@ void multiSlsDetector::readFrameFromReceiver() {
|
|||||||
uint32_t yoffset = coordY * nPixelsY;
|
uint32_t yoffset = coordY * nPixelsY;
|
||||||
uint32_t singledetrowoffset = nPixelsX * bytesPerPixel;
|
uint32_t singledetrowoffset = nPixelsX * bytesPerPixel;
|
||||||
uint32_t rowoffset = nX * singledetrowoffset;
|
uint32_t rowoffset = nX * singledetrowoffset;
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cprintf(BLUE, "(Debug) Multi Image Info:\n"
|
cprintf(BLUE, "(Debug) Multi Image Info:\n"
|
||||||
"xoffset: %u\n"
|
"xoffset: %u\n"
|
||||||
"yoffset: %u\n"
|
"yoffset: %u\n"
|
||||||
"singledetrowoffset: %u\n"
|
"singledetrowoffset: %u\n"
|
||||||
"rowoffset: %u\n",
|
"rowoffset: %u\n",
|
||||||
xoffset, yoffset, singledetrowoffset, rowoffset);
|
xoffset, yoffset, singledetrowoffset, rowoffset);
|
||||||
#endif
|
//#endif
|
||||||
if (eiger && flippedDataX) {
|
if (eiger && flippedDataX) {
|
||||||
for (uint32_t i = 0; i < nPixelsY; ++i) {
|
for (uint32_t i = 0; i < nPixelsY; ++i) {
|
||||||
memcpy(((char*)multiframe) +
|
memcpy(((char*)multiframe) +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user