From d3101baacb3a7bf9291bb8dabb6f0a3b331bec10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 25 Jun 2019 11:14:05 +0200 Subject: [PATCH 1/3] receiver create path (#35) --- .../src/slsReceiverImplementation.cpp | 9 +++---- .../src/slsReceiverTCPIPInterface.cpp | 2 ++ slsSupportLib/include/file_utils.h | 4 +-- slsSupportLib/src/file_utils.cpp | 25 ++++++++++++++++++- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/slsReceiverSoftware/src/slsReceiverImplementation.cpp b/slsReceiverSoftware/src/slsReceiverImplementation.cpp index 0ee2fcec0..80e177e2c 100755 --- a/slsReceiverSoftware/src/slsReceiverImplementation.cpp +++ b/slsReceiverSoftware/src/slsReceiverImplementation.cpp @@ -13,6 +13,7 @@ #include "GeneralData.h" #include "Listener.h" #include "ZmqSocket.h" //just for the zmq port define +#include "file_utils.h" #include //eperm #include //system @@ -555,12 +556,8 @@ void slsReceiverImplementation::setFilePath(const char c[]) { FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (strlen(c)) { - // check if filepath exists - struct stat st; - if (stat(c, &st) == 0) - strcpy(filePath, c); - else - FILE_LOG(logERROR) << "FilePath does not exist: " << c; + mkdir_p(c); //throws if it can't create + strcpy(filePath, c); } FILE_LOG(logINFO) << "File path: " << filePath; } diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 64356337e..d62af13f6 100755 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -808,6 +808,8 @@ int slsReceiverTCPIPInterface::set_file_dir(Interface &socket) { if (strlen(fPath) != 0) { FILE_LOG(logDEBUG1) << "Setting file path: " << fPath; + if(fPath[0] != '/') + throw RuntimeError("Receiver path needs to be absolute path"); impl()->setFilePath(fPath); } std::string s = impl()->getFilePath(); diff --git a/slsSupportLib/include/file_utils.h b/slsSupportLib/include/file_utils.h index 9be439e77..0b9ceadbb 100755 --- a/slsSupportLib/include/file_utils.h +++ b/slsSupportLib/include/file_utils.h @@ -52,5 +52,5 @@ int writeDataFile(std::string fname,int nch, short int *data); - - +// mkdir -p path implemented by recursive calls +void mkdir_p(const std::string& path, std::string dir=""); diff --git a/slsSupportLib/src/file_utils.cpp b/slsSupportLib/src/file_utils.cpp index 71897e5c0..863bda544 100755 --- a/slsSupportLib/src/file_utils.cpp +++ b/slsSupportLib/src/file_utils.cpp @@ -1,9 +1,12 @@ #include "file_utils.h" #include "logger.h" +#include "sls_detector_exceptions.h" #include #include - +#include +#include +#include int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) { int ichan, iline=0; @@ -77,5 +80,25 @@ int writeDataFile(std::string fname,int nch, short int *data) { +void mkdir_p(const std::string& path, std::string dir) { + if (path.length() == 0) + return; + + size_t i = 0; + for (; i < path.length(); i++) { + dir += path[i]; + if (path[i] == '/') + break; + } + if(mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0){ + if (errno != EEXIST) + throw sls::RuntimeError("Could not create: " + dir); + } + + if (i + 1 < path.length()) + mkdir_p(path.substr(i + 1), dir); +} + + From 3bb0daeefb0de55be6462bc5e1c37089789e3461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 25 Jun 2019 11:20:31 +0200 Subject: [PATCH 2/3] moved libs (#36) --- .gitmodules | 2 +- CMakeLists.txt | 11 ++++++++++- {catch => libs/catch}/catch.hpp | 0 {catch => libs/catch}/clara.hpp | 0 {python => libs}/pybind11 | 0 .../include => libs/rapidjson}/rapidjson/allocators.h | 0 .../include => libs/rapidjson}/rapidjson/document.h | 0 .../rapidjson}/rapidjson/encodedstream.h | 0 .../include => libs/rapidjson}/rapidjson/encodings.h | 0 .../include => libs/rapidjson}/rapidjson/error/en.h | 0 .../rapidjson}/rapidjson/error/error.h | 0 .../rapidjson}/rapidjson/filereadstream.h | 0 .../rapidjson}/rapidjson/filewritestream.h | 0 .../include => libs/rapidjson}/rapidjson/fwd.h | 0 .../rapidjson}/rapidjson/internal/biginteger.h | 0 .../rapidjson}/rapidjson/internal/diyfp.h | 0 .../rapidjson}/rapidjson/internal/dtoa.h | 0 .../rapidjson}/rapidjson/internal/ieee754.h | 0 .../rapidjson}/rapidjson/internal/itoa.h | 0 .../rapidjson}/rapidjson/internal/meta.h | 0 .../rapidjson}/rapidjson/internal/pow10.h | 0 .../rapidjson}/rapidjson/internal/regex.h | 0 .../rapidjson}/rapidjson/internal/stack.h | 0 .../rapidjson}/rapidjson/internal/strfunc.h | 0 .../rapidjson}/rapidjson/internal/strtod.h | 0 .../rapidjson}/rapidjson/internal/swap.h | 0 .../rapidjson}/rapidjson/istreamwrapper.h | 0 .../rapidjson}/rapidjson/memorybuffer.h | 0 .../rapidjson}/rapidjson/memorystream.h | 0 .../rapidjson}/rapidjson/msinttypes/inttypes.h | 0 .../rapidjson}/rapidjson/msinttypes/stdint.h | 0 .../rapidjson}/rapidjson/ostreamwrapper.h | 0 .../include => libs/rapidjson}/rapidjson/pointer.h | 0 .../rapidjson}/rapidjson/prettywriter.h | 0 .../include => libs/rapidjson}/rapidjson/rapidjson.h | 0 .../include => libs/rapidjson}/rapidjson/reader.h | 0 .../include => libs/rapidjson}/rapidjson/schema.h | 0 .../include => libs/rapidjson}/rapidjson/stream.h | 0 .../rapidjson}/rapidjson/stringbuffer.h | 0 .../include => libs/rapidjson}/rapidjson/writer.h | 0 python/CMakeLists.txt | 2 +- slsSupportLib/CMakeLists.txt | 5 ++++- tests/CMakeLists.txt | 2 +- 43 files changed, 17 insertions(+), 5 deletions(-) rename {catch => libs/catch}/catch.hpp (100%) rename {catch => libs/catch}/clara.hpp (100%) rename {python => libs}/pybind11 (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/allocators.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/document.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/encodedstream.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/encodings.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/error/en.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/error/error.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/filereadstream.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/filewritestream.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/fwd.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/biginteger.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/diyfp.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/dtoa.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/ieee754.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/itoa.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/meta.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/pow10.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/regex.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/stack.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/strfunc.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/strtod.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/internal/swap.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/istreamwrapper.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/memorybuffer.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/memorystream.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/msinttypes/inttypes.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/msinttypes/stdint.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/ostreamwrapper.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/pointer.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/prettywriter.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/rapidjson.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/reader.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/schema.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/stream.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/stringbuffer.h (100%) rename {slsSupportLib/include => libs/rapidjson}/rapidjson/writer.h (100%) diff --git a/.gitmodules b/.gitmodules index 9b655d9cc..d0178eb91 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "python/pybind11"] - path = python/pybind11 + path = libs/pybind11 url = https://github.com/pybind/pybind11.git diff --git a/CMakeLists.txt b/CMakeLists.txt index c9c394baa..442156c0c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,9 +109,14 @@ if(SLS_USE_SANITIZER) # target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread) endif() +#rapidjson +add_library(rapidjson INTERFACE) +target_include_directories(rapidjson INTERFACE + $ +) # Install fake the libraries -install(TARGETS slsProjectOptions slsProjectWarnings +install(TARGETS slsProjectOptions slsProjectWarnings rapidjson EXPORT "${TARGETS_EXPORT_NAME}" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -132,6 +137,9 @@ if (SLS_USE_TESTS) add_subdirectory(tests) endif(SLS_USE_TESTS) + + + # Common functionallity to detector and receiver add_subdirectory(slsSupportLib) @@ -165,6 +173,7 @@ if (SLS_USE_INTEGRATION_TESTS) endif (SLS_USE_INTEGRATION_TESTS) if (SLS_USE_PYTHON) + add_subdirectory(libs/pybind11) add_subdirectory(python) endif(SLS_USE_PYTHON) diff --git a/catch/catch.hpp b/libs/catch/catch.hpp similarity index 100% rename from catch/catch.hpp rename to libs/catch/catch.hpp diff --git a/catch/clara.hpp b/libs/catch/clara.hpp similarity index 100% rename from catch/clara.hpp rename to libs/catch/clara.hpp diff --git a/python/pybind11 b/libs/pybind11 similarity index 100% rename from python/pybind11 rename to libs/pybind11 diff --git a/slsSupportLib/include/rapidjson/allocators.h b/libs/rapidjson/rapidjson/allocators.h similarity index 100% rename from slsSupportLib/include/rapidjson/allocators.h rename to libs/rapidjson/rapidjson/allocators.h diff --git a/slsSupportLib/include/rapidjson/document.h b/libs/rapidjson/rapidjson/document.h similarity index 100% rename from slsSupportLib/include/rapidjson/document.h rename to libs/rapidjson/rapidjson/document.h diff --git a/slsSupportLib/include/rapidjson/encodedstream.h b/libs/rapidjson/rapidjson/encodedstream.h similarity index 100% rename from slsSupportLib/include/rapidjson/encodedstream.h rename to libs/rapidjson/rapidjson/encodedstream.h diff --git a/slsSupportLib/include/rapidjson/encodings.h b/libs/rapidjson/rapidjson/encodings.h similarity index 100% rename from slsSupportLib/include/rapidjson/encodings.h rename to libs/rapidjson/rapidjson/encodings.h diff --git a/slsSupportLib/include/rapidjson/error/en.h b/libs/rapidjson/rapidjson/error/en.h similarity index 100% rename from slsSupportLib/include/rapidjson/error/en.h rename to libs/rapidjson/rapidjson/error/en.h diff --git a/slsSupportLib/include/rapidjson/error/error.h b/libs/rapidjson/rapidjson/error/error.h similarity index 100% rename from slsSupportLib/include/rapidjson/error/error.h rename to libs/rapidjson/rapidjson/error/error.h diff --git a/slsSupportLib/include/rapidjson/filereadstream.h b/libs/rapidjson/rapidjson/filereadstream.h similarity index 100% rename from slsSupportLib/include/rapidjson/filereadstream.h rename to libs/rapidjson/rapidjson/filereadstream.h diff --git a/slsSupportLib/include/rapidjson/filewritestream.h b/libs/rapidjson/rapidjson/filewritestream.h similarity index 100% rename from slsSupportLib/include/rapidjson/filewritestream.h rename to libs/rapidjson/rapidjson/filewritestream.h diff --git a/slsSupportLib/include/rapidjson/fwd.h b/libs/rapidjson/rapidjson/fwd.h similarity index 100% rename from slsSupportLib/include/rapidjson/fwd.h rename to libs/rapidjson/rapidjson/fwd.h diff --git a/slsSupportLib/include/rapidjson/internal/biginteger.h b/libs/rapidjson/rapidjson/internal/biginteger.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/biginteger.h rename to libs/rapidjson/rapidjson/internal/biginteger.h diff --git a/slsSupportLib/include/rapidjson/internal/diyfp.h b/libs/rapidjson/rapidjson/internal/diyfp.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/diyfp.h rename to libs/rapidjson/rapidjson/internal/diyfp.h diff --git a/slsSupportLib/include/rapidjson/internal/dtoa.h b/libs/rapidjson/rapidjson/internal/dtoa.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/dtoa.h rename to libs/rapidjson/rapidjson/internal/dtoa.h diff --git a/slsSupportLib/include/rapidjson/internal/ieee754.h b/libs/rapidjson/rapidjson/internal/ieee754.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/ieee754.h rename to libs/rapidjson/rapidjson/internal/ieee754.h diff --git a/slsSupportLib/include/rapidjson/internal/itoa.h b/libs/rapidjson/rapidjson/internal/itoa.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/itoa.h rename to libs/rapidjson/rapidjson/internal/itoa.h diff --git a/slsSupportLib/include/rapidjson/internal/meta.h b/libs/rapidjson/rapidjson/internal/meta.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/meta.h rename to libs/rapidjson/rapidjson/internal/meta.h diff --git a/slsSupportLib/include/rapidjson/internal/pow10.h b/libs/rapidjson/rapidjson/internal/pow10.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/pow10.h rename to libs/rapidjson/rapidjson/internal/pow10.h diff --git a/slsSupportLib/include/rapidjson/internal/regex.h b/libs/rapidjson/rapidjson/internal/regex.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/regex.h rename to libs/rapidjson/rapidjson/internal/regex.h diff --git a/slsSupportLib/include/rapidjson/internal/stack.h b/libs/rapidjson/rapidjson/internal/stack.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/stack.h rename to libs/rapidjson/rapidjson/internal/stack.h diff --git a/slsSupportLib/include/rapidjson/internal/strfunc.h b/libs/rapidjson/rapidjson/internal/strfunc.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/strfunc.h rename to libs/rapidjson/rapidjson/internal/strfunc.h diff --git a/slsSupportLib/include/rapidjson/internal/strtod.h b/libs/rapidjson/rapidjson/internal/strtod.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/strtod.h rename to libs/rapidjson/rapidjson/internal/strtod.h diff --git a/slsSupportLib/include/rapidjson/internal/swap.h b/libs/rapidjson/rapidjson/internal/swap.h similarity index 100% rename from slsSupportLib/include/rapidjson/internal/swap.h rename to libs/rapidjson/rapidjson/internal/swap.h diff --git a/slsSupportLib/include/rapidjson/istreamwrapper.h b/libs/rapidjson/rapidjson/istreamwrapper.h similarity index 100% rename from slsSupportLib/include/rapidjson/istreamwrapper.h rename to libs/rapidjson/rapidjson/istreamwrapper.h diff --git a/slsSupportLib/include/rapidjson/memorybuffer.h b/libs/rapidjson/rapidjson/memorybuffer.h similarity index 100% rename from slsSupportLib/include/rapidjson/memorybuffer.h rename to libs/rapidjson/rapidjson/memorybuffer.h diff --git a/slsSupportLib/include/rapidjson/memorystream.h b/libs/rapidjson/rapidjson/memorystream.h similarity index 100% rename from slsSupportLib/include/rapidjson/memorystream.h rename to libs/rapidjson/rapidjson/memorystream.h diff --git a/slsSupportLib/include/rapidjson/msinttypes/inttypes.h b/libs/rapidjson/rapidjson/msinttypes/inttypes.h similarity index 100% rename from slsSupportLib/include/rapidjson/msinttypes/inttypes.h rename to libs/rapidjson/rapidjson/msinttypes/inttypes.h diff --git a/slsSupportLib/include/rapidjson/msinttypes/stdint.h b/libs/rapidjson/rapidjson/msinttypes/stdint.h similarity index 100% rename from slsSupportLib/include/rapidjson/msinttypes/stdint.h rename to libs/rapidjson/rapidjson/msinttypes/stdint.h diff --git a/slsSupportLib/include/rapidjson/ostreamwrapper.h b/libs/rapidjson/rapidjson/ostreamwrapper.h similarity index 100% rename from slsSupportLib/include/rapidjson/ostreamwrapper.h rename to libs/rapidjson/rapidjson/ostreamwrapper.h diff --git a/slsSupportLib/include/rapidjson/pointer.h b/libs/rapidjson/rapidjson/pointer.h similarity index 100% rename from slsSupportLib/include/rapidjson/pointer.h rename to libs/rapidjson/rapidjson/pointer.h diff --git a/slsSupportLib/include/rapidjson/prettywriter.h b/libs/rapidjson/rapidjson/prettywriter.h similarity index 100% rename from slsSupportLib/include/rapidjson/prettywriter.h rename to libs/rapidjson/rapidjson/prettywriter.h diff --git a/slsSupportLib/include/rapidjson/rapidjson.h b/libs/rapidjson/rapidjson/rapidjson.h similarity index 100% rename from slsSupportLib/include/rapidjson/rapidjson.h rename to libs/rapidjson/rapidjson/rapidjson.h diff --git a/slsSupportLib/include/rapidjson/reader.h b/libs/rapidjson/rapidjson/reader.h similarity index 100% rename from slsSupportLib/include/rapidjson/reader.h rename to libs/rapidjson/rapidjson/reader.h diff --git a/slsSupportLib/include/rapidjson/schema.h b/libs/rapidjson/rapidjson/schema.h similarity index 100% rename from slsSupportLib/include/rapidjson/schema.h rename to libs/rapidjson/rapidjson/schema.h diff --git a/slsSupportLib/include/rapidjson/stream.h b/libs/rapidjson/rapidjson/stream.h similarity index 100% rename from slsSupportLib/include/rapidjson/stream.h rename to libs/rapidjson/rapidjson/stream.h diff --git a/slsSupportLib/include/rapidjson/stringbuffer.h b/libs/rapidjson/rapidjson/stringbuffer.h similarity index 100% rename from slsSupportLib/include/rapidjson/stringbuffer.h rename to libs/rapidjson/rapidjson/stringbuffer.h diff --git a/slsSupportLib/include/rapidjson/writer.h b/libs/rapidjson/rapidjson/writer.h similarity index 100% rename from slsSupportLib/include/rapidjson/writer.h rename to libs/rapidjson/rapidjson/writer.h diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 16d4a95e3..12042c6b6 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory(pybind11) + pybind11_add_module(_sls_detector src/main.cpp) diff --git a/slsSupportLib/CMakeLists.txt b/slsSupportLib/CMakeLists.txt index 108793b95..cf6b0a409 100755 --- a/slsSupportLib/CMakeLists.txt +++ b/slsSupportLib/CMakeLists.txt @@ -53,7 +53,10 @@ set_target_properties(slsSupportLib PROPERTIES PUBLIC_HEADER "${PUBLICHEADERS}" ) -target_link_libraries(slsSupportLib slsProjectOptions slsProjectWarnings) +target_link_libraries(slsSupportLib + slsProjectOptions + slsProjectWarnings + rapidjson) if (SLS_USE_TESTS) add_subdirectory(tests) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9fee959cf..a98ca51f6 100755 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories( - ${PROJECT_SOURCE_DIR}/catch + ${PROJECT_SOURCE_DIR}/libs/catch include ) From e16b857ba27a91c60723cb915a186752c96709fb Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 2 Jul 2019 10:15:25 +0200 Subject: [PATCH 3/3] ctb server: hv select is actually internal hv select --- slsDetectorServers/ctbDetectorServer/RegisterDefs.h | 4 ++-- .../ctbDetectorServer/slsDetectorFunctionList.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/slsDetectorServers/ctbDetectorServer/RegisterDefs.h b/slsDetectorServers/ctbDetectorServer/RegisterDefs.h index bf3dae964..8aa6c2ff7 100755 --- a/slsDetectorServers/ctbDetectorServer/RegisterDefs.h +++ b/slsDetectorServers/ctbDetectorServer/RegisterDefs.h @@ -439,8 +439,8 @@ #define POWER_ENBL_VLTG_RGLTR_OFST (16) #define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST) -#define POWER_HV_SLCT_OFST (31) -#define POWER_HV_SLCT_MSK (0x00000001 << POWER_HV_SLCT_OFST) +#define POWER_HV_INTERNAL_SLCT_OFST (31) +#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST) /* Number of Words RW register TODO */ #define NUMBER_OF_WORDS_REG (0x5F << MEM_MAP_SHIFT) diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index df2281e81..b6b7e482c 100755 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -1422,14 +1422,14 @@ int setHighVoltage(int val){ FILE_LOG(logINFO, ("Setting High voltage: %d V\n", val)); uint32_t addr = POWER_REG; - // switch off high voltage - bus_w(addr, bus_r(addr) & (~POWER_HV_SLCT_MSK)); + // switch to external high voltage + bus_w(addr, bus_r(addr) & (~POWER_HV_INTERNAL_SLCT_OFST)); MAX1932_Set(val); - // switch on high voltage if val > 0 + // switch on internal high voltage, if set if (val > 0) - bus_w(addr, bus_r(addr) | POWER_HV_SLCT_MSK); + bus_w(addr, bus_r(addr) | POWER_HV_INTERNAL_SLCT_OFST); highvoltage = val; }