Merge branch 'developer' into gui

This commit is contained in:
Erik Frojdh committed 2019-07-02 10:54:29 +02:00
commit 547ab8a749
49 files changed
+54 -20

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
[submodule "python/pybind11"]
path = python/pybind11
path = libs/pybind11
url = https://github.com/pybind/pybind11.git
+10 -1
View File
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libs/rapidjson>
)
# 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)
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,4 +1,4 @@
add_subdirectory(pybind11)
pybind11_add_module(_sls_detector src/main.cpp)
@@ -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)
@@ -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;
}
@@ -13,6 +13,7 @@
#include "GeneralData.h"
#include "Listener.h"
#include "ZmqSocket.h" //just for the zmq port define
#include "file_utils.h"
#include <cerrno> //eperm
#include <cstdlib> //system
@@ -553,12 +554,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;
}
@@ -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();
+4 -1
View File
@@ -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)
+2 -2
View File
@@ -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="");
+24 -1
View File
@@ -1,9 +1,12 @@
#include "file_utils.h"
#include "logger.h"
#include "sls_detector_exceptions.h"
#include <iostream>
#include <sstream>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
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);
}
+1 -1
View File
@@ -1,5 +1,5 @@
include_directories(
${PROJECT_SOURCE_DIR}/catch
${PROJECT_SOURCE_DIR}/libs/catch
include
)