client: update roi on updatedetector, (ctb, moench)moved nchans and databyte calculated to updatenumberofchannels and called for any update in roi, readoutflag or #samples changed (get should not update). ctb,moench server: roi fixed, . gotthard server: bug fix waiting to finish, ad9252 spi call fix. receiver: updated for moench and 10g

This commit is contained in:
2019-03-06 17:25:18 +01:00
parent 0765b330f1
commit ca817c6ae9
14 changed files with 193 additions and 100 deletions

View File

@ -213,7 +213,7 @@ public:
* @param s number of samples
* @param t tengiga enable
*/
virtual void setImageSize(std::vector<slsDetectorDefs::ROI> i, int s, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
virtual void setImageSize(std::vector<slsDetectorDefs::ROI> r, int s, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
cprintf(RED,"setImageSize is a generic function that should be overloaded by a derived class\n");
};
@ -555,15 +555,18 @@ public:
* @param s number of samples
* @param t tengiga enable
*/
void setImageSize(std::vector<slsDetectorDefs::ROI> i, int s, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
void setImageSize(std::vector<slsDetectorDefs::ROI> r, int s, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
int nchans = 0;
if (f != slsDetectorDefs::GET_READOUT_FLAGS) {
// analog channels
if (f == slsDetectorDefs::NORMAL_READOUT || f & slsDetectorDefs::ANALOG_AND_DIGITAL) {
nchans += NCHAN_ANALOG;
// if roi
if (i.size()) {
nchans = abs(i[0].xmax - i[0].xmin);
if (r.size()) {
nchans = 0;
for (auto &roi : r) {
nchans += (roi.xmax - roi.xmin + 1);
}
}
}
// digital channels
@ -575,18 +578,20 @@ public:
nPixelsY = s;
// 10G
if (t) {
// fixed values
dataSize = 0; // FIXME: fix when firmware written
packetSize = headerSizeinPacket + dataSize;
packetsPerFrame = 0; // FIXME: fix when firmware written
imageSize = dataSize*packetsPerFrame; // FIXME: OR fix when firmware written
}
headerSizeinPacket = 22;
dataSize = 8192;
packetSize = headerSizeinPacket + dataSize;
imageSize = nPixelsX * nPixelsY * 2;
packetsPerFrame = ceil((double)imageSize / (double)packetSize);
standardheader = false; }
// 1g udp (via fifo readout)
else {
dataSize = UDP_PACKET_DATA_BYTES;
packetSize = headerSizeinPacket + dataSize;
imageSize = nchans * NUM_BYTES_PER_PIXEL * s;
packetsPerFrame = ceil((double)imageSize / (double)UDP_PACKET_DATA_BYTES);
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
dataSize = UDP_PACKET_DATA_BYTES;
packetSize = headerSizeinPacket + dataSize;
imageSize = nPixelsX * nPixelsY * 2;
packetsPerFrame = ceil((double)imageSize / (double)UDP_PACKET_DATA_BYTES);
standardheader = true;
}
}
@ -658,12 +663,15 @@ private:
* @param s number of samples
* @param t tengiga enable
*/
void setImageSize(std::vector<slsDetectorDefs::ROI> i, int s, bool t,
void setImageSize(std::vector<slsDetectorDefs::ROI> r, int s, bool t,
slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
int nchans = NCHAN_ANALOG;
// if roi
if (i.size()) {
nchans = abs(i[0].xmax - i[0].xmin);
if (r.size()) {
nchans = 0;
for (auto &roi : r) {
nchans += abs(roi.xmax - roi.xmin) + 1;
}
}
nPixelsX = nchans;

View File

@ -480,6 +480,9 @@ int slsReceiverImplementation::setReadOutFlags(const readOutFlags f) {
flag.append("nooverflow ");
FILE_LOG(logINFO) << "ReadoutFlags: " << flag;
if (myDetectorType == CHIPTESTBOARD) {
FILE_LOG (logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
}
return OK;
}
@ -672,6 +675,7 @@ int slsReceiverImplementation::setROI(const std::vector<slsDetectorDefs::ROI> i)
}
std::string message = sstm.str();
FILE_LOG(logINFO) << message;
FILE_LOG (logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
return OK;
}
@ -844,6 +848,7 @@ int slsReceiverImplementation::setTenGigaEnable(const bool b) {
return FAIL;
}
FILE_LOG(logINFO) << "Ten Giga: " << stringEnable(tengigaEnable);
FILE_LOG (logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
return OK;
}