mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
sendToDetector
This commit is contained in:
parent
ec9f360c75
commit
8cc8b58b05
@ -105,7 +105,10 @@ endif()
|
||||
if(SLS_USE_SANITIZER)
|
||||
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
endif()
|
||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# Install fake the library
|
||||
|
@ -11,6 +11,8 @@ class MultiDetectorFixture {
|
||||
public:
|
||||
MultiDetectorFixture() : d(0, true, true) {
|
||||
d.setHostname(hostname.c_str());
|
||||
if (my_ip != "undefined")
|
||||
d.setReceiverHostname(my_ip);
|
||||
}
|
||||
~MultiDetectorFixture() { d.freeSharedMemory(); }
|
||||
};
|
||||
@ -108,7 +110,7 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Read/write register",
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Set dynamic range",
|
||||
"[.eigerintegration][cli]") {
|
||||
"[.eigerintegration][cli][dr]") {
|
||||
std::vector<int> dynamic_range{4, 8, 16, 32};
|
||||
for (auto dr : dynamic_range) {
|
||||
d.setDynamicRange(dr);
|
||||
@ -117,7 +119,7 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Set dynamic range",
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Set clock divider",
|
||||
"[.eigerintegration][cli]") {
|
||||
"[.eigerintegration][cli][this]") {
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
d.setSpeed(sv::CLOCK_DIVIDER, i);
|
||||
CHECK(d.setSpeed(sv::CLOCK_DIVIDER) == i);
|
||||
@ -164,12 +166,17 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Set readout flags",
|
||||
CHECK((d.setReadOutFlags() & defs::NONPARALLEL));
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Flow control 10gbe",
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "Flow control and tengiga",
|
||||
"[.eigerintegration][cli]") {
|
||||
d.setFlowControl10G(1);
|
||||
CHECK(d.setFlowControl10G() == 1);
|
||||
d.setFlowControl10G(0);
|
||||
CHECK(d.setFlowControl10G() == 0);
|
||||
|
||||
d.enableTenGigabitEthernet(1);
|
||||
CHECK(d.enableTenGigabitEthernet() == 1);
|
||||
d.enableTenGigabitEthernet(0);
|
||||
CHECK(d.enableTenGigabitEthernet() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "activate", "[.eigerintegration][cli]") {
|
||||
@ -179,9 +186,14 @@ TEST_CASE_METHOD(MultiDetectorFixture, "activate", "[.eigerintegration][cli]") {
|
||||
CHECK(d.activate() == 1);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "all trimbits", "[.eigerintegration][cli]") {
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "all trimbits",
|
||||
"[.eigerintegration][cli]") {
|
||||
d.setAllTrimbits(32);
|
||||
CHECK(d.setAllTrimbits(-1) == 32);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(MultiDetectorFixture, "rate correction",
|
||||
"[.eigerintegration][cli]") {
|
||||
d.setRateCorrection(200);
|
||||
CHECK(d.getRateCorrection() == 200);
|
||||
}
|
||||
|
@ -1697,7 +1697,7 @@ int slsDetector::setDynamicRange(int n) {
|
||||
|
||||
int olddr = detector_shm()->dynamicRange;
|
||||
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
||||
sendToDetector(fnum, &n, sizeof(n), &retval, sizeof(retval));
|
||||
ret = sendToDetector(fnum, &n, sizeof(n), &retval, sizeof(retval));
|
||||
FILE_LOG(logDEBUG1) << "Dynamic Range: " << retval;
|
||||
detector_shm()->dynamicRange = retval;
|
||||
}
|
||||
@ -1719,8 +1719,9 @@ int slsDetector::setDynamicRange(int n) {
|
||||
<< detector_shm()->dataBytesInclGapPixels;
|
||||
}
|
||||
|
||||
|
||||
// send to receiver
|
||||
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG && ret == OK) {
|
||||
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG && ret != FAIL) {
|
||||
fnum = F_SET_RECEIVER_DYNAMIC_RANGE;
|
||||
n = detector_shm()->dynamicRange;
|
||||
retval = -1;
|
||||
@ -3404,37 +3405,23 @@ sls_detector_module slsDetector::getModule() {
|
||||
int slsDetector::setRateCorrection(int64_t t) {
|
||||
int fnum = F_SET_RATE_CORRECT;
|
||||
int ret = FAIL;
|
||||
int64_t arg = t;
|
||||
FILE_LOG(logDEBUG1) << "Setting Rate Correction to " << arg;
|
||||
FILE_LOG(logDEBUG1) << "Setting Rate Correction to " << t;
|
||||
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
||||
auto client = DetectorSocket(detector_shm()->hostname,
|
||||
detector_shm()->controlPort);
|
||||
ret = client.sendCommandThenRead(fnum, &arg, sizeof(arg), nullptr, 0);
|
||||
ret = sendToDetector(fnum, &t, sizeof(t), nullptr, 0);
|
||||
detector_shm()->deadTime = t;
|
||||
}
|
||||
if (ret == FORCE_UPDATE) {
|
||||
ret = updateDetector();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getRateCorrection() {
|
||||
int fnum = F_GET_RATE_CORRECT;
|
||||
int ret = FAIL;
|
||||
int64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting rate correction";
|
||||
|
||||
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
||||
auto client = DetectorSocket(detector_shm()->hostname,
|
||||
detector_shm()->controlPort);
|
||||
ret = client.sendCommandThenRead(fnum, nullptr, 0, &retval,
|
||||
sizeof(retval));
|
||||
sendToDetector(fnum, nullptr, 0, &retval, sizeof(retval));
|
||||
detector_shm()->deadTime = retval;
|
||||
FILE_LOG(logDEBUG1) << "Rate correction: " << retval;
|
||||
}
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateDetector();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -1108,7 +1108,7 @@ void slsReceiverImplementation::setDetectorPositionId(const int id) {
|
||||
&detID, &numThreads, &numberOfFrames, &dynamicRange, &udpPortNum[i],
|
||||
generalData);
|
||||
}
|
||||
|
||||
assert(numDet[1] != 0);
|
||||
for (unsigned int i = 0; i < listener.size(); ++i) {
|
||||
uint16_t row = 0, col = 0;
|
||||
row = (detID % numDet[1]) * ((numUDPInterfaces == 2) ? 2 : 1); // row
|
||||
|
Loading…
x
Reference in New Issue
Block a user