diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 0bcfb7111..dc97903bb 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -804,8 +804,8 @@ void qTabMeasurement::GetNextFrameNumber() { spinNextFrameNumber->setValue(retval); } CATCH_HANDLE("Could not get starting frame number.", - "qTabMeasurement::GetNextFrameNumber", spinNextFrameNumber, - &QSpinBox::setValue, -1) + "qTabMeasurement::GetNextFrameNumber", spinNextFrameNumber, + &QSpinBox::setValue, -1) connect(spinNextFrameNumber, SIGNAL(valueChanged(int)), this, SLOT(SetNextFrameNumber(int))); } diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index 5d5c83de9..deabb002a 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -2928,7 +2928,8 @@ int softwareTrigger(int block) { usleep(100); #ifndef VIRTUAL - // block till frame sent out & back to wait for trigger (or not busy anymore) + // block till frame sent out & back to wait for trigger (or not busy + // anymore) if (block) { uint32_t retval = bus_r(STATUS_REG); while ((retval & RUN_BUSY_MSK) && !(retval & WAITING_FOR_TRIGGER_MSK)) { @@ -2971,11 +2972,10 @@ enum runStatus getRunStatus() { LOG(logINFOBLUE, ("Status: ERROR\n")); s = ERROR; } - + // running else if (retval & RUN_BUSY_MSK) { - if ((retval & - WAITING_FOR_TRIGGER_MSK) || + if ((retval & WAITING_FOR_TRIGGER_MSK) || (retval & WAITING_FOR_START_FRAME_MSK)) { LOG(logINFOBLUE, ("Status: WAITING\n")); s = WAITING; diff --git a/slsDetectorServers/slsDetectorServer/src/blackfin.c b/slsDetectorServers/slsDetectorServer/src/blackfin.c index 1b38be10a..dc9011b96 100644 --- a/slsDetectorServers/slsDetectorServer/src/blackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/blackfin.c @@ -88,7 +88,7 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) { // if electron mode bit touched #ifdef JUNGFRAUD int electronCollectionModeChange = 0; - if ((offset << MEM_MAP_SHIFT) == DAQ_REG) { + if ((offset << MEM_MAP_SHIFT) == DAQ_REG) { if ((readRegister(offset) ^ data) & DAQ_ELCTRN_CLLCTN_MDE_MSK) { electronCollectionModeChange = 1; } diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 7175cd996..e15bdbc15 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -1950,59 +1950,57 @@ int acquire(int blocking, int file_des) { #ifdef EIGERD // check for hardware mac and hardware ip if (udpDetails[0].srcmac != getDetectorMAC()) { - ret = FAIL; - uint64_t sourcemac = getDetectorMAC(); - char src_mac[MAC_ADDRESS_SIZE]; - getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac); - sprintf( - mess, + ret = FAIL; + uint64_t sourcemac = getDetectorMAC(); + char src_mac[MAC_ADDRESS_SIZE]; + getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac); + sprintf(mess, "Invalid udp source mac address for this detector. Must be " "same as hardware detector mac address %s\n", src_mac); - LOG(logERROR, (mess)); - } else if (!enableTenGigabitEthernet(GET_FLAG) && - (udpDetails[0].srcip != getDetectorIP())) { - ret = FAIL; - uint32_t sourceip = getDetectorIP(); - char src_ip[INET_ADDRSTRLEN]; - getIpAddressinString(src_ip, sourceip); - sprintf( - mess, + LOG(logERROR, (mess)); + } else if (!enableTenGigabitEthernet(GET_FLAG) && + (udpDetails[0].srcip != getDetectorIP())) { + ret = FAIL; + uint32_t sourceip = getDetectorIP(); + char src_ip[INET_ADDRSTRLEN]; + getIpAddressinString(src_ip, sourceip); + sprintf(mess, "Invalid udp source ip address for this detector. Must be " "same as hardware detector ip address %s in 1G readout " "mode \n", src_ip); - LOG(logERROR, (mess)); - } else + LOG(logERROR, (mess)); + } else #endif - if (configured == FAIL) { + if (configured == FAIL) { + ret = FAIL; + strcpy(mess, "Could not start acquisition because "); + strcat(mess, configureMessage); + LOG(logERROR, (mess)); + } else if (sharedMemory_getScanStatus() == RUNNING) { + ret = FAIL; + strcpy(mess, "Could not start acquisition because a scan is " + "already running!\n"); + LOG(logERROR, (mess)); + } else { + memset(scanErrMessage, 0, MAX_STR_LENGTH); + sharedMemory_setScanStop(0); + sharedMemory_setScanStatus(IDLE); // if it was error + if (pthread_create(&pthread_tid, NULL, &start_state_machine, + &blocking)) { ret = FAIL; - strcpy(mess, "Could not start acquisition because "); - strcat(mess, configureMessage); - LOG(logERROR, (mess)); - } else if (sharedMemory_getScanStatus() == RUNNING) { - ret = FAIL; - strcpy(mess, "Could not start acquisition because a scan is " - "already running!\n"); + strcpy(mess, "Could not start acquisition thread!\n"); LOG(logERROR, (mess)); } else { - memset(scanErrMessage, 0, MAX_STR_LENGTH); - sharedMemory_setScanStop(0); - sharedMemory_setScanStatus(IDLE); // if it was error - if (pthread_create(&pthread_tid, NULL, &start_state_machine, - &blocking)) { - ret = FAIL; - strcpy(mess, "Could not start acquisition thread!\n"); - LOG(logERROR, (mess)); - } else { - // wait for blocking always (scan or not) - // non blocking-no scan also wait (for error message) - // non blcoking-scan dont wait (there is scanErrorMessage) - if (blocking || !scan) { - pthread_join(pthread_tid, NULL); - } + // wait for blocking always (scan or not) + // non blocking-no scan also wait (for error message) + // non blcoking-scan dont wait (there is scanErrorMessage) + if (blocking || !scan) { + pthread_join(pthread_tid, NULL); } } + } } return Server_SendResult(file_des, INT32, NULL, 0); } diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 4124110d3..4ac8f2d44 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -886,7 +886,8 @@ void Detector::stopDetector(Positions pos) { // idle before stopping will return running (after async start script) when // getting status after, which will then be stopped again. - while (!status.contains_only(defs::runStatus::IDLE, defs::runStatus::STOPPED)){ + while (!status.contains_only(defs::runStatus::IDLE, + defs::runStatus::STOPPED)) { if (status.any(defs::runStatus::ERROR)) { throw RuntimeError("Could not stop detector. At least one module " "returned error status."); diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index e22f58fc8..2db04f1f2 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -1229,17 +1229,17 @@ int DetectorImpl::acquire() { // handle jf sync issue (master idle, slaves stopped) if (statusList.contains_only(IDLE, STOPPED)) { status = STOPPED; - } - else + } else status = statusList.squash(RUNNING); } // progress auto a = Parallel(&Module::getReceiverProgress, {}); double progress = (*std::max_element(a.begin(), a.end())); - + // callback - acquisition_finished(progress, static_cast(status), acqFinished_p); + acquisition_finished(progress, static_cast(status), + acqFinished_p); } clock_gettime(CLOCK_REALTIME, &end); diff --git a/slsDetectorSoftware/src/DetectorImpl.h b/slsDetectorSoftware/src/DetectorImpl.h index 9baefe8b3..a4484c243 100644 --- a/slsDetectorSoftware/src/DetectorImpl.h +++ b/slsDetectorSoftware/src/DetectorImpl.h @@ -84,9 +84,7 @@ class DetectorImpl : public virtual slsDetectorDefs { */ virtual ~DetectorImpl(); - template struct NonDeduced { - using type = CT; - }; + template struct NonDeduced { using type = CT; }; template Result Parallel(RT (Module::*somefunc)(CT...), std::vector positions, diff --git a/slsDetectorSoftware/tests/test-CmdProxy-gotthard2.cpp b/slsDetectorSoftware/tests/test-CmdProxy-gotthard2.cpp index ccc5c9410..4cc88d954 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-gotthard2.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-gotthard2.cpp @@ -692,7 +692,8 @@ TEST_CASE("confadc", "[.cmd]") { const int ndet = det.size(); const int nchip = 10; const int nadc = 32; - std::vector>> prev_val(ndet, std::vector>(nchip, std::vector(nadc))); + std::vector>> prev_val( + ndet, std::vector>(nchip, std::vector(nadc))); for (int i = 0; i != ndet; ++i) { for (int j = 0; j != nchip; ++j) { for (int k = 0; k != nadc; ++k) { diff --git a/slsDetectorSoftware/tests/test-CmdProxy-moench.cpp b/slsDetectorSoftware/tests/test-CmdProxy-moench.cpp index fdcbaff24..e56e0d99f 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-moench.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-moench.cpp @@ -19,17 +19,18 @@ using test::PUT; /* dacs */ TEST_CASE("Setting and reading back moench dacs", "[.cmd][.dacs]") { - // vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds, ibias_sfp + // vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds, + // ibias_sfp Detector det; CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::MOENCH) { - SECTION("vbp_colbuf") { test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300); } + SECTION("vbp_colbuf") { + test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300); + } SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 1000); } SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); } - SECTION("vb_sda") { - test_dac(defs::VB_SDA, "vb_sda", 680); - } + SECTION("vb_sda") { test_dac(defs::VB_SDA, "vb_sda", 680); } SECTION("vcasc_sfp") { test_dac(defs::VCASC_SFP, "vcasc_sfp", 1428); } SECTION("vout_cm") { test_dac(defs::VOUT_CM, "vout_cm", 1200); } SECTION("vipre_cds") { test_dac(defs::VIPRE_CDS, "vipre_cds", 800); } @@ -105,5 +106,4 @@ TEST_CASE("Setting and reading back moench dacs", "[.cmd][.dacs]") { } } - } // namespace sls diff --git a/slsDetectorSoftware/tests/test-Result.cpp b/slsDetectorSoftware/tests/test-Result.cpp index 30a735f28..c921dcfb1 100644 --- a/slsDetectorSoftware/tests/test-Result.cpp +++ b/slsDetectorSoftware/tests/test-Result.cpp @@ -196,24 +196,24 @@ TEST_CASE("String conversions") { "[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]"); } -TEST_CASE("Any element is equal"){ - Result r{1,2,3,4,5}; +TEST_CASE("Any element is equal") { + Result r{1, 2, 3, 4, 5}; REQUIRE(r.any(3)); REQUIRE_FALSE(r.any(9)); } -TEST_CASE("Result contains only the specified elements"){ - Result r{1,1,1}; +TEST_CASE("Result contains only the specified elements") { + Result r{1, 1, 1}; REQUIRE(r.contains_only(1)); - REQUIRE(r.contains_only(1,1)); + REQUIRE(r.contains_only(1, 1)); } -TEST_CASE("Only with multiple values"){ - Result r{1,1,2,1,2,1,1}; +TEST_CASE("Only with multiple values") { + Result r{1, 1, 2, 1, 2, 1, 1}; REQUIRE_FALSE(r.contains_only(1)); REQUIRE_FALSE(r.contains_only(2)); - REQUIRE(r.contains_only(1,2)); - REQUIRE(r.contains_only(2,1)); + REQUIRE(r.contains_only(1, 2)); + REQUIRE(r.contains_only(2, 1)); } } // namespace sls diff --git a/slsSupportLib/include/sls/TypeTraits.h b/slsSupportLib/include/sls/TypeTraits.h index 80bee0b44..042d5d58e 100644 --- a/slsSupportLib/include/sls/TypeTraits.h +++ b/slsSupportLib/include/sls/TypeTraits.h @@ -103,14 +103,13 @@ template struct is_vector : public std::false_type {}; template struct is_vector> : public std::true_type {}; - - -template struct Conjunction : std::true_type {}; -template struct Conjunction : B1 {}; -template +template struct Conjunction : std::true_type {}; +template struct Conjunction : B1 {}; +template struct Conjunction : std::conditional, B1>::type {}; -template -using AllSame = typename std::enable_if...>::value>::type; +template +using AllSame = + typename std::enable_if...>::value>::type; } // namespace sls \ No newline at end of file diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index e8bf60789..2b55d8905 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -4,10 +4,10 @@ #define RELEASE "developer" #define APILIB "developer 0x230224" #define APIRECEIVER "developer 0x230224" -#define APICTB "developer 0x231102" -#define APIGOTTHARD "developer 0x231102" +#define APICTB "developer 0x231102" +#define APIGOTTHARD "developer 0x231102" #define APIGOTTHARD2 "developer 0x231102" -#define APIJUNGFRAU "developer 0x231102" -#define APIMYTHEN3 "developer 0x231102" -#define APIMOENCH "developer 0x231102" -#define APIEIGER "developer 0x231102" +#define APIJUNGFRAU "developer 0x231102" +#define APIMYTHEN3 "developer 0x231102" +#define APIMOENCH "developer 0x231102" +#define APIEIGER "developer 0x231102"