mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
rxr: frame number should be forwarded to caught frame number for discard partial frames or discardemptyframe mode, currentframeindex command should point to listener current frame index and not dataprocessors index
This commit is contained in:
parent
ef8de7b2be
commit
5f40e32924
@ -844,7 +844,7 @@ int ClientInterface::get_file_index(Interface &socket) {
|
||||
}
|
||||
|
||||
int ClientInterface::get_frame_index(Interface &socket) {
|
||||
uint64_t retval = impl()->getAcquisitionIndex();
|
||||
uint64_t retval = impl()->getCurrentFrameIndex();
|
||||
LOG(logDEBUG1) << "frame index:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
@ -447,18 +447,18 @@ uint64_t Implementation::getFramesCaught() const {
|
||||
return min;
|
||||
}
|
||||
|
||||
uint64_t Implementation::getAcquisitionIndex() const {
|
||||
uint64_t min = -1;
|
||||
uint64_t Implementation::getCurrentFrameIndex() const {
|
||||
uint64_t max = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (const auto &it : dataProcessor) {
|
||||
for (const auto &it : listener) {
|
||||
flagsum += it->GetStartedFlag();
|
||||
min = std::min(min, it->GetCurrentFrameIndex());
|
||||
max = std::max(max, it->GetCurrentFrameIndex());
|
||||
}
|
||||
// no data processed
|
||||
if (flagsum != dataProcessor.size())
|
||||
if (flagsum != listener.size())
|
||||
return 0;
|
||||
return min;
|
||||
return max;
|
||||
}
|
||||
|
||||
double Implementation::getProgress() const {
|
||||
|
@ -83,7 +83,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
* ************************************************/
|
||||
runStatus getStatus() const;
|
||||
uint64_t getFramesCaught() const;
|
||||
uint64_t getAcquisitionIndex() const;
|
||||
uint64_t getCurrentFrameIndex() const;
|
||||
double getProgress() const;
|
||||
std::vector<int64_t> getNumMissingPackets() const;
|
||||
void setScan(slsDetectorDefs::scanParameters s);
|
||||
|
@ -53,6 +53,10 @@ int64_t Listener::GetNumMissingPacket(bool stoppedFlag,
|
||||
numPacketsCaught;
|
||||
}
|
||||
|
||||
bool Listener::GetStartedFlag() { return startedFlag; }
|
||||
|
||||
uint64_t Listener::GetCurrentFrameIndex() { return currentFrameIndex; }
|
||||
|
||||
void Listener::SetFifo(Fifo *f) { fifo = f; }
|
||||
|
||||
void Listener::ResetParametersforNewAcquisition() {
|
||||
@ -232,16 +236,11 @@ void Listener::ThreadExecution() {
|
||||
|
||||
// discarding image
|
||||
else if (rc < 0) {
|
||||
LOG(logDEBUG) << index << " discarding fnum:" << currentFrameIndex;
|
||||
fifo->FreeAddress(buffer);
|
||||
currentFrameIndex++;
|
||||
return;
|
||||
}
|
||||
|
||||
(*((uint32_t *)buffer)) = rc;
|
||||
(*((uint64_t *)(buffer + FIFO_HEADER_NUMBYTES))) =
|
||||
currentFrameIndex; // for those returning earlier
|
||||
currentFrameIndex++;
|
||||
|
||||
// push into fifo
|
||||
fifo->PushAddress(buffer);
|
||||
@ -334,10 +333,17 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
}
|
||||
switch (*frameDiscardMode) {
|
||||
case DISCARD_EMPTY_FRAMES:
|
||||
if (!numpackets)
|
||||
if (!numpackets) {
|
||||
LOG(logDEBUG)
|
||||
<< index << " Skipped fnum:" << currentFrameIndex;
|
||||
currentFrameIndex = fnum;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case DISCARD_PARTIAL_FRAMES:
|
||||
LOG(logDEBUG)
|
||||
<< index << " discarding fnum:" << currentFrameIndex;
|
||||
currentFrameIndex = fnum;
|
||||
return -1;
|
||||
default:
|
||||
break;
|
||||
@ -347,6 +353,8 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
}
|
||||
new_header->detHeader.frameNumber = currentFrameIndex;
|
||||
++currentFrameIndex;
|
||||
return imageSize;
|
||||
}
|
||||
|
||||
@ -423,10 +431,16 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
|
||||
switch (*frameDiscardMode) {
|
||||
case DISCARD_EMPTY_FRAMES:
|
||||
if (!numpackets)
|
||||
if (!numpackets) {
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case DISCARD_PARTIAL_FRAMES:
|
||||
// empty packet now, but not empty image (EOA)
|
||||
if (numpackets) {
|
||||
LOG(logDEBUG)
|
||||
<< index << " discarding fnum:" << currentFrameIndex;
|
||||
}
|
||||
return -1;
|
||||
default:
|
||||
break;
|
||||
@ -437,7 +451,8 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
}
|
||||
return imageSize; // empty packet now, but not empty image
|
||||
new_header->detHeader.frameNumber = currentFrameIndex;
|
||||
return imageSize; // empty packet now, but not empty image (EOA)
|
||||
}
|
||||
|
||||
// update parameters
|
||||
@ -502,10 +517,17 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
|
||||
switch (*frameDiscardMode) {
|
||||
case DISCARD_EMPTY_FRAMES:
|
||||
if (!numpackets)
|
||||
if (!numpackets) {
|
||||
LOG(logDEBUG)
|
||||
<< index << " Skipped fnum:" << currentFrameIndex;
|
||||
currentFrameIndex = fnum;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case DISCARD_PARTIAL_FRAMES:
|
||||
LOG(logDEBUG)
|
||||
<< index << " discarding fnum:" << currentFrameIndex;
|
||||
currentFrameIndex = fnum;
|
||||
return -1;
|
||||
default:
|
||||
break;
|
||||
@ -516,6 +538,8 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
}
|
||||
new_header->detHeader.frameNumber = currentFrameIndex;
|
||||
++currentFrameIndex;
|
||||
return imageSize;
|
||||
}
|
||||
|
||||
@ -577,6 +601,8 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
|
||||
// complete image
|
||||
new_header->detHeader.packetNumber = numpackets; // number of packets caught
|
||||
new_header->detHeader.frameNumber = currentFrameIndex;
|
||||
++currentFrameIndex;
|
||||
return imageSize;
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,14 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
*/
|
||||
uint64_t GetLastFrameIndexCaught() const;
|
||||
|
||||
/** Get number of missing packets, returns negative values in case to extra packet */
|
||||
/** Get number of missing packets, returns negative values in case to extra
|
||||
* packet */
|
||||
int64_t GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) const;
|
||||
|
||||
bool GetStartedFlag();
|
||||
|
||||
uint64_t GetCurrentFrameIndex();
|
||||
|
||||
/**
|
||||
* Set Fifo pointer to the one given
|
||||
* @param f address of Fifo pointer
|
||||
|
Loading…
x
Reference in New Issue
Block a user