mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-30 18:00:05 +02:00
fixed
This commit is contained in:
parent
1cfebf667b
commit
4fe520fdaf
@ -1783,7 +1783,7 @@ int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
|
||||
}
|
||||
|
||||
int ClientInterface::get_bunch_size(Interface &socket) {
|
||||
int retval = impl()->getBunchSize();
|
||||
int retval = static_cast<int>(impl()->getBunchSize());
|
||||
LOG(logDEBUG1) << "bunch size retval:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
@ -1796,7 +1796,7 @@ int ClientInterface::set_bunch_size(Interface &socket) {
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting bunch size:" << value;
|
||||
try {
|
||||
impl()->setBunchSize(value);
|
||||
impl()->setBunchSize(static_cast<size_t>(value));
|
||||
} catch (const RuntimeError &e) {
|
||||
throw RuntimeError("Could not set rx bunch size due to fifo structure memory allocation.");
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ void DataProcessor::SetReceiverROI(ROI roi) {
|
||||
receiverRoiEnabled_ = receiverRoi_.completeRoi() ? false : true;
|
||||
}
|
||||
|
||||
void DataProcessor::SetBunchSize(uint32_t value) {
|
||||
void DataProcessor::SetBunchSize(size_t value) {
|
||||
fifoBunchSize = value;
|
||||
}
|
||||
|
||||
@ -267,7 +267,8 @@ void DataProcessor::ThreadExecution() {
|
||||
<< static_cast<void *>(buffer) << std::dec;
|
||||
|
||||
char* tempBuffer = buffer;
|
||||
for (uint32_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
LOG(logDEBUG1) << "iFrame:" << iFrame;
|
||||
|
||||
// end of acquisition (check dummy)
|
||||
auto numBytes = *reinterpret_cast<uint32_t *>(tempBuffer);
|
||||
@ -295,19 +296,26 @@ void DataProcessor::ThreadExecution() {
|
||||
memcpy(buffer + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
||||
}
|
||||
fifo_->PushAddressToStream(buffer);
|
||||
LOG(logINFORED) << "push to stream!??";
|
||||
|
||||
} else {
|
||||
fifo_->FreeAddress(buffer);
|
||||
LOG(logDEBUG1) << "Pushed (free) dataprocessing bunch (EOA) " << std::hex << static_cast<void *>(buffer) << std::dec;
|
||||
}
|
||||
}
|
||||
|
||||
void DataProcessor::StopProcessing(char *buf) {
|
||||
LOG(logINFORED) << "DataProcessing " << index << ": Dummy";
|
||||
LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy";
|
||||
|
||||
// stream dummy or free
|
||||
if (*dataStreamEnable_)
|
||||
if (*dataStreamEnable_) {
|
||||
LOG(logINFORED) << "push to stream!??";
|
||||
fifo_->PushAddressToStream(buf);
|
||||
else
|
||||
}
|
||||
else {
|
||||
fifo_->FreeAddress(buf);
|
||||
LOG(logDEBUG1) << "Pushed (free) stop proc dataprocessing bunch (EOA) " << std::hex << static_cast<void *>(buf) << std::dec;
|
||||
}
|
||||
|
||||
CloseFiles();
|
||||
StopRunning();
|
||||
|
@ -44,7 +44,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetReceiverROI(ROI roi);
|
||||
void ResetParametersforNewAcquisition();
|
||||
void SetGeneralData(GeneralData *generalData);
|
||||
void SetBunchSize(uint32_t value);
|
||||
void SetBunchSize(size_t value);
|
||||
|
||||
void CloseFiles();
|
||||
void DeleteFiles();
|
||||
@ -187,9 +187,9 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
|
||||
File *dataFile_{nullptr};
|
||||
|
||||
uint32_t fifoBunchSize{0};
|
||||
size_t fifoBunchSize{0};
|
||||
/** size in memory including headers */
|
||||
uint32_t fifoBunchSizeBytes{0};
|
||||
size_t fifoBunchSizeBytes{0};
|
||||
|
||||
// call back
|
||||
/**
|
||||
|
@ -81,7 +81,7 @@ void DataStreamer::SetAdditionalJsonHeader(
|
||||
isAdditionalJsonUpdated = true;
|
||||
}
|
||||
|
||||
void DataStreamer::SetBunchSize(uint32_t value) {
|
||||
void DataStreamer::SetBunchSize(size_t value) {
|
||||
fifoBunchSize = value;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ void DataStreamer::ThreadExecution() {
|
||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
char* tempBuffer = buffer;
|
||||
for (uint32_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
|
||||
// end of acquisition (check dummy)
|
||||
auto numBytes = *reinterpret_cast<uint32_t *>(tempBuffer);
|
||||
|
@ -56,7 +56,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetFlipRows(bool fd);
|
||||
void
|
||||
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||
void SetBunchSize(uint32_t value);
|
||||
void SetBunchSize(size_t value);
|
||||
|
||||
/**
|
||||
* Creates Zmq Sockets
|
||||
@ -137,9 +137,9 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
bool *quadEnable;
|
||||
uint64_t *totalNumFrames;
|
||||
|
||||
uint32_t fifoBunchSize{0};
|
||||
size_t fifoBunchSize{0};
|
||||
/** size in memory including headers */
|
||||
uint32_t fifoBunchSizeBytes{0};
|
||||
size_t fifoBunchSizeBytes{0};
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
|
@ -455,9 +455,9 @@ void Implementation::setReceiverROIMetadata(const ROI arg) {
|
||||
LOG(logINFO) << "receiver roi Metadata: " << ToString(receiverRoiMetadata);
|
||||
}
|
||||
|
||||
uint32_t Implementation::getBunchSize() const { return bunchSize; }
|
||||
size_t Implementation::getBunchSize() const { return bunchSize; }
|
||||
|
||||
void Implementation::setBunchSize(const uint32_t i) {
|
||||
void Implementation::setBunchSize(const size_t i) {
|
||||
if (bunchSize != i) {
|
||||
bunchSize = i;
|
||||
for (const auto &it : listener)
|
||||
|
@ -59,8 +59,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
ROI getReceiverROI() const;
|
||||
void setReceiverROI(const ROI arg);
|
||||
void setReceiverROIMetadata(const ROI arg);
|
||||
uint32_t getBunchSize() const;
|
||||
void setBunchSize(const uint32_t i);
|
||||
size_t getBunchSize() const;
|
||||
void setBunchSize(const size_t i);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
@ -313,7 +313,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
std::array<ROI, 2> portRois{};
|
||||
// receiver roi for complete detector for metadata
|
||||
ROI receiverRoiMetadata{};
|
||||
uint32_t bunchSize{0};
|
||||
size_t bunchSize{0};
|
||||
|
||||
// file parameters
|
||||
fileFormat fileFormatType{BINARY};
|
||||
|
@ -126,7 +126,7 @@ void Listener::SetGeneralData(GeneralData *g) { generalData = g; }
|
||||
|
||||
void Listener::SetActivate(bool enable) { activated = enable; }
|
||||
|
||||
void Listener::SetBunchSize(uint32_t value) {
|
||||
void Listener::SetBunchSize(size_t value) {
|
||||
fifoBunchSize = value;
|
||||
}
|
||||
|
||||
@ -232,47 +232,51 @@ void Listener::SetHardCodedPosition(uint16_t r, uint16_t c) {
|
||||
void Listener::ThreadExecution() {
|
||||
char *buffer;
|
||||
fifo->GetNewAddress(buffer);
|
||||
LOG(logDEBUG5) << "Listener " << index
|
||||
LOG(logDEBUG1) << "Listener " << index
|
||||
<< ", "
|
||||
"pop 0x"
|
||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
// get data
|
||||
char* tempBuffer = buffer;
|
||||
for (uint32_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
|
||||
// end of acquisition or not activated
|
||||
if ((*status == TRANSMITTING || !udpSocketAlive) && !carryOverFlag) {
|
||||
(*((uint32_t *)tempBuffer)) = DUMMY_PACKET_VALUE;
|
||||
LOG(logDEBUG1) << iFrame << ": dummy=" << DUMMY_PACKET_VALUE;
|
||||
StopListening(buffer);
|
||||
return;
|
||||
}
|
||||
LOG(logDEBUG) << "iframe:" << iFrame << " currentframeindex:" << currentFrameIndex;
|
||||
LOG(logDEBUG1) << "iframe:" << iFrame << " currentframeindex:" << currentFrameIndex;
|
||||
int rc = ListenToAnImage(tempBuffer);
|
||||
|
||||
// socket closed or discarding image (free retake)
|
||||
// weird frame numbers (print and rc = 0), then retake
|
||||
if (rc <= 0) {
|
||||
if (udpSocketAlive) {
|
||||
LOG(logDEBUG1) << iFrame << ": rc<=0" << std::hex << static_cast<void *>(tempBuffer) << std::dec;
|
||||
--iFrame;
|
||||
}
|
||||
} else {
|
||||
(*((uint32_t *)tempBuffer)) = rc;
|
||||
LOG(logDEBUG1) << iFrame << ": rc=" << rc << " addr:" << std::hex << static_cast<void *>(tempBuffer) << std::dec;
|
||||
tempBuffer += fifoBunchSizeBytes;
|
||||
}
|
||||
}
|
||||
|
||||
// last check
|
||||
if ((*status != TRANSMITTING || !udpSocketAlive) && !carryOverFlag) {
|
||||
/* if ((*status != TRANSMITTING || !udpSocketAlive) && !carryOverFlag) {
|
||||
LOG(logINFOBLUE) << "Last check " << std::hex << static_cast<void *>(tempBuffer) << std::dec;
|
||||
(*((uint32_t *)tempBuffer)) = DUMMY_PACKET_VALUE;
|
||||
LOG(logINFOBLUE) << ": dummy=" << DUMMY_PACKET_VALUE;
|
||||
StopListening(buffer);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
// push into fifo
|
||||
fifo->PushAddress(buffer);
|
||||
LOG(logINFOBLUE) << "Pushed Listening bunch " << (void*)(buffer);
|
||||
LOG(logDEBUG1) << "Pushed Listening bunch " << std::hex << static_cast<void *>(tempBuffer) << std::dec;
|
||||
|
||||
// Statistics
|
||||
if (!(*silentMode)) {
|
||||
@ -287,7 +291,7 @@ void Listener::ThreadExecution() {
|
||||
|
||||
void Listener::StopListening(char *buf) {
|
||||
fifo->PushAddress(buf);
|
||||
LOG(logINFOBLUE) << "Pushed Listening bunch (EOA) " << (void*)(buf);
|
||||
LOG(logDEBUG1) << "Pushed Listening bunch (EOA) " << std::hex << static_cast<void *>(buf) << std::dec;
|
||||
StopRunning();
|
||||
LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber
|
||||
<< ") : " << numPacketsCaught;
|
||||
|
@ -65,7 +65,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void ResetParametersforNewAcquisition();
|
||||
void SetGeneralData(GeneralData *g);
|
||||
void SetActivate(bool enable);
|
||||
void SetBunchSize(uint32_t value);
|
||||
void SetBunchSize(size_t value);
|
||||
|
||||
void CreateUDPSockets();
|
||||
void ShutDownUDPSocket();
|
||||
@ -167,9 +167,9 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
std::unique_ptr<char[]> listeningPacket;
|
||||
std::atomic<bool> udpSocketAlive{false};
|
||||
|
||||
uint32_t fifoBunchSize{0};
|
||||
size_t fifoBunchSize{0};
|
||||
/** size in memory including headers */
|
||||
uint32_t fifoBunchSizeBytes{0};
|
||||
size_t fifoBunchSizeBytes{0};
|
||||
|
||||
// for print progress during acquisition*/
|
||||
uint32_t numPacketsStatistic{0};
|
||||
|
@ -37,10 +37,8 @@ namespace sls {
|
||||
#define FILE_BUFFER_SIZE (16 * 1024 * 1024) // 16mb
|
||||
|
||||
// fifo
|
||||
#define FIFO_HEADER_NUMBYTES (8)
|
||||
#define FIFO_HEADER_NUMBYTES (16)
|
||||
#define FIFO_DATASIZE_NUMBYTES (4)
|
||||
#define FIFO_PADDING_NUMBYTES \
|
||||
(4) // for 8 byte alignment due to sls_receiver_header structure
|
||||
|
||||
// hdf5
|
||||
#define MAX_CHUNKED_IMAGES (1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user