mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 09:08:00 +02:00
bug fix on quad: if no data streaming enabled in the beginning
This commit is contained in:
@ -16,7 +16,7 @@ const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
|
||||
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm, int* nd, bool* gpEnable) :
|
||||
uint64_t* fi, int fd, char* ajh, bool* sm, int* nd, bool* gpEnable) :
|
||||
ThreadObject(ind),
|
||||
runningFlag(0),
|
||||
generalData(0),
|
||||
@ -26,6 +26,7 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
roi(r),
|
||||
adcConfigured(-1),
|
||||
fileIndex(fi),
|
||||
flippedDataX(fd),
|
||||
additionJsonHeader(ajh),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
@ -34,8 +35,6 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
completeBuffer(0),
|
||||
gapPixelsEnable(gpEnable)
|
||||
{
|
||||
flippedData[0] = fd[0];
|
||||
flippedData[1] = fd[1];
|
||||
numDet[0] = nd[0];
|
||||
numDet[1] = nd[1];
|
||||
|
||||
@ -140,9 +139,8 @@ void DataStreamer::SetNumberofDetectors(int* nd) {
|
||||
numDet[1] = nd[1];
|
||||
}
|
||||
|
||||
void DataStreamer::SetFlippedData(int* fd) {
|
||||
flippedData[0] = fd[0];
|
||||
flippedData[1] = fd[1];
|
||||
void DataStreamer::SetFlippedDataX(int fd) {
|
||||
flippedDataX = fd;
|
||||
}
|
||||
|
||||
|
||||
@ -282,7 +280,7 @@ int DataStreamer::SendHeader(sls_receiver_header* rheader, uint32_t size, uint32
|
||||
header.modId, header.row, header.column, header.reserved,
|
||||
header.debug, header.roundRNumber,
|
||||
header.detType, header.version,
|
||||
*gapPixelsEnable ? 1 : 0, flippedData,
|
||||
*gapPixelsEnable ? 1 : 0, flippedDataX,
|
||||
additionJsonHeader
|
||||
);
|
||||
}
|
||||
|
@ -50,8 +50,7 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
dynamicRange = 16;
|
||||
tengigaEnable = false;
|
||||
fifoDepth = 0;
|
||||
flippedData[0] = 0;
|
||||
flippedData[1] = 0;
|
||||
flippedDataX = 0;
|
||||
gapPixelsEnable = false;
|
||||
quadEnable = false;
|
||||
|
||||
@ -129,8 +128,14 @@ char *UDPBaseImplementation::getDetectorHostname() const{
|
||||
|
||||
int UDPBaseImplementation::getFlippedData(int axis) const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
if(axis<0 || axis > 1) return -1;
|
||||
return flippedData[axis];
|
||||
switch(axis) {
|
||||
case 0:
|
||||
return flippedDataX;
|
||||
case 1:
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
bool UDPBaseImplementation::getGapPixelsEnable() const {
|
||||
@ -404,9 +409,10 @@ void UDPBaseImplementation::setMultiDetectorSize(const int* size) {
|
||||
|
||||
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
if (axis != 0)
|
||||
return;
|
||||
flippedDataX = enable==0?0:1;
|
||||
FILE_LOG(logINFO) << "Flipped Data X: " << flippedDataX;
|
||||
|
||||
// overridden
|
||||
}
|
||||
|
@ -125,38 +125,36 @@ void UDPStandardImplementation::setMultiDetectorSize(const int* size) {
|
||||
}
|
||||
strcat(message,")");
|
||||
|
||||
int sz[2] = {numDet[0], numDet[1]};
|
||||
int nd[2] = {numDet[0], numDet[1]};
|
||||
if (quadEnable) {
|
||||
sz[0] = 1;
|
||||
sz[1] = 2;
|
||||
nd[0] = 1;
|
||||
nd[1] = 2;
|
||||
}
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetNumberofDetectors(sz);
|
||||
(*it)->SetNumberofDetectors(nd);
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << message;
|
||||
}
|
||||
|
||||
void UDPStandardImplementation::setFlippedData(int axis, int enable){
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
if (axis != 0)
|
||||
return;
|
||||
flippedDataX = enable == 0 ? 0 : 1;
|
||||
|
||||
if (!quadEnable) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetFlippedData(flippedData);
|
||||
(*it)->SetFlippedDataX(flippedDataX);
|
||||
}
|
||||
}
|
||||
else {
|
||||
int fd[2] = {flippedData[0], flippedData[1]};
|
||||
if (dataStreamer.size() == 2) {
|
||||
fd[0] = 0;
|
||||
dataStreamer[0]->SetFlippedData(fd);
|
||||
fd[0] = 1;
|
||||
dataStreamer[1]->SetFlippedData(fd);
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
}
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
FILE_LOG(logINFO) << "Flipped Data X: " << flippedDataX;
|
||||
}
|
||||
|
||||
|
||||
@ -186,19 +184,16 @@ void UDPStandardImplementation::setQuad(const bool b) {
|
||||
if (!quadEnable) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetNumberofDetectors(numDet);
|
||||
(*it)->SetFlippedData(flippedData);
|
||||
(*it)->SetFlippedDataX(flippedDataX);
|
||||
}
|
||||
} else {
|
||||
int size[2] = {1, 2};
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetNumberofDetectors(size);
|
||||
}
|
||||
int fd[2] = {flippedData[0], flippedData[1]};
|
||||
if (dataStreamer.size() == 2) {
|
||||
fd[0] = 0;
|
||||
dataStreamer[0]->SetFlippedData(fd);
|
||||
fd[0] = 1;
|
||||
dataStreamer[1]->SetFlippedData(fd);
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,8 +321,15 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
if (enable) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
int fd = flippedDataX;
|
||||
int nd[2] = {numDet[0], numDet[1]};
|
||||
if (quadEnable) {
|
||||
fd = i;
|
||||
nd[0] = 1;
|
||||
nd[1] = 2;
|
||||
}
|
||||
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
|
||||
&roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode, (int*)numDet, &gapPixelsEnable);
|
||||
&roi, &fileIndex, fd, additionalJsonHeader, &silentMode, (int*)nd, &gapPixelsEnable);
|
||||
dataStreamer.push_back(s);
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
|
Reference in New Issue
Block a user