mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 00:07:13 +02:00
Compare commits
254 Commits
2022.2.23.
...
g2rxrgui
Author | SHA1 | Date | |
---|---|---|---|
6964be2aeb | |||
32e3457e84 | |||
aa93aed4ed | |||
97a2a3d7c1 | |||
5490daa0a1 | |||
37a8c61124 | |||
8ca8185d41 | |||
421c2c161a | |||
89aa0760c6 | |||
3cee36a3db | |||
59eea1a1fd | |||
2b5470ef59 | |||
b5d02ac398 | |||
364e0c6268 | |||
728cb35c37 | |||
7536c16a48 | |||
4fe520fdaf | |||
1cfebf667b | |||
23e4dde063 | |||
1fb90ab98c | |||
12c2609978 | |||
25b5b02302 | |||
365ac835eb | |||
d61741c28b | |||
8656eeec25 | |||
f5745fcf18 | |||
c7ba79644a | |||
70aed474dc | |||
f3edd4dc56 | |||
a4bd2f1be7 | |||
73a45e1b5c | |||
4259363169 | |||
fcc7f7aef8 | |||
9808376207 | |||
be617577c9 | |||
e30ee445a1 | |||
8d6b8d66cc | |||
88649a00b6 | |||
b122c2fbdf | |||
7d574375b4 | |||
466d431081 | |||
cd4520b051 | |||
0129c2c686 | |||
f55bdd6eae | |||
36a1159f38 | |||
98e2ddbb74 | |||
fa12ab2858 | |||
afeee5501c | |||
b7153fe3e0 | |||
2db2694660 | |||
e1642cf37c | |||
086d22f1a3 | |||
52882cba20 | |||
27c7fd9a97 | |||
5d16ba7e16 | |||
d8c6f9141d | |||
e9dc3d8c38 | |||
62418c1316 | |||
835aa575b0 | |||
b42d65c5e2 | |||
150d27cf95 | |||
95ed9551c0 | |||
0f2ec47b5f | |||
fe895cd782 | |||
11bf6a5c58 | |||
8bce87c082 | |||
61f38bf5a9 | |||
cbc7066620 | |||
509ed9101f | |||
191cfa0abe | |||
f712847061 | |||
b875a95bd5 | |||
45f57ebeb7 | |||
0309eba3c6 | |||
f0448b3cec | |||
a18af0b726 | |||
6aa5cb8d3e | |||
479906a9eb | |||
28a503ed5a | |||
b3c5a431d0 | |||
43cde3609a | |||
9d2d8fe1d7 | |||
1826dd46cb | |||
cf6423dbbe | |||
8b1851e652 | |||
5913864cbb | |||
c2ef6d700e | |||
76296507ff | |||
03d2158472 | |||
bb7b676ca2 | |||
e1988bf088 | |||
8ef1a209c9 | |||
28572af3ab | |||
c57e528447 | |||
74e325edb4 | |||
e68499bb09 | |||
8ce6868e46 | |||
f5cca7a98f | |||
b9aa0f46e4 | |||
6cd780ae99 | |||
f2be834d55 | |||
e55e18d5e9 | |||
66900da476 | |||
13ec32c79a | |||
1ff35edb99 | |||
9a969c1549 | |||
039e1fd829 | |||
fc41d4313f | |||
4bd4364a3a | |||
4b697dd9db | |||
6470277e43 | |||
2453390cc3 | |||
fa694dbc4c | |||
ea1222ac5b | |||
cbed2e88c6 | |||
4cce1dbd7f | |||
1710177af4 | |||
5c79a1a1e8 | |||
0f02ffdc9a | |||
83d76267f9 | |||
9ff43efdc5 | |||
21c21a423d | |||
e479b7d4be | |||
8f0398681e | |||
b112cf81c4 | |||
589124845a | |||
90d1d0f8b8 | |||
1e564a1b33 | |||
5fe10c19a1 | |||
de5c298d99 | |||
2a1f6dc544 | |||
fc21a6763d | |||
fd8e1b2ef7 | |||
0803f1bc1f | |||
9995b74217 | |||
2823451c9d | |||
0f4bcf3a9d | |||
74d55db3f0 | |||
2b35101b17 | |||
f538b8b10b | |||
fb012aa9e9 | |||
82bad7fec6 | |||
717922f380 | |||
3250dda7eb | |||
dffac3014e | |||
586149f3e7 | |||
088dd2c9f8 | |||
89395bd990 | |||
3144f40068 | |||
2fe24c108b | |||
bbfe3b278f | |||
c9fd8ba569 | |||
faa4f09a82 | |||
1ca2e61a85 | |||
7fa51e2a8e | |||
adbd2b853d | |||
0e6d92118f | |||
3796182eb1 | |||
570651a9f8 | |||
afbc414afe | |||
ca0aa7144c | |||
3e5b8840b4 | |||
f1da831e10 | |||
06281ccae9 | |||
509946d964 | |||
95f9da9d70 | |||
4a663e9e50 | |||
b02dec8157 | |||
c361b9517c | |||
78823760b3 | |||
d80006a024 | |||
561777dad6 | |||
c1895c4bc8 | |||
7b66466186 | |||
ef1c52ddc1 | |||
7bd4b9d9d9 | |||
39d3ee2b15 | |||
401467c700 | |||
c9769579e3 | |||
7663d4ef53 | |||
9c1bc262e5 | |||
c17914e0a1 | |||
7d91a15834 | |||
43c46841c1 | |||
fc6c6985e6 | |||
14c63810d6 | |||
6f0eebfbb8 | |||
c8bed64b91 | |||
e1762605e8 | |||
62fff64d87 | |||
7a39822813 | |||
de9e83fd61 | |||
80d31bbb10 | |||
45171d82a4 | |||
9e050060f3 | |||
ed5a1cdf1c | |||
34588356e8 | |||
b6d63a8381 | |||
dd8aebb0ab | |||
261ac78743 | |||
0437bd0584 | |||
46578d1447 | |||
5566cfd24f | |||
5869c25658 | |||
0b7c202f98 | |||
4db34effda | |||
5a5d4eadf1 | |||
b9016fad12 | |||
a1ee681135 | |||
219318a52e | |||
89edf58f41 | |||
ef3df36e55 | |||
6d2302bcc1 | |||
6695b10354 | |||
94adba72bf | |||
1063e8b929 | |||
c9abeace8f | |||
5bfdbf59a2 | |||
1cd347a54d | |||
76eb09eb04 | |||
a936cc26cc | |||
92beb3aa2a | |||
543eb7bb60 | |||
e4b80703ae | |||
2b2533f465 | |||
daa536077d | |||
aa7dee1011 | |||
54313af2f8 | |||
ab302a5160 | |||
7a607c6dd1 | |||
83ff4ab112 | |||
fb631187fa | |||
8770c9f6fb | |||
6e0d7b91bd | |||
6433704086 | |||
aea0efa1b6 | |||
8ffa2c1d65 | |||
47f9ab4027 | |||
0d521b64b6 | |||
0fb6c8b823 | |||
d2731c77a3 | |||
40a9dce7e0 | |||
2ba89b8a45 | |||
4cfb35c176 | |||
4107938921 | |||
8eb5c19187 | |||
a1888bf7c9 | |||
f2cca765be | |||
5b4cc53f8c | |||
251f07a9ae | |||
f228fde6f7 | |||
20f3fb19af | |||
cfe627d348 | |||
753387c34c |
@ -19,6 +19,7 @@ Checks: '*,
|
|||||||
-google-readability-braces-around-statements,
|
-google-readability-braces-around-statements,
|
||||||
-modernize-use-trailing-return-type,
|
-modernize-use-trailing-return-type,
|
||||||
-readability-isolate-declaration,
|
-readability-isolate-declaration,
|
||||||
|
-readability-implicit-bool-conversion,
|
||||||
-llvmlibc-*'
|
-llvmlibc-*'
|
||||||
|
|
||||||
HeaderFilterRegex: \.h
|
HeaderFilterRegex: \.h
|
||||||
|
191
CMakeLists.txt
191
CMakeLists.txt
@ -8,11 +8,8 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
|||||||
|
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
include(cmake/project_version.cmake)
|
include(cmake/project_version.cmake)
|
||||||
|
|
||||||
#functions to add compiler flags
|
|
||||||
include(cmake/SlsAddFlag.cmake)
|
include(cmake/SlsAddFlag.cmake)
|
||||||
|
include(cmake/SlsFindZeroMQ.cmake)
|
||||||
# Include additional modules that are used unconditionally
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# If conda build, always set lib dir to 'lib'
|
# If conda build, always set lib dir to 'lib'
|
||||||
@ -26,7 +23,7 @@ string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
|
|||||||
|
|
||||||
# Set targets export name (used by slsDetectorPackage and dependencies)
|
# Set targets export name (used by slsDetectorPackage and dependencies)
|
||||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
|
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
|
||||||
#set(namespace "${PROJECT_NAME}::")
|
set(namespace "sls::")
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
@ -37,6 +34,8 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|||||||
set(SLS_MASTER_PROJECT ON)
|
set(SLS_MASTER_PROJECT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
option(SLS_USE_HDF5 "HDF5 File format" OFF)
|
option(SLS_USE_HDF5 "HDF5 File format" OFF)
|
||||||
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" ON)
|
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" ON)
|
||||||
option(SLS_USE_TEXTCLIENT "Text Client" ON)
|
option(SLS_USE_TEXTCLIENT "Text Client" ON)
|
||||||
@ -69,6 +68,20 @@ if(SLS_BUILD_ONLY_MOENCH)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
option(SLS_EXT_BUILD "external build of part of the project" OFF)
|
||||||
|
if(SLS_EXT_BUILD)
|
||||||
|
message(STATUS "External build using already installed libraries")
|
||||||
|
set(SLS_BUILD_SHARED_LIBRARIES OFF CACHE BOOL "Should already exist" FORCE)
|
||||||
|
set(SLS_USE_TEXTCLIENT OFF CACHE BOOL "Should already exist" FORCE)
|
||||||
|
set(SLS_USE_DETECTOR OFF CACHE BOOL "Should already exist" FORCE)
|
||||||
|
set(SLS_USE_RECEIVER OFF CACHE BOOL "Should already exist" FORCE)
|
||||||
|
set(SLS_USE_RECEIVER_BINARIES OFF CACHE BOOL "Should already exist" FORCE)
|
||||||
|
set(SLS_MASTER_PROJECT OFF CACHE BOOL "No master proj in case of extbuild" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#Maybe have an option guarding this?
|
||||||
|
set(SLS_INTERNAL_RAPIDJSON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/rapidjson)
|
||||||
|
|
||||||
set(ClangFormat_EXCLUDE_PATTERNS "build/"
|
set(ClangFormat_EXCLUDE_PATTERNS "build/"
|
||||||
"libs/"
|
"libs/"
|
||||||
"slsDetectorCalibration/"
|
"slsDetectorCalibration/"
|
||||||
@ -79,9 +92,6 @@ set(ClangFormat_EXCLUDE_PATTERNS "build/"
|
|||||||
${CMAKE_BINARY_DIR})
|
${CMAKE_BINARY_DIR})
|
||||||
find_package(ClangFormat)
|
find_package(ClangFormat)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
@ -100,62 +110,68 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#Add two fake libraries to manage options
|
if(SLS_EXT_BUILD)
|
||||||
add_library(slsProjectOptions INTERFACE)
|
# Find ourself in case of external build
|
||||||
add_library(slsProjectWarnings INTERFACE)
|
find_package(slsDetectorPackage ${PROJECT_VERSION} REQUIRED)
|
||||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
|
||||||
target_compile_options(slsProjectWarnings INTERFACE
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Wno-unused-parameter
|
|
||||||
# -Wold-style-cast
|
|
||||||
-Wnon-virtual-dtor
|
|
||||||
-Woverloaded-virtual
|
|
||||||
-Wdouble-promotion
|
|
||||||
-Wformat=2
|
|
||||||
-Wredundant-decls
|
|
||||||
# -Wconversion
|
|
||||||
-Wvla
|
|
||||||
-Wdouble-promotion
|
|
||||||
-Werror=return-type
|
|
||||||
)
|
|
||||||
|
|
||||||
#Settings for C code
|
|
||||||
add_library(slsProjectCSettings INTERFACE)
|
|
||||||
target_compile_options(slsProjectCSettings INTERFACE
|
|
||||||
-std=gnu99 #fixed
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Wno-unused-parameter
|
|
||||||
-Wdouble-promotion
|
|
||||||
-Wformat=2
|
|
||||||
-Wredundant-decls
|
|
||||||
-Wdouble-promotion
|
|
||||||
-Werror=return-type
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
#Testing for minimum version for compilers
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
|
|
||||||
message(FATAL_ERROR "Clang version must be at least 3.2!")
|
|
||||||
endif()
|
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
|
||||||
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
|
||||||
endif()
|
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
|
|
||||||
target_compile_options(slsProjectWarnings INTERFACE
|
|
||||||
-Wno-missing-field-initializers)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add or disable warnings depending on if the compiler supports them
|
|
||||||
# The function checks internally and sets HAS_warning-name
|
|
||||||
sls_enable_cxx_warning("-Wnull-dereference")
|
# slsProjectOptions and slsProjectWarnings are used
|
||||||
sls_enable_cxx_warning("-Wduplicated-cond")
|
# to control options for the libraries
|
||||||
sls_disable_cxx_warning("-Wclass-memaccess")
|
if(NOT TARGET slsProjectOptions)
|
||||||
sls_disable_c_warning("-Wstringop-truncation")
|
add_library(slsProjectOptions INTERFACE)
|
||||||
|
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT TARGET slsProjectWarnings)
|
||||||
|
add_library(slsProjectWarnings INTERFACE)
|
||||||
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wno-unused-parameter
|
||||||
|
# -Wold-style-cast
|
||||||
|
-Wnon-virtual-dtor
|
||||||
|
-Woverloaded-virtual
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Wformat=2
|
||||||
|
-Wredundant-decls
|
||||||
|
# -Wconversion
|
||||||
|
-Wvla
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Werror=return-type
|
||||||
|
)
|
||||||
|
# Add or disable warnings depending on if the compiler supports them
|
||||||
|
# The function checks internally and sets HAS_warning-name
|
||||||
|
sls_enable_cxx_warning("-Wnull-dereference")
|
||||||
|
sls_enable_cxx_warning("-Wduplicated-cond")
|
||||||
|
sls_disable_cxx_warning("-Wclass-memaccess")
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
|
-Wno-missing-field-initializers)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if (NOT TARGET slsProjectCSettings)
|
||||||
|
#Settings for C code
|
||||||
|
add_library(slsProjectCSettings INTERFACE)
|
||||||
|
target_compile_options(slsProjectCSettings INTERFACE
|
||||||
|
-std=gnu99 #fixed
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wno-unused-parameter
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Wformat=2
|
||||||
|
-Wredundant-decls
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Werror=return-type
|
||||||
|
)
|
||||||
|
sls_disable_c_warning("-Wstringop-truncation")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(SLS_USE_SANITIZER)
|
if(SLS_USE_SANITIZER)
|
||||||
@ -170,58 +186,22 @@ if(SLS_TUNE_LOCAL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#rapidjson
|
if(SLS_MASTER_PROJECT)
|
||||||
add_library(rapidjson INTERFACE)
|
install(TARGETS slsProjectOptions slsProjectWarnings
|
||||||
target_include_directories(rapidjson INTERFACE
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libs/rapidjson>
|
|
||||||
)
|
|
||||||
|
|
||||||
# Install fake the libraries
|
|
||||||
install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
|
|
||||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||||
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
|
|
||||||
|
|
||||||
set(ZeroMQ_HINT "" CACHE STRING "Hint where ZeroMQ could be found")
|
custom_find_zmq()
|
||||||
#Adapted from: https://github.com/zeromq/cppzmq/
|
|
||||||
if (NOT TARGET libzmq)
|
|
||||||
if(ZeroMQ_HINT)
|
|
||||||
message(STATUS "Looking for ZeroMQ in: ${ZeroMQ_HINT}")
|
|
||||||
find_package(ZeroMQ 4
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
HINTS ${ZeroMQ_DIR}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
find_package(ZeroMQ 4 QUIET)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# libzmq autotools install: fallback to pkg-config
|
|
||||||
if(NOT ZeroMQ_FOUND)
|
|
||||||
message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)")
|
|
||||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
|
|
||||||
find_package(ZeroMQ 4 REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
|
|
||||||
if(NOT ZeroMQ_FOUND)
|
|
||||||
message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ZeroMQ_FOUND AND NOT TARGET libzmq)
|
|
||||||
message(FATAL_ERROR "ZeroMQ version not supported!")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(VAR libzmq INTERFACE_INCLUDE_DIRECTORIES)
|
|
||||||
message(STATUS "zmq: ${VAR}")
|
|
||||||
|
|
||||||
if (SLS_USE_TESTS)
|
if (SLS_USE_TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
@ -229,8 +209,9 @@ if (SLS_USE_TESTS)
|
|||||||
endif(SLS_USE_TESTS)
|
endif(SLS_USE_TESTS)
|
||||||
|
|
||||||
|
|
||||||
# Common functionallity to detector and receiver
|
if(NOT SLS_EXT_BUILD)
|
||||||
add_subdirectory(slsSupportLib)
|
add_subdirectory(slsSupportLib)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (SLS_USE_DETECTOR OR SLS_USE_TEXTCLIENT)
|
if (SLS_USE_DETECTOR OR SLS_USE_TEXTCLIENT)
|
||||||
add_subdirectory(slsDetectorSoftware)
|
add_subdirectory(slsDetectorSoftware)
|
||||||
@ -254,7 +235,7 @@ endif (SLS_USE_INTEGRATION_TESTS)
|
|||||||
|
|
||||||
if (SLS_USE_PYTHON)
|
if (SLS_USE_PYTHON)
|
||||||
find_package (Python 3.6 COMPONENTS Interpreter Development)
|
find_package (Python 3.6 COMPONENTS Interpreter Development)
|
||||||
add_subdirectory(libs/pybind11)
|
add_subdirectory(libs/pybind11 ${CMAKE_BINARY_DIR}/bin/)
|
||||||
add_subdirectory(python)
|
add_subdirectory(python)
|
||||||
endif(SLS_USE_PYTHON)
|
endif(SLS_USE_PYTHON)
|
||||||
|
|
||||||
|
45
RELEASE.txt
45
RELEASE.txt
@ -31,7 +31,7 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- rx_arping
|
- rx_arping
|
||||||
- rx_threadsids max is now 9 (breaking api)
|
- rx_threadsids max is now 9 (breaking api)
|
||||||
- fixed datastream disabling for eiger. Its only available in 10g mode.
|
- fixed datastream disabling for eiger. Its only available in 10g mode.
|
||||||
- m3 server crash (vthrehsold)
|
- m3 server crash (vthrehsold dac names were not provided)
|
||||||
- allow vtrim to be interpolated for Eiger settings
|
- allow vtrim to be interpolated for Eiger settings
|
||||||
- m3 setThresholdEnergy and setAllThresholdEnergy was overwriting gaincaps with settings enum
|
- m3 setThresholdEnergy and setAllThresholdEnergy was overwriting gaincaps with settings enum
|
||||||
- can set localhost with virtual server with minimum configuration: (hostname localhost, rx_hostname localhost, udp_dstip auto)
|
- can set localhost with virtual server with minimum configuration: (hostname localhost, rx_hostname localhost, udp_dstip auto)
|
||||||
@ -39,10 +39,51 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- current frame index points to listened frame index (not processed index)
|
- current frame index points to listened frame index (not processed index)
|
||||||
- when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster)
|
- when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster)
|
||||||
- file write disabled by default
|
- file write disabled by default
|
||||||
|
- eiger 12 bit mode
|
||||||
- start non blocking acquisition at modular level
|
- start non blocking acquisition at modular level
|
||||||
|
- connect master commands to api (allow set master for eiger)
|
||||||
|
--ignore-config command line
|
||||||
|
- command line argument 'master' mainly for virtual servers (also master/top for real eiger), only one virtual server for eiger, use command lines for master/top
|
||||||
|
- stop servers also check for errors at startup( in case it was running with an older version)
|
||||||
- hostname cmd failed when connecting to servers in update mode (ctb, moench, jungfrau, eiger)
|
- hostname cmd failed when connecting to servers in update mode (ctb, moench, jungfrau, eiger)
|
||||||
- missingpackets signed (negative => extra packets)
|
- missingpackets signed (negative => extra packets)
|
||||||
|
- framescaught and frameindex now returns a vector for each port
|
||||||
|
- progress looks at activated or enabled ports, so progress does not stagnate
|
||||||
|
- (eiger) disable datastreaming also for virtual servers only for 10g
|
||||||
|
- missing packets also takes care of disabled ports
|
||||||
|
- added geometry to metadata
|
||||||
|
- 10g eiger nextframenumber get fixed.
|
||||||
|
- stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench)
|
||||||
|
- ctb: can set names for all the dacs
|
||||||
|
- fpga/kernel programming, checks if drive is a special file and not a normal file
|
||||||
|
- gotthard 25 um image reconstructed in gui and virtual hdf5 (firmware updated for slave to reverse channels)
|
||||||
|
- master binary file in json format now
|
||||||
|
- fixed bug introduced in 6.0.0: hdf5 files created 1 file per frame after the initial file which had maxframesperfile
|
||||||
|
- rx_roi
|
||||||
|
- m3 polarity, interpolation (enables all counters when enabled), pump probe, analog pulsing, digital pulsing
|
||||||
|
- updatedetectorserver - removes old server current binary pointing to for blackfin
|
||||||
|
- removing copydetectorserver using tftp
|
||||||
|
- registerCallBackRawDataReady and registerCallBackRawDataModifyReady now gives a sls_receiver_header* instead of a char*, and uint32_t to size_t
|
||||||
|
- registerCallBackStartAcquisition gave incorrect imagesize (+120 bytes). corrected.
|
||||||
|
- registerCallBackStartAcquisition parameter is a const string reference
|
||||||
|
- m3 (runnig config second time with tengiga 0, dr !=32, counters !=0x7) calculated incorrect image size expected
|
||||||
|
- fixed row column indexing (mainly for multi module Jungfrau 2 interfaces )
|
||||||
|
- eiger gui row indices not flipped anymore (fix in config)
|
||||||
|
- m3 (settings dac check disabled temporarily?)
|
||||||
|
- m3 virtual server sends the right pacets now
|
||||||
|
- gap pixels in gui enabled by default
|
||||||
|
- rxr src files and classes (detectordata, ZmqSocket, helpDacs) added to sls namespace, and macros (namely from logger (logINFO etc)), slsDetectorGui (make_unique in implemtnation requires sls nemspace (points to std otherwise) but not deectorImpl.cpp)
|
||||||
|
- blackfin programing made seamless (nCE fixed which helps)
|
||||||
|
-save settings file for m3 and eiger
|
||||||
|
- m3 threshold changes
|
||||||
|
- g2 and m3 clkdiv 2 (system clock) change should affect time settings (g2: exptime, period, delayaftertrigger, burstperiod, m3: exptime, gatedelay, gateperiod, period, delayaftertrigger)
|
||||||
|
- g2 system frequency is the same irrespective of timing source
|
||||||
|
- (apparently) rxr doesnt get stuck anymore from 6.1.1
|
||||||
|
-rx_bunchsize, (default fifodepth for g2 changed to 50)
|
||||||
|
- rxr mem size changed (fifo header size from 8 to 16) due to sls rxr header = 112.. 112+ 16=128 (reduces packet losss especially for g2)
|
||||||
|
-udp_srcip and udp_Srcip2: can set to auto (for virtual or 1g data networks)
|
||||||
|
- set dataset name for all hdf5 files to "data" only
|
||||||
|
- number of storage cells is not updated in teh receiver. done. and also allowing it to be modified in running status
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
==================
|
==================
|
||||||
|
38
cmake/SlsFindZeroMQ.cmake
Normal file
38
cmake/SlsFindZeroMQ.cmake
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
function(custom_find_zmq)
|
||||||
|
set(ZeroMQ_HINT "" CACHE STRING "Hint where ZeroMQ could be found")
|
||||||
|
#Adapted from: https://github.com/zeromq/cppzmq/
|
||||||
|
if (NOT TARGET libzmq)
|
||||||
|
if(ZeroMQ_HINT)
|
||||||
|
message(STATUS "Looking for ZeroMQ in: ${ZeroMQ_HINT}")
|
||||||
|
find_package(ZeroMQ 4
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
HINTS ${ZeroMQ_HINT}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
find_package(ZeroMQ 4 QUIET)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# libzmq autotools install: fallback to pkg-config
|
||||||
|
if(ZeroMQ_FOUND)
|
||||||
|
message(STATUS "Found libzmq using find_package")
|
||||||
|
else()
|
||||||
|
message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)")
|
||||||
|
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/libzmq-pkg-config)
|
||||||
|
find_package(ZeroMQ 4 REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
|
||||||
|
if(NOT ZeroMQ_FOUND)
|
||||||
|
message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ZeroMQ_FOUND AND NOT TARGET libzmq)
|
||||||
|
message(FATAL_ERROR "ZeroMQ version not supported!")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_target_property(VAR libzmq IMPORTED_LOCATION)
|
||||||
|
message(STATUS "Using libzmq: ${VAR}")
|
||||||
|
|
||||||
|
|
||||||
|
endfunction()
|
36
cmake/libzmq-pkg-config/FindZeroMQ.cmake
Executable file
36
cmake/libzmq-pkg-config/FindZeroMQ.cmake
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#From: https://github.com/zeromq/cppzmq/
|
||||||
|
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
||||||
|
|
||||||
|
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
||||||
|
|
||||||
|
find_path(ZeroMQ_INCLUDE_DIR zmq.h
|
||||||
|
PATHS ${ZeroMQ_DIR}/include
|
||||||
|
${PC_LIBZMQ_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(ZeroMQ_LIBRARY
|
||||||
|
NAMES zmq
|
||||||
|
PATHS ${ZeroMQ_DIR}/lib
|
||||||
|
${PC_LIBZMQ_LIBDIR}
|
||||||
|
${PC_LIBZMQ_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
|
||||||
|
set(ZeroMQ_FOUND ON)
|
||||||
|
message(STATUS "Found libzmq using PkgConfig")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
|
||||||
|
set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
if (NOT TARGET libzmq)
|
||||||
|
add_library(libzmq UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(libzmq PROPERTIES
|
||||||
|
IMPORTED_LOCATION ${ZeroMQ_LIBRARIES}
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include ( FindPackageHandleStandardArgs )
|
||||||
|
find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS )
|
@ -26,7 +26,7 @@ install(FILES
|
|||||||
)
|
)
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
"${CMAKE_SOURCE_DIR}/libzmq-pkg-config/FindZeroMQ.cmake"
|
"${CMAKE_SOURCE_DIR}/cmake/libzmq-pkg-config/FindZeroMQ.cmake"
|
||||||
COMPONENT devel
|
COMPONENT devel
|
||||||
DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config
|
DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config
|
||||||
)
|
)
|
||||||
|
@ -19,4 +19,4 @@ cp build/install/bin/slsMultiReceiver $PREFIX/bin/.
|
|||||||
|
|
||||||
|
|
||||||
cp build/install/include/sls/* $PREFIX/include/sls
|
cp build/install/include/sls/* $PREFIX/include/sls
|
||||||
cp -r build/install/share/ $PREFIX/share
|
cp -rv build/install/share $PREFIX
|
||||||
|
@ -45,6 +45,7 @@ int main() {
|
|||||||
|
|
||||||
for (const auto &cmd : commands) {
|
for (const auto &cmd : commands) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
std::cout << cmd << '\n';
|
||||||
proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os);
|
proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os);
|
||||||
|
|
||||||
auto tmp = os.str().erase(0, cmd.size());
|
auto tmp = os.str().erase(0, cmd.size());
|
||||||
|
@ -136,7 +136,7 @@ can use dir()
|
|||||||
'__str__', '__subclasshook__', '_adc_register', '_frozen',
|
'__str__', '__subclasshook__', '_adc_register', '_frozen',
|
||||||
'_register', 'acquire', 'adcclk', 'adcphase', 'adcpipeline',
|
'_register', 'acquire', 'adcclk', 'adcphase', 'adcpipeline',
|
||||||
'adcreg', 'asamples', 'auto_comp_disable', 'clearAcquiringFlag',
|
'adcreg', 'asamples', 'auto_comp_disable', 'clearAcquiringFlag',
|
||||||
'clearBit', 'clearROI', 'client_version', 'config', 'copyDetectorServer',
|
'clearBit', 'clearROI', 'client_version', 'config',
|
||||||
'counters', 'daclist', 'dacvalues', 'dbitclk', 'dbitphase' ...
|
'counters', 'daclist', 'dacvalues', 'dbitclk', 'dbitphase' ...
|
||||||
|
|
||||||
Since the list for Detector is rather long it's an good idea to filter it.
|
Since the list for Detector is rather long it's an good idea to filter it.
|
||||||
|
@ -5,17 +5,42 @@ Detector Server Upgrade
|
|||||||
|
|
||||||
**Location:** slsDetectorPackage/serverBin/ folder for every release.
|
**Location:** slsDetectorPackage/serverBin/ folder for every release.
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
For Mythen3, Gotthard2 and Eiger, you need to add scripts to automatically start detector server upon power on. See :ref:`Automatic start<Automatic start servers>` for more details.
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
Eiger requires a manual reboot. Or killall the servers and restart the new linked one. If you are in the process of updating firmware, then don't reboot yet.
|
||||||
|
|
||||||
|
|
||||||
|
From 6.1.1 and above (no tftp required)
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
#. Program from console
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# the following command copies new server, creates a soft link to xxxDetectorServerxxx
|
||||||
|
# [Jungfrau][CTB][Moench] also deletes the old server binary and edits initttab to respawn server on reboot
|
||||||
|
# Then, the detector controller will reboot (except Eiger)
|
||||||
|
sls_detector_put updatedetectorserver /complete-path-to-binary/xxxDetectorServerxxx
|
||||||
|
|
||||||
|
#. Copy the detector server specific config files or any others required to the detector:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
||||||
|
|
||||||
|
5.0.0 - 6.1.1
|
||||||
|
--------------
|
||||||
|
|
||||||
#. Install tftp and copy detector server binary to tftp folder
|
#. Install tftp and copy detector server binary to tftp folder
|
||||||
#. Program from console
|
#. Program from console
|
||||||
|
|
||||||
.. note ::
|
|
||||||
|
|
||||||
These instructions are for upgrades from v5.0.0. For earlier versions, contact us.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# copies new server from pc tftp folder, creates a soft link to xxxDetectorServerxxx
|
# the following command copies new server from pc tftp folder, creates a soft link to xxxDetectorServerxxx
|
||||||
# [Jungfrau][CTB][Moench] also edits initttab to respawn server on reboot
|
# [Jungfrau][CTB][Moench] also edits initttab to respawn server on reboot
|
||||||
# Then, the detector controller will reboot (except Eiger)
|
# Then, the detector controller will reboot (except Eiger)
|
||||||
sls_detector_put copydetectorserver xxxDetectorServerxxx pcxxx
|
sls_detector_put copydetectorserver xxxDetectorServerxxx pcxxx
|
||||||
@ -27,18 +52,15 @@ Detector Server Upgrade
|
|||||||
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
||||||
|
|
||||||
|
|
||||||
.. note ::
|
Troubleshooting with tftp
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
For Mythen3, Gotthard2 and Eiger, you need to add scripts to automatically start detector server upon power on. See :ref:`Automatic start<Automatic start servers>` for more details.
|
|
||||||
|
|
||||||
.. note ::
|
|
||||||
|
|
||||||
Eiger requires a manual reboot. Or killall the servers and restart the new linked one. If you are in the process of updating firmware, then don't reboot yet.
|
|
||||||
|
|
||||||
|
|
||||||
Errors
|
|
||||||
------
|
|
||||||
|
|
||||||
#. tftp write error: There is no space left. Please delete some old binaries and try again.
|
#. tftp write error: There is no space left. Please delete some old binaries and try again.
|
||||||
|
|
||||||
#. text file busy: You are trying to copy the same server.
|
#. text file busy: You are trying to copy the same server.
|
||||||
|
|
||||||
|
|
||||||
|
Older than 5.0.0
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Please contact us.
|
@ -6,6 +6,8 @@
|
|||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class MultiDetectorFixture {
|
class MultiDetectorFixture {
|
||||||
protected:
|
protected:
|
||||||
DetectorImpl d;
|
DetectorImpl d;
|
||||||
@ -136,7 +138,7 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Get ID", "[.eigerintegration][cli]") {
|
|||||||
std::string hn = test::hostname;
|
std::string hn = test::hostname;
|
||||||
hn.erase(std::remove(begin(hn), end(hn), 'b'), end(hn));
|
hn.erase(std::remove(begin(hn), end(hn), 'b'), end(hn));
|
||||||
hn.erase(std::remove(begin(hn), end(hn), 'e'), end(hn));
|
hn.erase(std::remove(begin(hn), end(hn), 'e'), end(hn));
|
||||||
auto hostnames = sls::split(hn, '+');
|
auto hostnames = split(hn, '+');
|
||||||
CHECK(hostnames.size() == d.getNumberOfDetectors());
|
CHECK(hostnames.size() == d.getNumberOfDetectors());
|
||||||
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
|
for (int i = 0; i != d.getNumberOfDetectors(); ++i) {
|
||||||
CHECK(d.getId(defs::DETECTOR_SERIAL_NUMBER, 0) ==
|
CHECK(d.getId(defs::DETECTOR_SERIAL_NUMBER, 0) ==
|
||||||
@ -198,3 +200,5 @@ TEST_CASE_METHOD(MultiDetectorFixture, "rate correction",
|
|||||||
d.setRateCorrection(200);
|
d.setRateCorrection(200);
|
||||||
CHECK(d.getRateCorrection() == 200);
|
CHECK(d.getRateCorrection() == 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
// extern std::string detector_type;
|
// extern std::string detector_type;
|
||||||
// extern dt type;
|
// extern dt type;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
TEST_CASE("Single detector no receiver", "[.integration][.single]") {
|
TEST_CASE("Single detector no receiver", "[.integration][.single]") {
|
||||||
auto t = Module::getTypeFromDetector(test::hostname);
|
auto t = Module::getTypeFromDetector(test::hostname);
|
||||||
CHECK(t == test::type);
|
CHECK(t == test::type);
|
||||||
@ -283,14 +285,14 @@ TEST_CASE(
|
|||||||
CHECK(m.getRateCorrection() == ratecorr);
|
CHECK(m.getRateCorrection() == ratecorr);
|
||||||
|
|
||||||
// ratecorr fail with dr 4 or 8
|
// ratecorr fail with dr 4 or 8
|
||||||
CHECK_THROWS_AS(m.setDynamicRange(8), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setDynamicRange(8), RuntimeError);
|
||||||
CHECK(m.getRateCorrection() == 0);
|
CHECK(m.getRateCorrection() == 0);
|
||||||
m.setDynamicRange(16);
|
m.setDynamicRange(16);
|
||||||
m.setDynamicRange(16);
|
m.setDynamicRange(16);
|
||||||
m.setRateCorrection(ratecorr);
|
m.setRateCorrection(ratecorr);
|
||||||
m.setDynamicRange(16);
|
m.setDynamicRange(16);
|
||||||
m.setRateCorrection(ratecorr);
|
m.setRateCorrection(ratecorr);
|
||||||
CHECK_THROWS_AS(m.setDynamicRange(4), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setDynamicRange(4), RuntimeError);
|
||||||
CHECK(m.getRateCorrection() == 0);
|
CHECK(m.getRateCorrection() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,11 +331,11 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
|||||||
m.setPatternWord(addr, word);
|
m.setPatternWord(addr, word);
|
||||||
CHECK(m.setPatternWord(addr, -1) == word);
|
CHECK(m.setPatternWord(addr, -1) == word);
|
||||||
addr = MAX_ADDR;
|
addr = MAX_ADDR;
|
||||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setPatternWord(addr, word), RuntimeError);
|
||||||
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
||||||
Catch::Matchers::Contains("be between 0 and"));
|
Catch::Matchers::Contains("be between 0 and"));
|
||||||
addr = -1;
|
addr = -1;
|
||||||
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setPatternWord(addr, word), RuntimeError);
|
||||||
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
CHECK_THROWS_WITH(m.setPatternWord(addr, word),
|
||||||
Catch::Matchers::Contains("be between 0 and"));
|
Catch::Matchers::Contains("be between 0 and"));
|
||||||
|
|
||||||
@ -408,7 +410,7 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
|
|||||||
CHECK(m.getReceiverDbitList().size() == 10);
|
CHECK(m.getReceiverDbitList().size() == 10);
|
||||||
|
|
||||||
list.push_back(64);
|
list.push_back(64);
|
||||||
CHECK_THROWS_AS(m.setReceiverDbitList(list), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setReceiverDbitList(list), RuntimeError);
|
||||||
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
|
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
|
||||||
Catch::Matchers::Contains("be between 0 and 63"));
|
Catch::Matchers::Contains("be between 0 and 63"));
|
||||||
|
|
||||||
@ -476,7 +478,7 @@ TEST_CASE("Eiger or Jungfrau nextframenumber",
|
|||||||
CHECK(m.acquire() == slsDetectorDefs::OK);
|
CHECK(m.acquire() == slsDetectorDefs::OK);
|
||||||
CHECK(m.getReceiverCurrentFrameIndex() == val);
|
CHECK(m.getReceiverCurrentFrameIndex() == val);
|
||||||
|
|
||||||
CHECK_THROWS_AS(m.setNextFrameNumber(0), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setNextFrameNumber(0), RuntimeError);
|
||||||
|
|
||||||
if (m.getDetectorTypeAsString() == "Eiger") {
|
if (m.getDetectorTypeAsString() == "Eiger") {
|
||||||
val = 281474976710655;
|
val = 281474976710655;
|
||||||
@ -511,8 +513,10 @@ TEST_CASE("Eiger partialread", "[.eigerintegration][partialread]") {
|
|||||||
m.setDynamicRange(8);
|
m.setDynamicRange(8);
|
||||||
m.setPartialReadout(256);
|
m.setPartialReadout(256);
|
||||||
CHECK(m.getPartialReadout() == 256);
|
CHECK(m.getPartialReadout() == 256);
|
||||||
CHECK_THROWS_AS(m.setPartialReadout(1), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setPartialReadout(1), RuntimeError);
|
||||||
CHECK(m.getPartialReadout() == 256);
|
CHECK(m.getPartialReadout() == 256);
|
||||||
CHECK_THROWS_AS(m.setPartialReadout(0), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setPartialReadout(0), RuntimeError);
|
||||||
m.setPartialReadout(256);
|
m.setPartialReadout(256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
using namespace Catch::literals;
|
using namespace Catch::literals;
|
||||||
|
|
||||||
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||||
auto hostnames = sls::split(test::hostname, '+');
|
auto hostnames = split(test::hostname, '+');
|
||||||
|
|
||||||
DetectorImpl d(0, true, true);
|
DetectorImpl d(0, true, true);
|
||||||
d.setHostname(test::hostname.c_str());
|
d.setHostname(test::hostname.c_str());
|
||||||
@ -102,3 +104,6 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
|||||||
|
|
||||||
d.freeSharedMemory();
|
d.freeSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
|
||||||
|
Submodule libs/pybind11 updated: 8de7772cc7...914c06fb25
@ -1,27 +0,0 @@
|
|||||||
#From: https://github.com/zeromq/cppzmq/
|
|
||||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
|
||||||
find_package(PkgConfig)
|
|
||||||
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
|
||||||
|
|
||||||
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
|
||||||
find_library(ZeroMQ_LIBRARY NAMES libzmq.so libzmq.dylib libzmq.dll
|
|
||||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
|
||||||
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq-static.a libzmq.a libzmq.dll.a
|
|
||||||
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
|
||||||
|
|
||||||
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
|
|
||||||
set(ZeroMQ_FOUND ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (TARGET libzmq)
|
|
||||||
# avoid errors defining targets twice
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(libzmq SHARED IMPORTED)
|
|
||||||
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
|
||||||
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
|
|
||||||
|
|
||||||
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
|
|
||||||
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
|
||||||
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})
|
|
@ -6,49 +6,57 @@ sls::Detector class. The tool needs the libclang bindings
|
|||||||
to be installed.
|
to be installed.
|
||||||
|
|
||||||
When the Detector API is updated this file should be run
|
When the Detector API is updated this file should be run
|
||||||
manually
|
manually.
|
||||||
"""
|
"""
|
||||||
from clang import cindex
|
from clang import cindex
|
||||||
import subprocess
|
import subprocess
|
||||||
import argparse
|
import argparse
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
from parse import system_include_paths, clang_format_version
|
||||||
|
|
||||||
|
REDC = '\033[91m'
|
||||||
|
GREENC = '\033[92m'
|
||||||
|
ENDC = '\033[0m'
|
||||||
|
def red(msg):
|
||||||
|
return f'{REDC}{msg}{ENDC}'
|
||||||
|
|
||||||
|
def green(msg):
|
||||||
|
return f'{GREENC}{msg}{ENDC}'
|
||||||
|
|
||||||
|
def check_clang_format_version(required_version):
|
||||||
|
if (ver := clang_format_version()) != required_version:
|
||||||
|
msg = red(f'Clang format version {required_version} required, detected: {ver}. Bye!')
|
||||||
|
print(msg)
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
msg = green(f'Found clang-format version {ver}')
|
||||||
|
print(msg)
|
||||||
|
|
||||||
|
def check_for_compile_commands_json(path):
|
||||||
|
# print(f"Looking for compile data base in: {path}")
|
||||||
|
compile_data_base_file = path/'compile_commands.json'
|
||||||
|
if not compile_data_base_file.exists():
|
||||||
|
msg = red(f"No compile_commands.json file found in {path}. Bye!")
|
||||||
|
print(msg)
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
msg = green(f'Found: {compile_data_base_file}')
|
||||||
|
print(msg)
|
||||||
|
|
||||||
from parse import system_include_paths
|
|
||||||
|
|
||||||
default_build_path = "/home/l_frojdh/sls/build/"
|
default_build_path = "/home/l_frojdh/sls/build/"
|
||||||
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
|
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument(
|
|
||||||
"-p",
|
|
||||||
"--build_path",
|
|
||||||
help="Path to the build database",
|
|
||||||
type=str,
|
|
||||||
default=default_build_path,
|
|
||||||
)
|
|
||||||
cargs = parser.parse_args()
|
|
||||||
|
|
||||||
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
|
|
||||||
index = cindex.Index.create()
|
|
||||||
args = db.getCompileCommands(fpath)
|
|
||||||
args = list(iter(args).__next__().arguments)[0:-1]
|
|
||||||
args = args + "-x c++ --std=c++11".split()
|
|
||||||
syspath = system_include_paths("clang++")
|
|
||||||
incargs = ["-I" + inc for inc in syspath]
|
|
||||||
args = args + incargs
|
|
||||||
|
|
||||||
|
|
||||||
tu = index.parse(fpath, args=args)
|
|
||||||
|
|
||||||
|
|
||||||
m = []
|
m = []
|
||||||
ag = []
|
ag = []
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
ag2 = []
|
ag2 = []
|
||||||
|
|
||||||
cn = []
|
cn = []
|
||||||
|
|
||||||
def get_arguments(node):
|
def get_arguments(node):
|
||||||
@ -66,7 +74,7 @@ def get_arguments_with_default(node):
|
|||||||
args = []
|
args = []
|
||||||
for arg in node.get_arguments():
|
for arg in node.get_arguments():
|
||||||
tokens = [t.spelling for t in arg.get_tokens()]
|
tokens = [t.spelling for t in arg.get_tokens()]
|
||||||
print(tokens)
|
# print(tokens)
|
||||||
if '=' in tokens:
|
if '=' in tokens:
|
||||||
if arg.type.spelling == "sls::Positions": #TODO! automate
|
if arg.type.spelling == "sls::Positions": #TODO! automate
|
||||||
args.append("py::arg() = Positions{}")
|
args.append("py::arg() = Positions{}")
|
||||||
@ -111,33 +119,67 @@ def visit(node):
|
|||||||
lines.append(
|
lines.append(
|
||||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||||
)
|
)
|
||||||
|
if cargs.verbose:
|
||||||
|
print(f'&Detector::{child.spelling}{args})')
|
||||||
cn.append(child)
|
cn.append(child)
|
||||||
for child in node.get_children():
|
for child in node.get_children():
|
||||||
visit(child)
|
visit(child)
|
||||||
|
|
||||||
# .def("setRxHostname",
|
|
||||||
# (void (Detector::*)(const std::string &, Positions)) &
|
|
||||||
# Detector::setRxHostname,
|
|
||||||
# py::arg(), py::arg() = Positions{})
|
|
||||||
# .def("setRxHostname",
|
|
||||||
# (void (Detector::*)(const std::vector<std::string> &)) &
|
|
||||||
# Detector::setRxHostname,
|
|
||||||
# py::arg())
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
"-p",
|
||||||
|
"--build_path",
|
||||||
|
help="Path to the build database",
|
||||||
|
type=Path,
|
||||||
|
default=default_build_path,
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-v",
|
||||||
|
"--verbose",
|
||||||
|
help="more output",
|
||||||
|
action='store_true',
|
||||||
|
)
|
||||||
|
cargs = parser.parse_args()
|
||||||
|
|
||||||
visit(tu.cursor)
|
check_clang_format_version(12)
|
||||||
|
check_for_compile_commands_json(cargs.build_path)
|
||||||
|
|
||||||
|
print("Parsing functions in Detector.h - ", end = "", flush = True)
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
#parse functions
|
||||||
|
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
|
||||||
|
index = cindex.Index.create()
|
||||||
|
args = db.getCompileCommands(fpath)
|
||||||
|
args = list(iter(args).__next__().arguments)[0:-1]
|
||||||
|
args = args + "-x c++ --std=c++11".split()
|
||||||
|
syspath = system_include_paths("clang++")
|
||||||
|
incargs = ["-I" + inc for inc in syspath]
|
||||||
|
args = args + incargs
|
||||||
|
tu = index.parse(fpath, args=args)
|
||||||
|
visit(tu.cursor)
|
||||||
|
print(green('OK'))
|
||||||
|
print(f'Parsing took {time.perf_counter()-t0:.3f}s')
|
||||||
|
|
||||||
with open("../src/detector_in.cpp") as f:
|
print("Read detector_in.cpp - ", end = "")
|
||||||
data = f.read()
|
with open("../src/detector_in.cpp") as f:
|
||||||
s = "".join(lines)
|
data = f.read()
|
||||||
s += ";"
|
s = "".join(lines)
|
||||||
text = data.replace("[[FUNCTIONS]]", s)
|
s += ";"
|
||||||
warning = "/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n"
|
text = data.replace("[[FUNCTIONS]]", s)
|
||||||
with open("../src/detector.cpp", "w") as f:
|
warning = "/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n"
|
||||||
f.write(warning)
|
print(green("OK"))
|
||||||
f.write(text)
|
print("Writing to detector.cpp - ", end = "")
|
||||||
|
with open("../src/detector.cpp", "w") as f:
|
||||||
|
f.write(warning)
|
||||||
|
f.write(text)
|
||||||
|
print(green('OK'))
|
||||||
|
|
||||||
# run clang format on the output
|
# run clang format on the output
|
||||||
subprocess.run(["clang-format", "../src/detector.cpp", "-i"])
|
print('Running clang format on generated source -', end = "")
|
||||||
|
subprocess.run(["clang-format", "../src/detector.cpp", "-i"])
|
||||||
|
print(green(" OK"))
|
||||||
|
|
||||||
|
print("Changes since last commit:")
|
||||||
|
subprocess.run(['git', 'diff', '../src/detector.cpp'])
|
||||||
|
@ -5,6 +5,12 @@ import subprocess
|
|||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
def clang_format_version():
|
||||||
|
p = subprocess.run(['clang-format', '--version'], capture_output = True)
|
||||||
|
ver = p.stdout.decode().split()[2]
|
||||||
|
major = int(ver.split('.')[0])
|
||||||
|
return major
|
||||||
|
|
||||||
|
|
||||||
def remove_comments(text):
|
def remove_comments(text):
|
||||||
def replacer(match):
|
def replacer(match):
|
||||||
|
@ -1,43 +1,45 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
from .detector import Detector
|
from .detector import Detector, freeze
|
||||||
from .utils import element_if_equal
|
from .utils import element_if_equal
|
||||||
from .dacs import DetectorDacs
|
from .dacs import DetectorDacs, NamedDacs
|
||||||
import _slsdet
|
import _slsdet
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
class CtbDacs(DetectorDacs):
|
# class CtbDacs(DetectorDacs):
|
||||||
"""
|
# """
|
||||||
Ctb dacs
|
# Ctb dacs
|
||||||
"""
|
# """
|
||||||
_dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
|
# _dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
|
||||||
('dac1', dacIndex(1), 0, 4000, 1200),
|
# ('dac1', dacIndex(1), 0, 4000, 1200),
|
||||||
('dac2', dacIndex(2), 0, 4000, 900),
|
# ('dac2', dacIndex(2), 0, 4000, 900),
|
||||||
('dac3', dacIndex(3), 0, 4000, 1050),
|
# ('dac3', dacIndex(3), 0, 4000, 1050),
|
||||||
('dac4', dacIndex(4), 0, 4000, 1400),
|
# ('dac4', dacIndex(4), 0, 4000, 1400),
|
||||||
('dac5', dacIndex(5), 0, 4000, 655),
|
# ('dac5', dacIndex(5), 0, 4000, 655),
|
||||||
('dac6', dacIndex(6), 0, 4000, 2000),
|
# ('dac6', dacIndex(6), 0, 4000, 2000),
|
||||||
('dac7', dacIndex(7), 0, 4000, 1400),
|
# ('dac7', dacIndex(7), 0, 4000, 1400),
|
||||||
('dac8', dacIndex(8), 0, 4000, 850),
|
# ('dac8', dacIndex(8), 0, 4000, 850),
|
||||||
('dac9', dacIndex(9), 0, 4000, 2000),
|
# ('dac9', dacIndex(9), 0, 4000, 2000),
|
||||||
('dac10', dacIndex(10), 0, 4000, 2294),
|
# ('dac10', dacIndex(10), 0, 4000, 2294),
|
||||||
('dac11', dacIndex(11), 0, 4000, 983),
|
# ('dac11', dacIndex(11), 0, 4000, 983),
|
||||||
('dac12', dacIndex(12), 0, 4000, 1475),
|
# ('dac12', dacIndex(12), 0, 4000, 1475),
|
||||||
('dac13', dacIndex(13), 0, 4000, 1200),
|
# ('dac13', dacIndex(13), 0, 4000, 1200),
|
||||||
('dac14', dacIndex(14), 0, 4000, 1600),
|
# ('dac14', dacIndex(14), 0, 4000, 1600),
|
||||||
('dac15', dacIndex(15), 0, 4000, 1455),
|
# ('dac15', dacIndex(15), 0, 4000, 1455),
|
||||||
('dac16', dacIndex(16), 0, 4000, 0),
|
# ('dac16', dacIndex(16), 0, 4000, 0),
|
||||||
('dac17', dacIndex(17), 0, 4000, 1000),
|
# ('dac17', dacIndex(17), 0, 4000, 1000),
|
||||||
]
|
# ]
|
||||||
_dacnames = [_d[0] for _d in _dacs]
|
# _dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
from .utils import element
|
from .utils import element
|
||||||
|
@freeze
|
||||||
class Ctb(Detector):
|
class Ctb(Detector):
|
||||||
def __init__(self, id = 0):
|
def __init__(self, id = 0):
|
||||||
super().__init__(id)
|
super().__init__(id)
|
||||||
self._frozen = False
|
self._frozen = False
|
||||||
self._dacs = CtbDacs(self)
|
# self._dacs = CtbDacs(self)
|
||||||
|
self._dacs = NamedDacs(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dacs(self):
|
def dacs(self):
|
||||||
|
@ -36,6 +36,79 @@ class Dac(DetectorProperty):
|
|||||||
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
||||||
return f'{self.__name__:15s}:{dacstr}'
|
return f'{self.__name__:15s}:{dacstr}'
|
||||||
|
|
||||||
|
class NamedDacs:
|
||||||
|
"""
|
||||||
|
New implementation of the detector dacs. Used at the momen for
|
||||||
|
Ctb but should replace the old one for all detectors
|
||||||
|
"""
|
||||||
|
_frozen = False
|
||||||
|
_direct_access = ['_detector', '_current', '_dacnames']
|
||||||
|
def __init__(self, detector):
|
||||||
|
self._detector = detector
|
||||||
|
self._current = 0
|
||||||
|
|
||||||
|
self._dacnames = [n.replace(" ", "") for n in detector.getDacNames()]
|
||||||
|
# # Populate the dacs
|
||||||
|
for i,name in enumerate(self._dacnames):
|
||||||
|
#name, enum, low, high, default, detector
|
||||||
|
setattr(self, name, Dac(name, dacIndex(i), 0, 4000, 1000, detector))
|
||||||
|
|
||||||
|
self._frozen = True
|
||||||
|
|
||||||
|
# def __getattr__(self, name):
|
||||||
|
# return self.__getattribute__('_' + name)
|
||||||
|
|
||||||
|
def __setattr__(self, name, value):
|
||||||
|
if not self._frozen:
|
||||||
|
#durining init we need to be able to set up the class
|
||||||
|
super().__setattr__(name, value)
|
||||||
|
else:
|
||||||
|
#Later we restrict us to manipulate dacs and a few fields
|
||||||
|
if name in self._direct_access:
|
||||||
|
super().__setattr__(name, value)
|
||||||
|
elif name in self._dacnames:
|
||||||
|
return self.__getattribute__(name).__setitem__(slice(None, None, None), value)
|
||||||
|
else:
|
||||||
|
raise AttributeError(f'Dac not found: {name}')
|
||||||
|
|
||||||
|
def __next__(self):
|
||||||
|
if self._current >= len(self._dacnames):
|
||||||
|
self._current = 0
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
self._current += 1
|
||||||
|
return self.__getattribute__(self._dacnames[self._current-1])
|
||||||
|
# return self.__getattr__(self._dacnames[self._current-1])
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
r_str = ['========== DACS =========']
|
||||||
|
r_str += [repr(dac) for dac in self]
|
||||||
|
return '\n'.join(r_str)
|
||||||
|
def get_asarray(self):
|
||||||
|
"""
|
||||||
|
Read the dacs into a numpy array with dimensions [ndacs, nmodules]
|
||||||
|
"""
|
||||||
|
dac_array = np.zeros((len(self._dacnames), len(self._detector)))
|
||||||
|
for i, _d in enumerate(self):
|
||||||
|
dac_array[i,:] = _d[:]
|
||||||
|
return dac_array
|
||||||
|
|
||||||
|
def to_array(self):
|
||||||
|
return self.get_asarray()
|
||||||
|
|
||||||
|
def set_from_array(self, dac_array):
|
||||||
|
"""
|
||||||
|
Set the dacs from an numpy array with dac values. [ndacs, nmodules]
|
||||||
|
"""
|
||||||
|
dac_array = dac_array.astype(np.int)
|
||||||
|
for i, _d in enumerate(self):
|
||||||
|
_d[:] = dac_array[i]
|
||||||
|
|
||||||
|
def from_array(self, dac_array):
|
||||||
|
self.set_from_array(dac_array)
|
||||||
|
|
||||||
class DetectorDacs:
|
class DetectorDacs:
|
||||||
_dacs = []
|
_dacs = []
|
||||||
@ -50,7 +123,7 @@ class DetectorDacs:
|
|||||||
# Index to support iteration
|
# Index to support iteration
|
||||||
self._current = 0
|
self._current = 0
|
||||||
|
|
||||||
# Populate the dacs
|
# Name the attributes?
|
||||||
for _d in self._dacs:
|
for _d in self._dacs:
|
||||||
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
||||||
|
|
||||||
@ -59,6 +132,9 @@ class DetectorDacs:
|
|||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return self.__getattribute__('_' + name)
|
return self.__getattribute__('_' + name)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dacnames(self):
|
||||||
|
return [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
if name in self._dacnames:
|
if name in self._dacnames:
|
||||||
|
@ -287,7 +287,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
|
[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
|
||||||
[Mythen3] Options: 8, 16, 32 \n
|
[Mythen3] Options: 8, 16, 32 \n
|
||||||
[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
|
[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
|
||||||
"""
|
"""
|
||||||
@ -599,7 +599,7 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def rx_framescaught(self):
|
def rx_framescaught(self):
|
||||||
"""Number of frames caught by receiver."""
|
"""Number of frames caught by each port in receiver."""
|
||||||
return self.getFramesCaught()
|
return self.getFramesCaught()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1442,20 +1442,21 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
def trimbits(self):
|
def trimbits(self):
|
||||||
"""
|
"""
|
||||||
[Eiger][Mythen3] Loads custom trimbit file to detector.
|
[Eiger][Mythen3] Loads/Saves custom trimbit file to detector.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
If no extension specified, serial number of each module is attached.
|
If no extension specified, serial number of each module is attached.
|
||||||
|
|
||||||
:getter: Not implemented
|
:setter: Loads the trimbit file to detector
|
||||||
|
:getter: Saves the trimbits from the detector to file. Not implemented with 'trimbits'. Use saveTrimbits().
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-------
|
-------
|
||||||
>>> d.trimbits = '/path_to_file/noise'
|
>>> d.trimbits = '/path_to_file/noise'
|
||||||
- 14:53:27.931 INFO: Settings file loaded: /path_to_file/noise.sn000
|
- 14:53:27.931 INFO: Settings file loaded: /path_to_file/noise.sn000
|
||||||
"""
|
"""
|
||||||
return NotImplementedError("trimbits are set only")
|
raise NotImplementedError('trimbits is set only. Use saveTrimbits()')
|
||||||
|
|
||||||
@trimbits.setter
|
@trimbits.setter
|
||||||
def trimbits(self, fname):
|
def trimbits(self, fname):
|
||||||
@ -1474,6 +1475,19 @@ class Detector(CppDetectorApi):
|
|||||||
def trimval(self, value):
|
def trimval(self, value):
|
||||||
ut.set_using_dict(self.setAllTrimbits, value)
|
ut.set_using_dict(self.setAllTrimbits, value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def master(self):
|
||||||
|
"""
|
||||||
|
[Eiger] Sets half module to master and others to slaves.\n
|
||||||
|
[Gotthard][Gotthard2][Mythen3][Eiger] Gets if the current module/ half module is master.
|
||||||
|
"""
|
||||||
|
return self.getMaster()
|
||||||
|
|
||||||
|
@master.setter
|
||||||
|
def master(self, value):
|
||||||
|
ut.set_using_dict(self.setMaster, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def lock(self):
|
def lock(self):
|
||||||
@ -1558,8 +1572,16 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def daclist(self):
|
def daclist(self):
|
||||||
"""Gets the list of enums for every dac for this detector."""
|
"""
|
||||||
return self.getDacList()
|
List of enums for every dac for this detector.
|
||||||
|
:setter: Only implemented for Chiptestboard
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.getDacNames()
|
||||||
|
|
||||||
|
@daclist.setter
|
||||||
|
def daclist(self, value):
|
||||||
|
self.setDacNames(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dacvalues(self):
|
def dacvalues(self):
|
||||||
@ -1812,13 +1834,13 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def threshold(self):
|
def threshold(self):
|
||||||
"""[Eiger] Threshold in eV
|
"""[Eiger][Mythen3] Threshold in eV
|
||||||
|
|
||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
To change settings as well or set threshold without trimbits, use setThresholdEnergy.
|
To change settings as well or set threshold without trimbits, use setThresholdEnergy.
|
||||||
|
|
||||||
:setter: It loads trim files from settingspath.
|
:setter: It loads trim files from settingspath.\n [Mythen3] An energy of -1 will pick up values from detector.
|
||||||
"""
|
"""
|
||||||
if self.type == detectorType.MYTHEN3:
|
if self.type == detectorType.MYTHEN3:
|
||||||
return self.getAllThresholdEnergy()
|
return self.getAllThresholdEnergy()
|
||||||
@ -1905,7 +1927,7 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def rx_frameindex(self):
|
def rx_frameindex(self):
|
||||||
"""Current frame index received in receiver during acquisition."""
|
"""Current frame index received for each port in receiver during acquisition."""
|
||||||
return self.getRxCurrentFrameIndex()
|
return self.getRxCurrentFrameIndex()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -2126,6 +2148,21 @@ class Detector(CppDetectorApi):
|
|||||||
"""
|
"""
|
||||||
return ut.reduce_time(self.getMeasuredSubFramePeriod())
|
return ut.reduce_time(self.getMeasuredSubFramePeriod())
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def top(self):
|
||||||
|
"""[Eiger] Sets half module to top (1), else bottom.
|
||||||
|
|
||||||
|
Note
|
||||||
|
-----
|
||||||
|
Advanced Function!
|
||||||
|
"""
|
||||||
|
return self.getTop()
|
||||||
|
|
||||||
|
@top.setter
|
||||||
|
def top(self, value):
|
||||||
|
ut.set_using_dict(self.setTop, value)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
------------------<<<Jungfrau specific>>>-------------------------
|
------------------<<<Jungfrau specific>>>-------------------------
|
||||||
"""
|
"""
|
||||||
@ -2581,7 +2618,7 @@ class Detector(CppDetectorApi):
|
|||||||
-------
|
-------
|
||||||
>>> d.vetophoton = (2, 24, 2560, '/tmp/bla.txt')
|
>>> d.vetophoton = (2, 24, 2560, '/tmp/bla.txt')
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError('vetofile is set only')
|
raise NotImplementedError('vetophoton is set only')
|
||||||
|
|
||||||
@vetophoton.setter
|
@vetophoton.setter
|
||||||
def vetophoton(self, args):
|
def vetophoton(self, args):
|
||||||
@ -3462,10 +3499,60 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
def readout(self):
|
def readout(self):
|
||||||
"""
|
"""
|
||||||
Mythen3] Starts detector readout. Status changes to TRANSMITTING and automatically returns to idle at the end of readout.
|
[Mythen3] Starts detector readout. Status changes to TRANSMITTING and automatically returns to idle at the end of readout.
|
||||||
"""
|
"""
|
||||||
self.startDetectorReadout()
|
self.startDetectorReadout()
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def polarity(self):
|
||||||
|
"""[Mythen3] Set positive or negative polarity. Enum: polarity"""
|
||||||
|
return self.getPolarity()
|
||||||
|
|
||||||
|
@polarity.setter
|
||||||
|
def polarity(self, value):
|
||||||
|
ut.set_using_dict(self.setPolarity, value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def interpolation(self):
|
||||||
|
"""[Mythen3] Enable or disable interpolation. interpolation mode enables all counters and disables vth3. Disabling sets back counter mask and vth3. """
|
||||||
|
return self.getInterpolation()
|
||||||
|
|
||||||
|
@interpolation.setter
|
||||||
|
def interpolation(self, value):
|
||||||
|
ut.set_using_dict(self.setInterpolation, value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def pumpprobe(self):
|
||||||
|
"""[Mythen3] Enable or disable pump probe mode. Pump probe mode only enables vth2. Disabling sets back to previous value """
|
||||||
|
return self.getPumpProbe()
|
||||||
|
|
||||||
|
@pumpprobe.setter
|
||||||
|
def pumpprobe(self, value):
|
||||||
|
ut.set_using_dict(self.setPumpProbe, value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def apulse(self):
|
||||||
|
"""[Mythen3] Enable or disable analog pulsing. """
|
||||||
|
return self.getAnalogPulsing()
|
||||||
|
|
||||||
|
@apulse.setter
|
||||||
|
def apulse(self, value):
|
||||||
|
ut.set_using_dict(self.setAnalogPulsing, value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def dpulse(self):
|
||||||
|
"""[Mythen3] Enable or disable digital pulsing. """
|
||||||
|
return self.getDigitalPulsing()
|
||||||
|
|
||||||
|
@dpulse.setter
|
||||||
|
def dpulse(self, value):
|
||||||
|
ut.set_using_dict(self.setDigitalPulsing, value)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
---------------------------<<<Debug>>>---------------------------
|
---------------------------<<<Debug>>>---------------------------
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
/* WARINING This file is auto generated any edits might be overwritten without
|
/* WARINING This file is auto generated any edits might be overwritten without
|
||||||
* warning */
|
* warning */
|
||||||
|
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include <pybind11/chrono.h>
|
#include <pybind11/chrono.h>
|
||||||
#include <pybind11/operators.h>
|
#include <pybind11/operators.h>
|
||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
@ -144,6 +144,10 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
Detector::loadTrimbits,
|
Detector::loadTrimbits,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("saveTrimbits",
|
||||||
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
|
Detector::saveTrimbits,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getAllTrimbits",
|
.def("getAllTrimbits",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getAllTrimbits,
|
Detector::getAllTrimbits,
|
||||||
@ -173,6 +177,12 @@ void init_det(py::module &m) {
|
|||||||
.def("setFlipRows",
|
.def("setFlipRows",
|
||||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getMaster",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getMaster,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setMaster", (void (Detector::*)(bool, int)) & Detector::setMaster,
|
||||||
|
py::arg(), py::arg())
|
||||||
.def("isVirtualDetectorServer",
|
.def("isVirtualDetectorServer",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::isVirtualDetectorServer,
|
Detector::isVirtualDetectorServer,
|
||||||
@ -181,12 +191,12 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(void (*)(double, int, void *), void *)) &
|
(void (Detector::*)(void (*)(double, int, void *), void *)) &
|
||||||
Detector::registerAcquisitionFinishedCallback,
|
Detector::registerAcquisitionFinishedCallback,
|
||||||
py::arg(), py::arg())
|
py::arg(), py::arg())
|
||||||
.def(
|
.def("registerDataCallback",
|
||||||
"registerDataCallback",
|
(void (Detector::*)(
|
||||||
(void (Detector::*)(
|
void (*)(sls::detectorData *, uint64_t, uint32_t, void *),
|
||||||
void (*)(detectorData *, uint64_t, uint32_t, void *), void *)) &
|
void *)) &
|
||||||
Detector::registerDataCallback,
|
Detector::registerDataCallback,
|
||||||
py::arg(), py::arg())
|
py::arg(), py::arg())
|
||||||
.def("getNumberOfFrames",
|
.def("getNumberOfFrames",
|
||||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNumberOfFrames,
|
Detector::getNumberOfFrames,
|
||||||
@ -487,13 +497,17 @@ void init_det(py::module &m) {
|
|||||||
Detector::getReceiverStatus,
|
Detector::getReceiverStatus,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getFramesCaught",
|
.def("getFramesCaught",
|
||||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getFramesCaught,
|
Detector::getFramesCaught,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getNumMissingPackets",
|
.def("getNumMissingPackets",
|
||||||
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNumMissingPackets,
|
Detector::getNumMissingPackets,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getRxCurrentFrameIndex",
|
||||||
|
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getRxCurrentFrameIndex,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getNextFrameNumber",
|
.def("getNextFrameNumber",
|
||||||
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNextFrameNumber,
|
Detector::getNextFrameNumber,
|
||||||
@ -766,7 +780,7 @@ void init_det(py::module &m) {
|
|||||||
Detector::getRxLastClientIP,
|
Detector::getRxLastClientIP,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getRxThreadIds",
|
.def("getRxThreadIds",
|
||||||
(Result<std::array<pid_t, 8>>(Detector::*)(sls::Positions) const) &
|
(Result<std::array<pid_t, 9>>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getRxThreadIds,
|
Detector::getRxThreadIds,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getRxArping",
|
.def("getRxArping",
|
||||||
@ -776,6 +790,15 @@ void init_det(py::module &m) {
|
|||||||
.def("setRxArping",
|
.def("setRxArping",
|
||||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setRxArping,
|
(void (Detector::*)(bool, sls::Positions)) & Detector::setRxArping,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getIndividualRxROIs",
|
||||||
|
(Result<defs::ROI>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getIndividualRxROIs,
|
||||||
|
py::arg())
|
||||||
|
.def("getRxROI", (defs::ROI(Detector::*)() const) & Detector::getRxROI)
|
||||||
|
.def("setRxROI",
|
||||||
|
(void (Detector::*)(const defs::ROI)) & Detector::setRxROI,
|
||||||
|
py::arg())
|
||||||
|
.def("clearRxROI", (void (Detector::*)()) & Detector::clearRxROI)
|
||||||
.def("getFileFormat",
|
.def("getFileFormat",
|
||||||
(Result<defs::fileFormat>(Detector::*)(sls::Positions) const) &
|
(Result<defs::fileFormat>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getFileFormat,
|
Detector::getFileFormat,
|
||||||
@ -1005,6 +1028,13 @@ void init_det(py::module &m) {
|
|||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::setDataStream,
|
Detector::setDataStream,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getTop",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getTop,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setTop",
|
||||||
|
(void (Detector::*)(bool, sls::Positions)) & Detector::setTop,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getChipVersion",
|
.def("getChipVersion",
|
||||||
(Result<double>(Detector::*)(sls::Positions) const) &
|
(Result<double>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getChipVersion,
|
Detector::getChipVersion,
|
||||||
@ -1263,10 +1293,6 @@ void init_det(py::module &m) {
|
|||||||
(Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) &
|
(Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getGateDelayForAllGates,
|
Detector::getGateDelayForAllGates,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getMaster",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getMaster,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("getChipStatusRegister",
|
.def("getChipStatusRegister",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getChipStatusRegister,
|
Detector::getChipStatusRegister,
|
||||||
@ -1277,6 +1303,46 @@ void init_det(py::module &m) {
|
|||||||
.def("getGainCaps",
|
.def("getGainCaps",
|
||||||
(Result<int>(Detector::*)(sls::Positions)) & Detector::getGainCaps,
|
(Result<int>(Detector::*)(sls::Positions)) & Detector::getGainCaps,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getPolarity",
|
||||||
|
(Result<defs::polarity>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getPolarity,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setPolarity",
|
||||||
|
(void (Detector::*)(defs::polarity, sls::Positions)) &
|
||||||
|
Detector::setPolarity,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getInterpolation",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getInterpolation,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setInterpolation",
|
||||||
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
|
Detector::setInterpolation,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getPumpProbe",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getPumpProbe,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setPumpProbe",
|
||||||
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
|
Detector::setPumpProbe,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getAnalogPulsing",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getAnalogPulsing,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setAnalogPulsing",
|
||||||
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
|
Detector::setAnalogPulsing,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getDigitalPulsing",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getDigitalPulsing,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setDigitalPulsing",
|
||||||
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
|
Detector::setDigitalPulsing,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getNumberOfAnalogSamples",
|
.def("getNumberOfAnalogSamples",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNumberOfAnalogSamples,
|
Detector::getNumberOfAnalogSamples,
|
||||||
@ -1414,6 +1480,19 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(bool, sls::Positions)) &
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
Detector::setLEDEnable,
|
Detector::setLEDEnable,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("setDacNames",
|
||||||
|
(void (Detector::*)(const std::vector<std::string>)) &
|
||||||
|
Detector::setDacNames,
|
||||||
|
py::arg())
|
||||||
|
.def("getDacNames", (std::vector<std::string>(Detector::*)() const) &
|
||||||
|
Detector::getDacNames)
|
||||||
|
.def("getDacIndex",
|
||||||
|
(defs::dacIndex(Detector::*)(const std::string &)) &
|
||||||
|
Detector::getDacIndex,
|
||||||
|
py::arg())
|
||||||
|
.def("getDacName",
|
||||||
|
(std::string(Detector::*)(defs::dacIndex)) & Detector::getDacName,
|
||||||
|
py::arg())
|
||||||
.def("setPattern",
|
.def("setPattern",
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
Detector::setPattern,
|
Detector::setPattern,
|
||||||
@ -1518,17 +1597,13 @@ void init_det(py::module &m) {
|
|||||||
Detector::setAdditionalJsonParameter,
|
Detector::setAdditionalJsonParameter,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("programFPGA",
|
.def("programFPGA",
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, const bool,
|
||||||
|
sls::Positions)) &
|
||||||
Detector::programFPGA,
|
Detector::programFPGA,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("resetFPGA",
|
.def("resetFPGA",
|
||||||
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
|
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("copyDetectorServer",
|
|
||||||
(void (Detector::*)(const std::string &, const std::string &,
|
|
||||||
sls::Positions)) &
|
|
||||||
Detector::copyDetectorServer,
|
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
|
||||||
.def("updateDetectorServer",
|
.def("updateDetectorServer",
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
Detector::updateDetectorServer,
|
Detector::updateDetectorServer,
|
||||||
@ -1540,11 +1615,6 @@ void init_det(py::module &m) {
|
|||||||
.def("rebootController",
|
.def("rebootController",
|
||||||
(void (Detector::*)(sls::Positions)) & Detector::rebootController,
|
(void (Detector::*)(sls::Positions)) & Detector::rebootController,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("updateFirmwareAndServer",
|
|
||||||
(void (Detector::*)(const std::string &, const std::string &,
|
|
||||||
const std::string &, sls::Positions)) &
|
|
||||||
Detector::updateFirmwareAndServer,
|
|
||||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
|
||||||
.def("updateFirmwareAndServer",
|
.def("updateFirmwareAndServer",
|
||||||
(void (Detector::*)(const std::string &, const std::string &,
|
(void (Detector::*)(const std::string &, const std::string &,
|
||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
@ -1555,7 +1625,7 @@ void init_det(py::module &m) {
|
|||||||
Detector::getUpdateMode,
|
Detector::getUpdateMode,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setUpdateMode",
|
.def("setUpdateMode",
|
||||||
(void (Detector::*)(bool, sls::Positions)) &
|
(void (Detector::*)(const bool, sls::Positions)) &
|
||||||
Detector::setUpdateMode,
|
Detector::setUpdateMode,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("readRegister",
|
.def("readRegister",
|
||||||
@ -1647,9 +1717,5 @@ void init_det(py::module &m) {
|
|||||||
Detector::getMeasurementTime,
|
Detector::getMeasurementTime,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getUserDetails",
|
.def("getUserDetails",
|
||||||
(std::string(Detector::*)() const) & Detector::getUserDetails)
|
(std::string(Detector::*)() const) & Detector::getUserDetails);
|
||||||
.def("getRxCurrentFrameIndex",
|
|
||||||
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getRxCurrentFrameIndex,
|
|
||||||
py::arg() = Positions{});
|
|
||||||
}
|
}
|
||||||
|
@ -315,4 +315,9 @@ void init_enums(py::module &m) {
|
|||||||
.value("FIX_G2", slsDetectorDefs::gainMode::FIX_G2)
|
.value("FIX_G2", slsDetectorDefs::gainMode::FIX_G2)
|
||||||
.value("FIX_G0", slsDetectorDefs::gainMode::FIX_G0)
|
.value("FIX_G0", slsDetectorDefs::gainMode::FIX_G0)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
|
py::enum_<slsDetectorDefs::polarity>(Defs, "polarity")
|
||||||
|
.value("POSITIVE", slsDetectorDefs::polarity::POSITIVE)
|
||||||
|
.value("NEGATIVE", slsDetectorDefs::polarity::NEGATIVE)
|
||||||
|
.export_values();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,8 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
|||||||
../dataStructures
|
../dataStructures
|
||||||
../interpolations
|
../interpolations
|
||||||
../../slsReceiverSoftware/include/
|
../../slsReceiverSoftware/include/
|
||||||
../../slsSupportLib/include/
|
../../slsSupportLib/include/
|
||||||
|
${SLS_INTERNAL_RAPIDJSON_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${exe}
|
target_link_libraries(${exe}
|
||||||
|
@ -429,23 +429,28 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
|||||||
for (ic = -(clusterSize / 2); ic < (clusterSize / 2) + 1;
|
for (ic = -(clusterSize / 2); ic < (clusterSize / 2) + 1;
|
||||||
ic++) {
|
ic++) {
|
||||||
|
|
||||||
if ((iy + ir) >= iy && (iy + ir) < ny &&
|
if ((iy + ir) >= 0 && (iy + ir) < ny &&
|
||||||
(ix + ic) >= ix && (ix + ic) < nx) {
|
(ix + ic) >= 0 && (ix + ic) < nx) {
|
||||||
|
|
||||||
|
|
||||||
|
if ((iy + ir) >= iy && (ix + ic) >= ix ) {
|
||||||
val[(iy + ir) * nx + ix + ic] =
|
val[(iy + ir) * nx + ix + ic] =
|
||||||
subtractPedestal(data, ix + ic, iy + ir, cm);
|
subtractPedestal(data, ix + ic, iy + ir, cm);
|
||||||
v = &(val[(iy + ir) * nx + ix + ic]);
|
|
||||||
tot += *v;
|
}
|
||||||
if (ir <= 0 && ic <= 0)
|
v = &(val[(iy + ir) * nx + ix + ic]);
|
||||||
bl += *v;
|
tot += *v;
|
||||||
if (ir <= 0 && ic >= 0)
|
if (ir <= 0 && ic <= 0)
|
||||||
br += *v;
|
bl += *v;
|
||||||
if (ir >= 0 && ic <= 0)
|
if (ir <= 0 && ic >= 0)
|
||||||
tl += *v;
|
br += *v;
|
||||||
if (ir >= 0 && ic >= 0)
|
if (ir >= 0 && ic <= 0)
|
||||||
tr += *v;
|
tl += *v;
|
||||||
if (*v > max) {
|
if (ir >= 0 && ic >= 0)
|
||||||
max = *v;
|
tr += *v;
|
||||||
}
|
if (*v > max) //{
|
||||||
|
max = *v;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -513,12 +518,19 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
|||||||
for (ic = -(clusterSize / 2);
|
for (ic = -(clusterSize / 2);
|
||||||
ic < (clusterSize / 2) + 1; ic++) {
|
ic < (clusterSize / 2) + 1; ic++) {
|
||||||
if ((iy + ir) >= 0 && (iy + ir) < ny &&
|
if ((iy + ir) >= 0 && (iy + ir) < ny &&
|
||||||
(ix + ic) >= 0 && (ix + ic) < nx)
|
(ix + ic) >= 0 && (ix + ic) < nx) {
|
||||||
(clusters + nph)
|
(clusters + nph)
|
||||||
->set_data(val[(iy + ir) * nx + ix + ic],
|
->set_data(val[(iy + ir) * nx + ix + ic],
|
||||||
ic, ir);
|
ic, ir);
|
||||||
|
if (val[(iy + ir) * nx + ix + ic]>max)
|
||||||
|
good=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (good==0) {
|
||||||
|
(clusters + nph)->print();
|
||||||
|
cout << max << " " << val[iy * nx + ix] << endl;
|
||||||
|
}
|
||||||
good = 1;
|
good = 1;
|
||||||
if (eMin > 0 && tot < eMin)
|
if (eMin > 0 && tot < eMin)
|
||||||
good = 0;
|
good = 0;
|
||||||
|
@ -216,14 +216,18 @@ class single_photon_hit {
|
|||||||
|
|
||||||
// int ix, iy;
|
// int ix, iy;
|
||||||
|
|
||||||
|
printf("***************\n");
|
||||||
|
printf("** %d %d **\n",x,y);
|
||||||
for (int iy = 0; iy < dy; iy++) {
|
for (int iy = 0; iy < dy; iy++) {
|
||||||
for (int ix = 0; ix < dx; ix++) {
|
for (int ix = 0; ix < dx; ix++) {
|
||||||
printf("%d \t", data[ix + iy * dx]);
|
printf("%d \t", data[ix + iy * dx]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
printf("***************\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
assign the value to the element of the cluster matrix, with relative
|
assign the value to the element of the cluster matrix, with relative
|
||||||
coordinates where the center of the cluster is (0,0) \param v value to be
|
coordinates where the center of the cluster is (0,0) \param v value to be
|
||||||
|
@ -235,6 +235,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<addaction name="actionLoadConfiguration"/>
|
<addaction name="actionLoadConfiguration"/>
|
||||||
<addaction name="actionLoadTrimbits"/>
|
<addaction name="actionLoadTrimbits"/>
|
||||||
|
<addaction name="actionSaveTrimbits"/>
|
||||||
<addaction name="actionLoadParameters"/>
|
<addaction name="actionLoadParameters"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuModes">
|
<widget class="QMenu" name="menuModes">
|
||||||
@ -419,6 +420,11 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string>&About</string>
|
<string>&About</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSaveTrimbits">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save Trimbits</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../include/icons.qrc"/>
|
<include location="../include/icons.qrc"/>
|
||||||
|
@ -20,7 +20,105 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="2" column="0" colspan="4">
|
<item row="1" column="5">
|
||||||
|
<widget class="QLabel" name="lblRxRoiEnabled">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>120</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>139</red>
|
||||||
|
<green>142</green>
|
||||||
|
<blue>142</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Rx Roi Enabled</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="7">
|
||||||
|
<widget class="QGroupBox" name="boxPlot">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Sans Serif</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Sample Plot</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="plotLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="7">
|
||||||
<widget class="QWidget" name="widgetStatistics" native="true">
|
<widget class="QWidget" name="widgetStatistics" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -212,104 +310,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="4">
|
|
||||||
<widget class="QGroupBox" name="boxPlot">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Sans Serif</family>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Sample Plot</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="plotLayout">
|
|
||||||
<property name="margin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="lblInCompleteImage">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="palette">
|
|
||||||
<palette>
|
|
||||||
<active>
|
|
||||||
<colorrole role="WindowText">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>255</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</active>
|
|
||||||
<inactive>
|
|
||||||
<colorrole role="WindowText">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>255</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</inactive>
|
|
||||||
<disabled>
|
|
||||||
<colorrole role="WindowText">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>139</red>
|
|
||||||
<green>142</green>
|
|
||||||
<blue>142</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</disabled>
|
|
||||||
</palette>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Missing Packets</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="lblCompleteImage">
|
<widget class="QLabel" name="lblCompleteImage">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -320,7 +320,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -375,6 +375,71 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="lblInCompleteImage">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>110</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>139</red>
|
||||||
|
<green>142</green>
|
||||||
|
<blue>142</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Missing Packets</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -32,17 +32,29 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="lblReadout">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>5</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="currentIndex">
|
||||||
<string>Readout: </string>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="tabDAC">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>DACs</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridlayoutDac"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabADC">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>ADCs</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridlayoutAdc"/>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
@ -77,145 +89,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="lblComboHV">
|
<widget class="QLabel" name="lblReadout">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>High Voltage: </string>
|
<string>Readout: </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="comboHV">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>90</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>110</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>120</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>150</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>180</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>200</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lblSpinHV">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>High Voltage: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinHV">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="keyboardTracking">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>200</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="3">
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>5</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tabDAC">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>DACs</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridlayoutDac"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tabADC">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>ADCs</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridlayoutAdc"/>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>775</width>
|
<width>775</width>
|
||||||
<height>380</height>
|
<height>400</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -32,309 +32,77 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="4" column="3">
|
<item row="0" column="2" colspan="5">
|
||||||
<widget class="QCheckBox" name="chkCounter2">
|
<widget class="QComboBox" name="comboHV">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>2</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="4">
|
|
||||||
<widget class="QCheckBox" name="chkCounter3">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>3</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="2" colspan="3">
|
|
||||||
<widget class="QComboBox" name="comboDynamicRange">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1.67772e+07</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>65535</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>255</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>7</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2" colspan="3">
|
|
||||||
<widget class="QSpinBox" name="spinThreshold">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="keyboardTracking">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string> eV</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-100000</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="6">
|
|
||||||
<widget class="QSpinBox" name="spinThreshold3">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="keyboardTracking">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string> eV</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-100000</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="lblDynamicRange">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>110</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>110</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Dynamic Range:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>190</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="8">
|
|
||||||
<widget class="QPushButton" name="btnSetThreshold">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>100</width>
|
<width>140</width>
|
||||||
<height>30</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="toolTip">
|
||||||
<size>
|
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
||||||
<width>16777215</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="palette">
|
|
||||||
<palette>
|
|
||||||
<active>
|
|
||||||
<colorrole role="Shadow">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>20</red>
|
|
||||||
<green>20</green>
|
|
||||||
<blue>20</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</active>
|
|
||||||
<inactive>
|
|
||||||
<colorrole role="Shadow">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>20</red>
|
|
||||||
<green>20</green>
|
|
||||||
<blue>20</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</inactive>
|
|
||||||
<disabled>
|
|
||||||
<colorrole role="Shadow">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>20</red>
|
|
||||||
<green>20</green>
|
|
||||||
<blue>20</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</disabled>
|
|
||||||
</palette>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::TabFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Set</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../include/icons.qrc">
|
|
||||||
<normaloff>:/icons/images/rightArrow.png</normaloff>:/icons/images/rightArrow.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>90</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>110</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>120</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>150</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>180</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="lblSettings">
|
<widget class="QLabel" name="lblComboHV">
|
||||||
<property name="enabled">
|
<property name="sizePolicy">
|
||||||
<bool>true</bool>
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="toolTip">
|
||||||
<size>
|
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
||||||
<width>110</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>110</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Settings:</string>
|
<string>High Voltage: </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="4" column="0">
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lblThreshold">
|
<widget class="QLabel" name="lblThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -356,44 +124,26 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="5">
|
<item row="6" column="4">
|
||||||
<widget class="QSpinBox" name="spinThreshold2">
|
<widget class="QCheckBox" name="chkCounter3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>50</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="keyboardTracking">
|
<property name="text">
|
||||||
<bool>false</bool>
|
<string>3</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="suffix">
|
<property name="checked">
|
||||||
<string> eV</string>
|
<bool>true</bool>
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-100000</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="9">
|
<item row="4" column="14">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -409,10 +159,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="lblCounter">
|
<widget class="QLabel" name="lblSettings">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -427,11 +177,11 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Counters:</string>
|
<string>Settings:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="6" column="2">
|
||||||
<widget class="QCheckBox" name="chkCounter1">
|
<widget class="QCheckBox" name="chkCounter1">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -450,7 +200,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" colspan="3">
|
<item row="2" column="2" colspan="9">
|
||||||
<widget class="QComboBox" name="comboSettings">
|
<widget class="QComboBox" name="comboSettings">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -464,7 +214,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>25</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -589,7 +339,269 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="4" column="11">
|
||||||
|
<widget class="QSpinBox" name="spinThreshold2">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> eV</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-100000</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="13">
|
||||||
|
<widget class="QPushButton" name="btnSetThreshold">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="Shadow">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>20</red>
|
||||||
|
<green>20</green>
|
||||||
|
<blue>20</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="Shadow">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>20</red>
|
||||||
|
<green>20</green>
|
||||||
|
<blue>20</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="Shadow">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>20</red>
|
||||||
|
<green>20</green>
|
||||||
|
<blue>20</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::TabFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Set</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../include/icons.qrc">
|
||||||
|
<normaloff>:/icons/images/rightArrow.png</normaloff>:/icons/images/rightArrow.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="12">
|
||||||
|
<widget class="QSpinBox" name="spinThreshold3">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> eV</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-100000</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="2">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>190</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2" colspan="9">
|
||||||
|
<widget class="QSpinBox" name="spinThreshold">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> eV</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-100000</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="lblCounter">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>110</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>110</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Counters:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="lblDynamicRange">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>110</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>110</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Dynamic Range:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="lblGainMode">
|
<widget class="QLabel" name="lblGainMode">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -611,7 +623,70 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="5" column="2" colspan="9">
|
||||||
|
<widget class="QComboBox" name="comboDynamicRange">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1.67772e+07</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>65535</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>4095</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>255</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>7</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="3">
|
||||||
|
<widget class="QCheckBox" name="chkCounter2">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2" colspan="9">
|
||||||
<widget class="QComboBox" name="comboGainMode">
|
<widget class="QComboBox" name="comboGainMode">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -625,7 +700,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>25</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -669,6 +744,50 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lblSpinHV">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>High Voltage: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="5">
|
||||||
|
<widget class="QSpinBox" name="spinHV">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>200</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class SlsQtH1D;
|
class SlsQtH1D;
|
||||||
class SlsQt1DPlot;
|
class SlsQt1DPlot;
|
||||||
class SlsQt2DPlot;
|
class SlsQt2DPlot;
|
||||||
@ -43,3 +45,5 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
|||||||
|
|
||||||
static int NumClones;
|
static int NumClones;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,11 +6,13 @@
|
|||||||
#include "ui_form_dac.h"
|
#include "ui_form_dac.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qDacWidget : public QWidget, private Ui::WidgetDacObject {
|
class qDacWidget : public QWidget, private Ui::WidgetDacObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n,
|
qDacWidget(QWidget *parent, Detector *detector, bool d, std::string n,
|
||||||
slsDetectorDefs::dacIndex i);
|
slsDetectorDefs::dacIndex i);
|
||||||
~qDacWidget();
|
~qDacWidget();
|
||||||
void SetDetectorIndex(int id);
|
void SetDetectorIndex(int id);
|
||||||
@ -25,8 +27,10 @@ class qDacWidget : public QWidget, private Ui::WidgetDacObject {
|
|||||||
void GetAdc();
|
void GetAdc();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
bool isDac{true};
|
bool isDac{true};
|
||||||
slsDetectorDefs::dacIndex index;
|
slsDetectorDefs::dacIndex index;
|
||||||
int detectorIndex{-1};
|
int detectorIndex{-1};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
using std::chrono::duration;
|
using std::chrono::duration;
|
||||||
using std::chrono::duration_cast;
|
using std::chrono::duration_cast;
|
||||||
using std::chrono::hours;
|
using std::chrono::hours;
|
||||||
@ -47,9 +49,9 @@ class qDefs : public QWidget {
|
|||||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||||
try {
|
try {
|
||||||
throw;
|
throw;
|
||||||
} catch (const sls::SocketError &e) {
|
} catch (const SocketError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const sls::SharedMemoryError &e) {
|
} catch (const SharedMemoryError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
ExceptionMessage(emsg, e.what(), src);
|
ExceptionMessage(emsg, e.what(), src);
|
||||||
@ -63,9 +65,9 @@ class qDefs : public QWidget {
|
|||||||
typename NonDeduced<CT>::type... Args) {
|
typename NonDeduced<CT>::type... Args) {
|
||||||
try {
|
try {
|
||||||
throw;
|
throw;
|
||||||
} catch (const sls::SocketError &e) {
|
} catch (const SocketError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const sls::SharedMemoryError &e) {
|
} catch (const SharedMemoryError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
ExceptionMessage(emsg, e.what(), src);
|
ExceptionMessage(emsg, e.what(), src);
|
||||||
@ -329,3 +331,5 @@ class qDefs : public QWidget {
|
|||||||
source);
|
source);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
#include "ui_form_detectormain.h"
|
#include "ui_form_detectormain.h"
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
|
||||||
|
class QScrollArea;
|
||||||
|
class QResizeEvent;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qDrawPlot;
|
class qDrawPlot;
|
||||||
class qTabMeasurement;
|
class qTabMeasurement;
|
||||||
class qTabDataOutput;
|
class qTabDataOutput;
|
||||||
@ -15,8 +20,6 @@ class qTabSettings;
|
|||||||
class qTabDebugging;
|
class qTabDebugging;
|
||||||
class qTabDeveloper;
|
class qTabDeveloper;
|
||||||
class qTabMessages;
|
class qTabMessages;
|
||||||
class QScrollArea;
|
|
||||||
class QResizeEvent;
|
|
||||||
|
|
||||||
/** To Over-ride the QTabWidget class to get the tabBar protected
|
/** To Over-ride the QTabWidget class to get the tabBar protected
|
||||||
* methodTabWidget */
|
* methodTabWidget */
|
||||||
@ -70,7 +73,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
|||||||
NumberOfTabs
|
NumberOfTabs
|
||||||
};
|
};
|
||||||
slsDetectorDefs::detectorType detType;
|
slsDetectorDefs::detectorType detType;
|
||||||
std::unique_ptr<sls::Detector> det;
|
std::unique_ptr<Detector> det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
MyTabWidget *tabs;
|
MyTabWidget *tabs;
|
||||||
QScrollArea *scroll[NumberOfTabs];
|
QScrollArea *scroll[NumberOfTabs];
|
||||||
@ -88,3 +91,5 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
|||||||
QString zoomToolTip;
|
QString zoomToolTip;
|
||||||
QColor defaultTabColor;
|
QColor defaultTabColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,18 +6,21 @@
|
|||||||
#include "ui_form_plot.h"
|
#include "ui_form_plot.h"
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
class QResizeEvent;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class SlsQt1DPlot;
|
class SlsQt1DPlot;
|
||||||
class SlsQtH1D;
|
class SlsQtH1D;
|
||||||
class SlsQt2DPlot;
|
class SlsQt2DPlot;
|
||||||
class qCloneWidget;
|
class qCloneWidget;
|
||||||
class detectorData;
|
class detectorData;
|
||||||
class QResizeEvent;
|
|
||||||
|
|
||||||
class qDrawPlot : public QWidget, private Ui::PlotObject {
|
class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qDrawPlot(QWidget *parent, sls::Detector *detector);
|
qDrawPlot(QWidget *parent, Detector *detector);
|
||||||
~qDrawPlot();
|
~qDrawPlot();
|
||||||
bool GetIsRunning();
|
bool GetIsRunning();
|
||||||
void SetRunning(bool enable);
|
void SetRunning(bool enable);
|
||||||
@ -55,6 +58,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
void EnableGainPlot(bool enable);
|
void EnableGainPlot(bool enable);
|
||||||
void ClonePlot();
|
void ClonePlot();
|
||||||
void SavePlot();
|
void SavePlot();
|
||||||
|
void SetGapPixels(bool enable);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
@ -91,9 +95,11 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
void Update2dPlot();
|
void Update2dPlot();
|
||||||
void Update1dXYRange();
|
void Update1dXYRange();
|
||||||
void Update2dXYRange();
|
void Update2dXYRange();
|
||||||
|
void rearrangeGotthard25data(double *data);
|
||||||
|
|
||||||
static const int NUM_PEDESTAL_FRAMES = 20;
|
static const int NUM_PEDESTAL_FRAMES = 20;
|
||||||
sls::Detector *det;
|
static const int NUM_GOTTHARD25_CHANS = 1280;
|
||||||
|
Detector *det;
|
||||||
slsDetectorDefs::detectorType detType;
|
slsDetectorDefs::detectorType detType;
|
||||||
|
|
||||||
SlsQt1DPlot *plot1d{nullptr};
|
SlsQt1DPlot *plot1d{nullptr};
|
||||||
@ -158,10 +164,16 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
int64_t currentFrame{0};
|
int64_t currentFrame{0};
|
||||||
mutable std::mutex mPlots;
|
mutable std::mutex mPlots;
|
||||||
int64_t currentAcqIndex{0};
|
int64_t currentAcqIndex{0};
|
||||||
|
slsDetectorDefs::ROI rxRoi{};
|
||||||
|
bool isRxRoiDisplayed{false};
|
||||||
|
bool isGapPixels{false};
|
||||||
|
|
||||||
unsigned int nPixelsX{0};
|
unsigned int nPixelsX{0};
|
||||||
unsigned int nPixelsY{0};
|
unsigned int nPixelsY{0};
|
||||||
uint32_t pixelMask{0};
|
uint32_t pixelMask{0};
|
||||||
uint32_t gainMask{0};
|
uint32_t gainMask{0};
|
||||||
int gainOffset{0};
|
int gainOffset{0};
|
||||||
|
bool gotthard25;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -4,13 +4,15 @@
|
|||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "ui_form_tab_advanced.h"
|
#include "ui_form_tab_advanced.h"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qDrawPlot;
|
class qDrawPlot;
|
||||||
|
|
||||||
class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
qTabAdvanced(QWidget *parent, Detector *detector, qDrawPlot *p);
|
||||||
~qTabAdvanced();
|
~qTabAdvanced();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -74,6 +76,8 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
|||||||
void GetExposureTime();
|
void GetExposureTime();
|
||||||
void GetGateDelay();
|
void GetGateDelay();
|
||||||
|
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "ui_form_tab_dataoutput.h"
|
#include "ui_form_tab_dataoutput.h"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabDataOutput(QWidget *parent, sls::Detector *detector);
|
qTabDataOutput(QWidget *parent, Detector *detector);
|
||||||
~qTabDataOutput();
|
~qTabDataOutput();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
@ -39,7 +41,9 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
|||||||
void GetSpeed();
|
void GetSpeed();
|
||||||
void GetParallel();
|
void GetParallel();
|
||||||
|
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
// Button group for radiobuttons for rate
|
// Button group for radiobuttons for rate
|
||||||
QButtonGroup *btnGroupRate;
|
QButtonGroup *btnGroupRate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -7,11 +7,13 @@
|
|||||||
class QTreeWidget;
|
class QTreeWidget;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
|
class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabDebugging(QWidget *parent, sls::Detector *detector);
|
qTabDebugging(QWidget *parent, Detector *detector);
|
||||||
~qTabDebugging();
|
~qTabDebugging();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
@ -26,10 +28,12 @@ class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
|
|||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
|
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
/** Tree Widget displaying the detectors, modules */
|
/** Tree Widget displaying the detectors, modules */
|
||||||
QTreeWidget *treeDet;
|
QTreeWidget *treeDet;
|
||||||
QLabel *lblDetectorHostname;
|
QLabel *lblDetectorHostname;
|
||||||
QLabel *lblDetectorFirmware;
|
QLabel *lblDetectorFirmware;
|
||||||
QLabel *lblDetectorSoftware;
|
QLabel *lblDetectorSoftware;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,35 +6,30 @@
|
|||||||
#include "ui_form_tab_developer.h"
|
#include "ui_form_tab_developer.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qDacWidget;
|
class qDacWidget;
|
||||||
|
|
||||||
class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
|
class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabDeveloper(QWidget *parent, sls::Detector *detector);
|
qTabDeveloper(QWidget *parent, Detector *detector);
|
||||||
~qTabDeveloper();
|
~qTabDeveloper();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void SetHighVoltage();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
void GetHighVoltage();
|
|
||||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
|
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
|
||||||
int index);
|
int index);
|
||||||
|
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
std::vector<qDacWidget *> dacWidgets;
|
std::vector<qDacWidget *> dacWidgets;
|
||||||
std::vector<qDacWidget *> adcWidgets;
|
std::vector<qDacWidget *> adcWidgets;
|
||||||
|
|
||||||
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
|
|
||||||
int hvmin;
|
|
||||||
static const int HV_MIN = 60;
|
|
||||||
static const int HV_MAX = 200;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -4,14 +4,17 @@
|
|||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "ui_form_tab_measurement.h"
|
#include "ui_form_tab_measurement.h"
|
||||||
|
|
||||||
class qDrawPlot;
|
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
class qDrawPlot;
|
||||||
|
|
||||||
class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabMeasurement(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
qTabMeasurement(QWidget *parent, Detector *detector, qDrawPlot *p);
|
||||||
~qTabMeasurement();
|
~qTabMeasurement();
|
||||||
|
|
||||||
void Refresh();
|
void Refresh();
|
||||||
@ -81,7 +84,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
|||||||
void FileNameChangedSignal(QString);
|
void FileNameChangedSignal(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
// enum for the timing mode
|
// enum for the timing mode
|
||||||
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, TRIGGER_GATED, NUMTIMINGMODES };
|
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, TRIGGER_GATED, NUMTIMINGMODES };
|
||||||
@ -98,3 +101,5 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
|||||||
int numMeasurements{1};
|
int numMeasurements{1};
|
||||||
int currentMeasurement{0};
|
int currentMeasurement{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
class QProcess;
|
class QProcess;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qTabMessages : public QWidget, private Ui::TabMessagesObject {
|
class qTabMessages : public QWidget, private Ui::TabMessagesObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -34,3 +36,5 @@ class qTabMessages : public QWidget, private Ui::TabMessagesObject {
|
|||||||
QProcess *process;
|
QProcess *process;
|
||||||
QStringList lastCommand;
|
QStringList lastCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -4,13 +4,15 @@
|
|||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "ui_form_tab_plot.h"
|
#include "ui_form_tab_plot.h"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qDrawPlot;
|
class qDrawPlot;
|
||||||
|
|
||||||
class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
qTabPlot(QWidget *parent, Detector *detector, qDrawPlot *p);
|
||||||
~qTabPlot();
|
~qTabPlot();
|
||||||
void SetScanArgument();
|
void SetScanArgument();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
@ -53,7 +55,7 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
|||||||
void SetXYRange();
|
void SetXYRange();
|
||||||
void MaintainAspectRatio(int dimension);
|
void MaintainAspectRatio(int dimension);
|
||||||
|
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
bool is1d;
|
bool is1d;
|
||||||
|
|
||||||
@ -65,3 +67,5 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
|||||||
static QString defaultImageYAxisTitle;
|
static QString defaultImageYAxisTitle;
|
||||||
static QString defaultImageZAxisTitle;
|
static QString defaultImageZAxisTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -5,17 +5,20 @@
|
|||||||
#include "ui_form_tab_settings.h"
|
#include "ui_form_tab_settings.h"
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabSettings(QWidget *parent, sls::Detector *detector);
|
qTabSettings(QWidget *parent, Detector *detector);
|
||||||
~qTabSettings();
|
~qTabSettings();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
public slots:
|
public slots:
|
||||||
void SetExportMode(bool exportMode);
|
void SetExportMode(bool exportMode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void SetHighVoltage();
|
||||||
void SetSettings(int index);
|
void SetSettings(int index);
|
||||||
void SetGainMode(int index);
|
void SetGainMode(int index);
|
||||||
void SetDynamicRange(int index);
|
void SetDynamicRange(int index);
|
||||||
@ -30,6 +33,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
void ShowFixG0(bool expertMode);
|
void ShowFixG0(bool expertMode);
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
|
||||||
|
void GetHighVoltage();
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
void GetGainMode();
|
void GetGainMode();
|
||||||
void GetDynamicRange();
|
void GetDynamicRange();
|
||||||
@ -37,9 +41,15 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
void GetThresholdEnergies();
|
void GetThresholdEnergies();
|
||||||
void GetCounterMask();
|
void GetCounterMask();
|
||||||
|
|
||||||
sls::Detector *det;
|
Detector *det;
|
||||||
std::vector<QCheckBox *> counters;
|
std::vector<QCheckBox *> counters;
|
||||||
|
|
||||||
|
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
|
||||||
|
|
||||||
|
int hvmin;
|
||||||
|
static const int HV_MIN = 60;
|
||||||
|
static const int HV_MAX = 200;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STANDARD,
|
STANDARD,
|
||||||
FAST,
|
FAST,
|
||||||
@ -69,5 +79,13 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
enum { DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 };
|
enum { DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 };
|
||||||
bool isVisibleFixG0{false};
|
bool isVisibleFixG0{false};
|
||||||
|
|
||||||
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
enum {
|
||||||
|
DYNAMICRANGE_32,
|
||||||
|
DYNAMICRANGE_16,
|
||||||
|
DYNAMICRANGE_12,
|
||||||
|
DYNAMICRANGE_8,
|
||||||
|
DYNAMICRANGE_4
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -9,11 +9,15 @@
|
|||||||
#include <qwt_plot_curve.h>
|
#include <qwt_plot_curve.h>
|
||||||
#include <qwt_plot_marker.h>
|
#include <qwt_plot_marker.h>
|
||||||
#include <qwt_scale_div.h>
|
#include <qwt_scale_div.h>
|
||||||
|
#include <qwt_plot_shapeitem.h>
|
||||||
|
|
||||||
class QPen;
|
class QPen;
|
||||||
class SlsQt1DPlot;
|
|
||||||
class QwtSymbol;
|
class QwtSymbol;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
class SlsQt1DPlot;
|
||||||
|
|
||||||
class SlsQtH1D : public QwtPlotCurve {
|
class SlsQtH1D : public QwtPlotCurve {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -136,6 +140,9 @@ class SlsQt1DPlot : public QwtPlot {
|
|||||||
void SetLogX(bool yes = 1);
|
void SetLogX(bool yes = 1);
|
||||||
void SetLogY(bool yes = 1);
|
void SetLogY(bool yes = 1);
|
||||||
|
|
||||||
|
void EnableRoiBox(std::array<int, 4> roi);
|
||||||
|
void DisableRoiBox();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SlsQtH1DList *hist_list{nullptr};
|
SlsQtH1DList *hist_list{nullptr};
|
||||||
SlsQt1DZoomer *zoomer{nullptr};
|
SlsQt1DZoomer *zoomer{nullptr};
|
||||||
@ -159,9 +166,15 @@ class SlsQt1DPlot : public QwtPlot {
|
|||||||
friend void SlsQtH1D::Attach(SlsQt1DPlot *p);
|
friend void SlsQtH1D::Attach(SlsQt1DPlot *p);
|
||||||
friend void SlsQtH1D::Detach(SlsQt1DPlot *p);
|
friend void SlsQtH1D::Detach(SlsQt1DPlot *p);
|
||||||
|
|
||||||
|
QwtPlotShapeItem *roiBox{nullptr};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void UnZoom();
|
void UnZoom();
|
||||||
void Update();
|
void Update();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include <qwt_plot_panner.h>
|
#include <qwt_plot_panner.h>
|
||||||
#include <qwt_plot_zoomer.h>
|
#include <qwt_plot_zoomer.h>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class SlsQtH1D;
|
class SlsQtH1D;
|
||||||
|
|
||||||
class SlsQt1DZoomer : public QwtPlotZoomer {
|
class SlsQt1DZoomer : public QwtPlotZoomer {
|
||||||
@ -51,4 +53,6 @@ class SlsQt1DZoomer : public QwtPlotZoomer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <qwt_scale_draw.h>
|
#include <qwt_scale_draw.h>
|
||||||
#include <qwt_scale_widget.h>
|
#include <qwt_scale_widget.h>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class SlsQt2DHist : public QwtRasterData {
|
class SlsQt2DHist : public QwtRasterData {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -125,4 +127,6 @@ class SlsQt2DHist : public QwtRasterData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,11 +6,14 @@
|
|||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
#include <qwt_plot.h>
|
#include <qwt_plot.h>
|
||||||
#include <qwt_plot_spectrogram.h>
|
#include <qwt_plot_spectrogram.h>
|
||||||
|
#include <qwt_plot_shapeitem.h>
|
||||||
|
|
||||||
class QwtPlotPanner;
|
class QwtPlotPanner;
|
||||||
class QwtScaleWidget;
|
class QwtScaleWidget;
|
||||||
class QwtLinearColorMap;
|
class QwtLinearColorMap;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class SlsQt2DPlot : public QwtPlot {
|
class SlsQt2DPlot : public QwtPlot {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -67,6 +70,8 @@ class SlsQt2DPlot : public QwtPlot {
|
|||||||
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
|
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
|
||||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||||
void LogZ(bool on = 1);
|
void LogZ(bool on = 1);
|
||||||
|
void EnableRoiBox(std::array<int, 4> roi);
|
||||||
|
void DisableRoiBox();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showSpectrogram(bool on);
|
void showSpectrogram(bool on);
|
||||||
@ -86,4 +91,7 @@ class SlsQt2DPlot : public QwtPlot {
|
|||||||
QList<double> contourLevelsLog;
|
QList<double> contourLevelsLog;
|
||||||
bool disableZoom{false};
|
bool disableZoom{false};
|
||||||
int isLog;
|
int isLog;
|
||||||
|
QwtPlotShapeItem *roiBox{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include <qwt_plot_panner.h>
|
#include <qwt_plot_panner.h>
|
||||||
#include <qwt_plot_zoomer.h>
|
#include <qwt_plot_zoomer.h>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class SlsQt2DZoomer : public QwtPlotZoomer {
|
class SlsQt2DZoomer : public QwtPlotZoomer {
|
||||||
private:
|
private:
|
||||||
SlsQt2DHist *hist;
|
SlsQt2DHist *hist;
|
||||||
@ -40,4 +42,6 @@ class SlsQt2DZoomer : public QwtPlotZoomer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#include <qwt_symbol.h>
|
#include <qwt_symbol.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
||||||
|
|
||||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data)
|
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data)
|
||||||
@ -442,6 +444,28 @@ void SlsQt1DPlot::SetLog(int axisId, bool yes) {
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SlsQt1DPlot::EnableRoiBox(std::array<int, 4> roi) {
|
||||||
|
if (roiBox == nullptr) {
|
||||||
|
roiBox = new QwtPlotShapeItem();
|
||||||
|
roiBox->attach(this);
|
||||||
|
roiBox->setPen(QColor(Qt::yellow), 2.0, Qt::SolidLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopLeft - BottomRight (max points are +1 on graph)
|
||||||
|
QRect myRect(QPoint(roi[0], roi[2]), QPoint(roi[1] - 1, roi[3] - 1));
|
||||||
|
roiBox->setRect( QRectF(myRect) );
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlsQt1DPlot::DisableRoiBox() {
|
||||||
|
if (roiBox != nullptr) {
|
||||||
|
roiBox->detach();
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SlsQt1DPlot::UnZoom() {
|
void SlsQt1DPlot::UnZoom() {
|
||||||
setAxisScale(QwtPlot::xBottom, zoomer->x(), zoomer->x() + zoomer->w());
|
setAxisScale(QwtPlot::xBottom, zoomer->x(), zoomer->x() + zoomer->w());
|
||||||
setAxisScale(QwtPlot::yLeft, zoomer->y(), zoomer->y() + zoomer->h());
|
setAxisScale(QwtPlot::yLeft, zoomer->y(), zoomer->y() + zoomer->h());
|
||||||
@ -580,3 +604,5 @@ void SlsQt1DPlot::DisableZoom(bool disable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include <qwt_plot.h>
|
#include <qwt_plot.h>
|
||||||
#include <qwt_scale_div.h>
|
#include <qwt_scale_div.h>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
void SlsQt1DZoomer::ResetZoomBase() {
|
void SlsQt1DZoomer::ResetZoomBase() {
|
||||||
SetZoomBase(x0, y0, x1 - x0,
|
SetZoomBase(x0, y0, x1 - x0,
|
||||||
y1 - y0); // for going between log and nonlog plots
|
y1 - y0); // for going between log and nonlog plots
|
||||||
@ -93,3 +95,5 @@ void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D *h) {
|
|||||||
|
|
||||||
ResetZoomBase();
|
ResetZoomBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy,
|
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy,
|
||||||
double ymin, double ymax, double *d, double zmin,
|
double ymin, double ymax, double *d, double zmin,
|
||||||
double zmax)
|
double zmax)
|
||||||
@ -143,3 +145,5 @@ double SlsQt2DHist::SetMinimumToFirstGreaterThanZero() {
|
|||||||
|
|
||||||
return z_min;
|
return z_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||||
isLog = 0;
|
isLog = 0;
|
||||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||||
@ -290,3 +292,26 @@ void SlsQt2DPlot::showSpectrogram(bool on) {
|
|||||||
d_spectrogram->setDefaultContourPen(on ? QPen() : QPen(Qt::NoPen));
|
d_spectrogram->setDefaultContourPen(on ? QPen() : QPen(Qt::NoPen));
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SlsQt2DPlot::EnableRoiBox(std::array<int, 4> roi) {
|
||||||
|
if (roiBox == nullptr) {
|
||||||
|
roiBox = new QwtPlotShapeItem();
|
||||||
|
}
|
||||||
|
roiBox->setPen(QColor(Qt::yellow), 2.0, Qt::SolidLine);
|
||||||
|
|
||||||
|
// TopLeft - BottomRight (max points are +1 on graph)
|
||||||
|
QRect myRect(QPoint(roi[0], roi[2]), QPoint(roi[1] - 1, roi[3] - 1));
|
||||||
|
roiBox->setRect( QRectF(myRect) );
|
||||||
|
|
||||||
|
roiBox->attach(this);
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlsQt2DPlot::DisableRoiBox() {
|
||||||
|
if (roiBox != nullptr) {
|
||||||
|
roiBox->detach();
|
||||||
|
replot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <qwt_text.h>
|
#include <qwt_text.h>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
int qCloneWidget::NumClones{0};
|
int qCloneWidget::NumClones{0};
|
||||||
|
|
||||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
||||||
@ -44,7 +46,7 @@ qCloneWidget::~qCloneWidget() {
|
|||||||
void qCloneWidget::SetupWidgetWindow(QString title) {
|
void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||||
|
|
||||||
std::string winTitle = std::string("Snapshot:") + std::to_string(id) +
|
std::string winTitle = std::string("Snapshot:") + std::to_string(id) +
|
||||||
std::string(" - ") + sls::Logger::Timestamp();
|
std::string(" - ") + Logger::Timestamp();
|
||||||
setWindowTitle(QString(winTitle.c_str()));
|
setWindowTitle(QString(winTitle.c_str()));
|
||||||
|
|
||||||
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||||
@ -147,3 +149,5 @@ void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
|||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
#include "qDacWidget.h"
|
#include "qDacWidget.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d,
|
namespace sls {
|
||||||
|
|
||||||
|
qDacWidget::qDacWidget(QWidget *parent, Detector *detector, bool d,
|
||||||
std::string n, slsDetectorDefs::dacIndex i)
|
std::string n, slsDetectorDefs::dacIndex i)
|
||||||
: QWidget(parent), det(detector), isDac(d), index(i) {
|
: QWidget(parent), det(detector), isDac(d), index(i) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -94,3 +96,5 @@ void qDacWidget::Refresh() {
|
|||||||
GetAdc();
|
GetAdc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -59,7 +59,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
fname = optarg;
|
fname = optarg;
|
||||||
LOG(logDEBUG) << long_options[option_index].name << " " << optarg;
|
LOG(sls::logDEBUG) << long_options[option_index].name << " " << optarg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
tempval = APIGUI;
|
tempval = APIGUI;
|
||||||
LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
LOG(sls::logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
||||||
<< std::hex << tempval << ")";
|
<< std::hex << tempval << ")";
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ int main(int argc, char **argv) {
|
|||||||
"i. Default: 0. Required \n" +
|
"i. Default: 0. Required \n" +
|
||||||
"\t only when more than one multi "
|
"\t only when more than one multi "
|
||||||
"detector object is needed.\n\n";
|
"detector object is needed.\n\n";
|
||||||
LOG(logERROR) << help_message;
|
LOG(sls::logERROR) << help_message;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,16 +96,18 @@ int main(int argc, char **argv) {
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
app.setStyle(new QPlastiqueStyle); // style is deleted by QApplication
|
app.setStyle(new QPlastiqueStyle); // style is deleted by QApplication
|
||||||
try {
|
try {
|
||||||
qDetectorMain det(multiId, fname, isDeveloper);
|
sls::qDetectorMain det(multiId, fname, isDeveloper);
|
||||||
det.show();
|
det.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
qDefs::Message(qDefs::CRITICAL,
|
sls::qDefs::Message(sls::qDefs::CRITICAL,
|
||||||
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
qDetectorMain::qDetectorMain(int multiId, const std::string &fname,
|
qDetectorMain::qDetectorMain(int multiId, const std::string &fname,
|
||||||
bool isDevel)
|
bool isDevel)
|
||||||
: QMainWindow(nullptr), detType(slsDetectorDefs::GENERIC),
|
: QMainWindow(nullptr), detType(slsDetectorDefs::GENERIC),
|
||||||
@ -195,6 +197,7 @@ void qDetectorMain::SetUpWidgetWindow() {
|
|||||||
tabs->setTabEnabled(ADVANCED, false);
|
tabs->setTabEnabled(ADVANCED, false);
|
||||||
tabs->setTabEnabled(DEVELOPER, isDeveloper);
|
tabs->setTabEnabled(DEVELOPER, isDeveloper);
|
||||||
actionLoadTrimbits->setVisible(false);
|
actionLoadTrimbits->setVisible(false);
|
||||||
|
actionSaveTrimbits->setVisible(false);
|
||||||
|
|
||||||
dockWidgetPlot->setFloating(false);
|
dockWidgetPlot->setFloating(false);
|
||||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
@ -212,7 +215,7 @@ void qDetectorMain::SetUpWidgetWindow() {
|
|||||||
void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
|
void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
|
||||||
|
|
||||||
// instantiate detector and set window title
|
// instantiate detector and set window title
|
||||||
det = sls::make_unique<sls::Detector>(multiID);
|
det = make_unique<Detector>(multiID);
|
||||||
|
|
||||||
// create messages tab to capture config file loading logs
|
// create messages tab to capture config file loading logs
|
||||||
tabMessages = new qTabMessages(this);
|
tabMessages = new qTabMessages(this);
|
||||||
@ -225,10 +228,12 @@ void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
|
|||||||
detType = det->getDetectorType().tsquash(
|
detType = det->getDetectorType().tsquash(
|
||||||
"Different detector type for all modules.");
|
"Different detector type for all modules.");
|
||||||
actionLoadTrimbits->setEnabled(false);
|
actionLoadTrimbits->setEnabled(false);
|
||||||
|
actionSaveTrimbits->setEnabled(false);
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
actionLoadTrimbits->setEnabled(true);
|
actionLoadTrimbits->setEnabled(true);
|
||||||
|
actionSaveTrimbits->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
@ -238,15 +243,15 @@ void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
|
|||||||
default:
|
default:
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << det->getHostname() << " has "
|
os << det->getHostname() << " has "
|
||||||
<< sls::ToString(det->getDetectorType().squash())
|
<< ToString(det->getDetectorType().squash())
|
||||||
<< " detector type (" << std::to_string(detType)
|
<< " detector type (" << std::to_string(detType)
|
||||||
<< "). Exiting GUI.";
|
<< "). Exiting GUI.";
|
||||||
std::string errorMess = os.str();
|
std::string errorMess = os.str();
|
||||||
throw sls::RuntimeError(errorMess.c_str());
|
throw RuntimeError(errorMess.c_str());
|
||||||
}
|
}
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "SLS Detector GUI : "
|
os << "SLS Detector GUI : "
|
||||||
<< sls::ToString(det->getDetectorType().squash()) << " - "
|
<< ToString(det->getDetectorType().squash()) << " - "
|
||||||
<< det->getHostname();
|
<< det->getHostname();
|
||||||
std::string title = os.str();
|
std::string title = os.str();
|
||||||
LOG(logINFO) << title;
|
LOG(logINFO) << title;
|
||||||
@ -339,9 +344,9 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
enable = actionExpert->isChecked();
|
enable = actionExpert->isChecked();
|
||||||
|
|
||||||
tabs->setTabEnabled(ADVANCED, enable);
|
tabs->setTabEnabled(ADVANCED, enable);
|
||||||
actionLoadTrimbits->setVisible(enable &&
|
bool visible = enable && (detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::MYTHEN3);
|
||||||
(detType == slsDetectorDefs::EIGER ||
|
actionLoadTrimbits->setVisible(visible);
|
||||||
detType == slsDetectorDefs::MYTHEN3));
|
actionSaveTrimbits->setVisible(visible);
|
||||||
tabSettings->SetExportMode(enable);
|
tabSettings->SetExportMode(enable);
|
||||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||||
}
|
}
|
||||||
@ -417,6 +422,22 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
|||||||
LOG(logINFO) << "Trimbits loaded successfully";
|
LOG(logINFO) << "Trimbits loaded successfully";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (action == actionSaveTrimbits) {
|
||||||
|
QString fPath =
|
||||||
|
QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
||||||
|
LOG(logDEBUG) << "Saving Trimbits";
|
||||||
|
QString fName = QFileDialog::getSaveFileName(
|
||||||
|
this, tr("Save Detector Trimbits"), fPath,
|
||||||
|
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
||||||
|
if (!fName.isEmpty()) {
|
||||||
|
det->saveTrimbits(std::string(fName.toAscii().constData()));
|
||||||
|
qDefs::Message(qDefs::INFORMATION,
|
||||||
|
"The Trimbits have been saved successfully.",
|
||||||
|
"qDetectorMain::ExecuteUtilities");
|
||||||
|
LOG(logINFO) << "Trimbits saved successfully";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not execute utilities.",
|
CATCH_DISPLAY("Could not execute utilities.",
|
||||||
"qDetectorMain::ExecuteUtilities")
|
"qDetectorMain::ExecuteUtilities")
|
||||||
@ -441,10 +462,10 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
|||||||
LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
|
LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
|
||||||
"Gotthard, Gotthard2 and Moench detectors";
|
"Gotthard, Gotthard2 and Moench detectors";
|
||||||
|
|
||||||
std::string guiVersion = sls::ToStringHex(APIGUI);
|
std::string guiVersion = ToStringHex(APIGUI);
|
||||||
std::string clientVersion = "unknown";
|
std::string clientVersion = "unknown";
|
||||||
try {
|
try {
|
||||||
clientVersion = sls::ToStringHex(det->getClientVersion());
|
clientVersion = ToStringHex(det->getClientVersion());
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get client version.",
|
CATCH_DISPLAY("Could not get client version.",
|
||||||
"qDetectorMain::ExecuteHelp")
|
"qDetectorMain::ExecuteHelp")
|
||||||
@ -577,6 +598,8 @@ void qDetectorMain::EnableTabs(bool enable) {
|
|||||||
tabs->setTabEnabled(ADVANCED, expertTab);
|
tabs->setTabEnabled(ADVANCED, expertTab);
|
||||||
actionLoadTrimbits->setVisible(expertTab &&
|
actionLoadTrimbits->setVisible(expertTab &&
|
||||||
detType == slsDetectorDefs::EIGER);
|
detType == slsDetectorDefs::EIGER);
|
||||||
|
actionSaveTrimbits->setVisible(expertTab &&
|
||||||
|
detType == slsDetectorDefs::EIGER);
|
||||||
|
|
||||||
// moved to here, so that its all in order, instead of signals and different
|
// moved to here, so that its all in order, instead of signals and different
|
||||||
// threads
|
// threads
|
||||||
@ -609,3 +632,5 @@ void qDetectorMain::SetZoomToolTip(bool disable) {
|
|||||||
else
|
else
|
||||||
dockWidgetPlot->setToolTip(zoomToolTip);
|
dockWidgetPlot->setToolTip(zoomToolTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector)
|
namespace sls {
|
||||||
|
|
||||||
|
qDrawPlot::qDrawPlot(QWidget *parent, Detector *detector)
|
||||||
: QWidget(parent), det(detector) {
|
: QWidget(parent), det(detector) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -80,6 +82,10 @@ void qDrawPlot::SetupWidgetWindow() {
|
|||||||
fileSaveName = "Image";
|
fileSaveName = "Image";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gotthard25 = ((detType == slsDetectorDefs::GOTTHARD2 ||
|
||||||
|
detType == slsDetectorDefs::GOTTHARD) &&
|
||||||
|
det->size() == 2);
|
||||||
|
|
||||||
SetupPlots();
|
SetupPlots();
|
||||||
SetDataCallBack(true);
|
SetDataCallBack(true);
|
||||||
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),
|
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),
|
||||||
@ -274,11 +280,13 @@ void qDrawPlot::Select1dPlot(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetPlotTitlePrefix(QString title) {
|
void qDrawPlot::SetPlotTitlePrefix(QString title) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << "Setting Title to " << title.toAscii().constData();
|
LOG(logINFO) << "Setting Title to " << title.toAscii().constData();
|
||||||
plotTitlePrefix = title;
|
plotTitlePrefix = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetXAxisTitle(QString title) {
|
void qDrawPlot::SetXAxisTitle(QString title) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData();
|
LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData();
|
||||||
if (is1d) {
|
if (is1d) {
|
||||||
xTitle1d = title;
|
xTitle1d = title;
|
||||||
@ -288,6 +296,7 @@ void qDrawPlot::SetXAxisTitle(QString title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetYAxisTitle(QString title) {
|
void qDrawPlot::SetYAxisTitle(QString title) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData();
|
LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData();
|
||||||
if (is1d) {
|
if (is1d) {
|
||||||
yTitle1d = title;
|
yTitle1d = title;
|
||||||
@ -297,6 +306,7 @@ void qDrawPlot::SetYAxisTitle(QString title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetZAxisTitle(QString title) {
|
void qDrawPlot::SetZAxisTitle(QString title) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData();
|
LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData();
|
||||||
zTitle2d = title;
|
zTitle2d = title;
|
||||||
}
|
}
|
||||||
@ -314,6 +324,7 @@ void qDrawPlot::SetXYRangeChanged(bool disable, double *xy, bool *isXY) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetZRange(double *z, bool *isZ) {
|
void qDrawPlot::SetZRange(double *z, bool *isZ) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
std::copy(z, z + 2, zRange);
|
std::copy(z, z + 2, zRange);
|
||||||
std::copy(isZ, isZ + 2, isZRange);
|
std::copy(isZ, isZ + 2, isZRange);
|
||||||
}
|
}
|
||||||
@ -347,6 +358,7 @@ double qDrawPlot::GetYMaximum() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetDataCallBack(bool enable) {
|
void qDrawPlot::SetDataCallBack(bool enable) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable
|
LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable
|
||||||
<< std::noboolalpha;
|
<< std::noboolalpha;
|
||||||
try {
|
try {
|
||||||
@ -365,6 +377,7 @@ void qDrawPlot::SetDataCallBack(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetBinary(bool enable, int from, int to) {
|
void qDrawPlot::SetBinary(bool enable, int from, int to) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << (enable ? "Enabling" : "Disabling")
|
LOG(logINFO) << (enable ? "Enabling" : "Disabling")
|
||||||
<< " Binary output from " << from << " to " << to;
|
<< " Binary output from " << from << " to " << to;
|
||||||
binaryFrom = from;
|
binaryFrom = from;
|
||||||
@ -373,6 +386,7 @@ void qDrawPlot::SetBinary(bool enable, int from, int to) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetPersistency(int val) {
|
void qDrawPlot::SetPersistency(int val) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << "Setting Persistency to " << val;
|
LOG(logINFO) << "Setting Persistency to " << val;
|
||||||
persistency = val;
|
persistency = val;
|
||||||
}
|
}
|
||||||
@ -454,17 +468,20 @@ void qDrawPlot::ResetAccumulate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::DisplayStatistics(bool enable) {
|
void qDrawPlot::DisplayStatistics(bool enable) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << (enable ? "Enabling" : "Disabling")
|
LOG(logINFO) << (enable ? "Enabling" : "Disabling")
|
||||||
<< " Statistics Display";
|
<< " Statistics Display";
|
||||||
displayStatistics = enable;
|
displayStatistics = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetNumDiscardBits(int value) {
|
void qDrawPlot::SetNumDiscardBits(int value) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << "Setting number of bits to discard: " << value;
|
LOG(logINFO) << "Setting number of bits to discard: " << value;
|
||||||
numDiscardBits = value;
|
numDiscardBits = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::EnableGainPlot(bool enable) {
|
void qDrawPlot::EnableGainPlot(bool enable) {
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Gain Plot";
|
LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Gain Plot";
|
||||||
hasGainData = enable;
|
hasGainData = enable;
|
||||||
}
|
}
|
||||||
@ -605,6 +622,13 @@ void qDrawPlot::SavePlot() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qDrawPlot::SetGapPixels(bool enable) {
|
||||||
|
LOG(logDEBUG) << "Gap pixels enabled";
|
||||||
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
|
isGapPixels = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::GetStatistics(double &min, double &max, double &sum) {
|
void qDrawPlot::GetStatistics(double &min, double &max, double &sum) {
|
||||||
LOG(logDEBUG) << "Calculating Statistics";
|
LOG(logDEBUG) << "Calculating Statistics";
|
||||||
double *array = data2d;
|
double *array = data2d;
|
||||||
@ -638,6 +662,7 @@ void qDrawPlot::StartAcquisition() {
|
|||||||
currentFrame = 0;
|
currentFrame = 0;
|
||||||
boxPlot->setTitle("Old Plot");
|
boxPlot->setTitle("Old Plot");
|
||||||
det->clearAcquiringFlag(); // (from previous exit) or if running
|
det->clearAcquiringFlag(); // (from previous exit) or if running
|
||||||
|
isRxRoiDisplayed = false;
|
||||||
|
|
||||||
// ensure data streaming in receiver (if plot enabled)
|
// ensure data streaming in receiver (if plot enabled)
|
||||||
if (isPlot) {
|
if (isPlot) {
|
||||||
@ -705,7 +730,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress,
|
|||||||
int detectorStatus) {
|
int detectorStatus) {
|
||||||
progress = currentProgress;
|
progress = currentProgress;
|
||||||
std::string status =
|
std::string status =
|
||||||
sls::ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
||||||
|
|
||||||
if (detectorStatus == slsDetectorDefs::ERROR) {
|
if (detectorStatus == slsDetectorDefs::ERROR) {
|
||||||
qDefs::Message(qDefs::WARNING,
|
qDefs::Message(qDefs::WARNING,
|
||||||
@ -738,6 +763,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
|
|||||||
<< " \t dynamic range: " << data->dynamicRange << std::endl
|
<< " \t dynamic range: " << data->dynamicRange << std::endl
|
||||||
<< " \t file index: " << data->fileIndex << std::endl
|
<< " \t file index: " << data->fileIndex << std::endl
|
||||||
<< " \t complete image: " << data->completeImage << std::endl
|
<< " \t complete image: " << data->completeImage << std::endl
|
||||||
|
<< " \t rx Roi: " << ToString(data->rxRoi) << std::endl
|
||||||
<< " ]";
|
<< " ]";
|
||||||
|
|
||||||
progress = data->progressIndex;
|
progress = data->progressIndex;
|
||||||
@ -745,6 +771,22 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
|
|||||||
currentFrame = frameIndex;
|
currentFrame = frameIndex;
|
||||||
LOG(logDEBUG) << "[ Progress:" << progress << "%, Frame:" << currentFrame
|
LOG(logDEBUG) << "[ Progress:" << progress << "%, Frame:" << currentFrame
|
||||||
<< " ]";
|
<< " ]";
|
||||||
|
if (!isRxRoiDisplayed) {
|
||||||
|
rxRoi.xmin = data->rxRoi[0];
|
||||||
|
rxRoi.xmax = data->rxRoi[1];
|
||||||
|
rxRoi.ymin = data->rxRoi[2];
|
||||||
|
rxRoi.ymax = data->rxRoi[3];
|
||||||
|
// only for 2d anyway
|
||||||
|
if (isGapPixels) {
|
||||||
|
rxRoi.xmin += ((rxRoi.xmin/1024) * 6 + (rxRoi.xmin/256) * 2);
|
||||||
|
rxRoi.xmax += ((rxRoi.xmax/1024) * 6 + (rxRoi.xmax/256) * 2);
|
||||||
|
rxRoi.ymin += ((rxRoi.ymin/512) * 34 + (rxRoi.ymin/256) * 2);
|
||||||
|
rxRoi.ymax += ((rxRoi.ymax/512) * 34 + (rxRoi.ymax/256) * 2);
|
||||||
|
LOG(logINFO) << "Rx_roi recalculated with gap pixels: " << ToString(rxRoi);
|
||||||
|
}
|
||||||
|
LOG(logDEBUG) << "Rx_roi: " << ToString(rxRoi);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 1d check if npixelX has changed (m3 for different counters enabled)
|
// 1d check if npixelX has changed (m3 for different counters enabled)
|
||||||
if (is1d && static_cast<int>(nPixelsX) != data->nx) {
|
if (is1d && static_cast<int>(nPixelsX) != data->nx) {
|
||||||
@ -807,6 +849,11 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
|
|||||||
isGainDataExtracted = false;
|
isGainDataExtracted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// gotthard25um rearranging
|
||||||
|
if (gotthard25) {
|
||||||
|
rearrangeGotthard25data(rawData);
|
||||||
|
}
|
||||||
|
|
||||||
// title and frame index titles
|
// title and frame index titles
|
||||||
plotTitle =
|
plotTitle =
|
||||||
plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1);
|
plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1);
|
||||||
@ -978,6 +1025,26 @@ void qDrawPlot::Update1dPlot() {
|
|||||||
xyRangeChanged = false;
|
xyRangeChanged = false;
|
||||||
}
|
}
|
||||||
plot1d->DisableZoom(disableZoom);
|
plot1d->DisableZoom(disableZoom);
|
||||||
|
if (!isRxRoiDisplayed) {
|
||||||
|
isRxRoiDisplayed = true;
|
||||||
|
if (rxRoi.completeRoi()) {
|
||||||
|
plot1d->DisableRoiBox();
|
||||||
|
if (isGainDataExtracted) {
|
||||||
|
gainplot1d->DisableRoiBox();
|
||||||
|
}
|
||||||
|
lblRxRoiEnabled->hide();
|
||||||
|
} else {
|
||||||
|
plot1d->EnableRoiBox(std::array<int, 4>{rxRoi.xmin, rxRoi.xmax, (int)plot1d->GetYMinimum(), (int)plot1d->GetYMaximum()});
|
||||||
|
if (isGainDataExtracted) {
|
||||||
|
gainplot1d->EnableRoiBox(std::array<int, 4>{rxRoi.xmin, rxRoi.xmax, 0, 3});
|
||||||
|
}
|
||||||
|
lblRxRoiEnabled->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ymin and ymax could change (so replot roi every time)
|
||||||
|
if (!rxRoi.completeRoi()) {
|
||||||
|
plot1d->EnableRoiBox(std::array<int, 4>{rxRoi.xmin, rxRoi.xmax, (int)plot1d->GetYMinimum(), (int)plot1d->GetYMaximum()});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Update2dPlot() {
|
void qDrawPlot::Update2dPlot() {
|
||||||
@ -1006,6 +1073,22 @@ void qDrawPlot::Update2dPlot() {
|
|||||||
}
|
}
|
||||||
plot2d->DisableZoom(disableZoom);
|
plot2d->DisableZoom(disableZoom);
|
||||||
plot2d->SetZRange(isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
plot2d->SetZRange(isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
||||||
|
if (!isRxRoiDisplayed) {
|
||||||
|
isRxRoiDisplayed = true;
|
||||||
|
if (rxRoi.completeRoi()) {
|
||||||
|
plot2d->DisableRoiBox();
|
||||||
|
if (isGainDataExtracted) {
|
||||||
|
gainplot2d->DisableRoiBox();
|
||||||
|
}
|
||||||
|
lblRxRoiEnabled->hide();
|
||||||
|
} else {
|
||||||
|
plot2d->EnableRoiBox(rxRoi.getIntArray());
|
||||||
|
if (isGainDataExtracted) {
|
||||||
|
gainplot2d->EnableRoiBox(rxRoi.getIntArray());
|
||||||
|
}
|
||||||
|
lblRxRoiEnabled->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Update1dXYRange() {
|
void qDrawPlot::Update1dXYRange() {
|
||||||
@ -1064,6 +1147,8 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
|
|||||||
// mythen3 / gotthard2 debugging
|
// mythen3 / gotthard2 debugging
|
||||||
int discardBits = numDiscardBits;
|
int discardBits = numDiscardBits;
|
||||||
|
|
||||||
|
uint16_t temp = 0;
|
||||||
|
uint8_t *src = (uint8_t *)source;
|
||||||
switch (dr) {
|
switch (dr) {
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
@ -1083,6 +1168,19 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 12:
|
||||||
|
for (ichan = 0; ichan < size; ++ichan) {
|
||||||
|
temp = (*src++ & 0xFF);
|
||||||
|
temp |= ((*src & 0xF) << 8u);
|
||||||
|
dest[ichan] = (double)temp;
|
||||||
|
++ichan;
|
||||||
|
|
||||||
|
temp = ((*src++ & 0xF0) >> 4u);
|
||||||
|
temp |= ((*src++ & 0xFF) << 4u);
|
||||||
|
dest[ichan] = (double)temp;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
if (detType == slsDetectorDefs::JUNGFRAU ||
|
if (detType == slsDetectorDefs::JUNGFRAU ||
|
||||||
detType == slsDetectorDefs::GOTTHARD2) {
|
detType == slsDetectorDefs::GOTTHARD2) {
|
||||||
@ -1130,6 +1228,18 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qDrawPlot::rearrangeGotthard25data(double *data) {
|
||||||
|
const int nChans = NUM_GOTTHARD25_CHANS;
|
||||||
|
double temp[nChans * 2] = {0.0};
|
||||||
|
for (int i = 0; i != nChans; ++i) {
|
||||||
|
// master module
|
||||||
|
temp[i * 2] = data[i];
|
||||||
|
// slave module
|
||||||
|
temp[i * 2 + 1] = data[nChans + i];
|
||||||
|
}
|
||||||
|
memcpy(data, temp, nChans * 2 * sizeof(double));
|
||||||
|
}
|
||||||
|
|
||||||
void qDrawPlot::UpdatePlot() {
|
void qDrawPlot::UpdatePlot() {
|
||||||
std::lock_guard<std::mutex> lock(mPlots);
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
LOG(logDEBUG) << "Update Plot";
|
LOG(logDEBUG) << "Update Plot";
|
||||||
@ -1164,3 +1274,5 @@ void qDrawPlot::UpdatePlot() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "End of Update Plot";
|
LOG(logDEBUG) << "End of Update Plot";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
#include "sls/network_utils.h"
|
#include "sls/network_utils.h"
|
||||||
|
|
||||||
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector,
|
namespace sls {
|
||||||
|
|
||||||
|
qTabAdvanced::qTabAdvanced(QWidget *parent, Detector *detector,
|
||||||
qDrawPlot *p)
|
qDrawPlot *p)
|
||||||
: QWidget(parent), det(detector), plot(p) {
|
: QWidget(parent), det(detector), plot(p) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -443,7 +445,7 @@ void qTabAdvanced::SetDetectorUDPIP(bool force) {
|
|||||||
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
||||||
LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setSourceUDPIP(sls::IpAddr{s},
|
det->setSourceUDPIP(IpAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Detector UDP IP.",
|
CATCH_HANDLE("Could not set Detector UDP IP.",
|
||||||
@ -461,7 +463,7 @@ void qTabAdvanced::SetDetectorUDPMAC(bool force) {
|
|||||||
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
||||||
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||||
try {
|
try {
|
||||||
det->setSourceUDPMAC(sls::MacAddr{s},
|
det->setSourceUDPMAC(MacAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
||||||
@ -489,7 +491,7 @@ void qTabAdvanced::SetCltZMQIP(bool force) {
|
|||||||
std::string s = dispZMQIP->text().toAscii().constData();
|
std::string s = dispZMQIP->text().toAscii().constData();
|
||||||
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setClientZmqIp(sls::IpAddr{s},
|
det->setClientZmqIp(IpAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Client ZMQ IP.",
|
CATCH_HANDLE("Could not set Client ZMQ IP.",
|
||||||
@ -547,7 +549,7 @@ void qTabAdvanced::SetRxrUDPIP(bool force) {
|
|||||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||||
LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setDestinationUDPIP(sls::IpAddr{s},
|
det->setDestinationUDPIP(IpAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver UDP IP.",
|
CATCH_HANDLE("Could not set Receiver UDP IP.",
|
||||||
@ -565,7 +567,7 @@ void qTabAdvanced::SetRxrUDPMAC(bool force) {
|
|||||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||||
LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||||
try {
|
try {
|
||||||
det->setDestinationUDPMAC(sls::MacAddr{s},
|
det->setDestinationUDPMAC(MacAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
||||||
@ -593,7 +595,7 @@ void qTabAdvanced::SetRxrZMQIP(bool force) {
|
|||||||
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
||||||
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
det->setRxZmqIP(IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver ZMQ IP.",
|
CATCH_HANDLE("Could not set Receiver ZMQ IP.",
|
||||||
"qTabAdvanced::SetRxrZMQIP", this,
|
"qTabAdvanced::SetRxrZMQIP", this,
|
||||||
@ -891,3 +893,5 @@ void qTabAdvanced::Refresh() {
|
|||||||
}
|
}
|
||||||
LOG(logDEBUG) << "**Updated Advanced Tab";
|
LOG(logDEBUG) << "**Updated Advanced Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector)
|
namespace sls {
|
||||||
|
|
||||||
|
qTabDataOutput::qTabDataOutput(QWidget *parent, Detector *detector)
|
||||||
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -232,7 +234,7 @@ void qTabDataOutput::GetFileFormat() {
|
|||||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown file format: ") +
|
throw RuntimeError(std::string("Unknown file format: ") +
|
||||||
std::to_string(static_cast<int>(retval)));
|
std::to_string(static_cast<int>(retval)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,7 +341,7 @@ void qTabDataOutput::EnableRateCorrection() {
|
|||||||
LOG(logINFO) << "Disabling Rate correction";
|
LOG(logINFO) << "Disabling Rate correction";
|
||||||
// disable
|
// disable
|
||||||
try {
|
try {
|
||||||
det->setRateCorrection(sls::ns(0));
|
det->setRateCorrection(ns(0));
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not switch off rate correction.",
|
CATCH_HANDLE("Could not switch off rate correction.",
|
||||||
"qTabDataOutput::EnableRateCorrection", this,
|
"qTabDataOutput::EnableRateCorrection", this,
|
||||||
@ -357,7 +359,7 @@ void qTabDataOutput::SetRateCorrection() {
|
|||||||
int64_t deadtime = spinCustomDeadTime->value();
|
int64_t deadtime = spinCustomDeadTime->value();
|
||||||
LOG(logINFO) << "Setting Rate Correction with custom dead time: "
|
LOG(logINFO) << "Setting Rate Correction with custom dead time: "
|
||||||
<< deadtime;
|
<< deadtime;
|
||||||
det->setRateCorrection(sls::ns(deadtime));
|
det->setRateCorrection(ns(deadtime));
|
||||||
}
|
}
|
||||||
// default dead time
|
// default dead time
|
||||||
else {
|
else {
|
||||||
@ -442,3 +444,5 @@ void qTabDataOutput::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated DataOutput Tab";
|
LOG(logDEBUG) << "**Updated DataOutput Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
|
||||||
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector)
|
namespace sls {
|
||||||
|
|
||||||
|
qTabDebugging::qTabDebugging(QWidget *parent, Detector *detector)
|
||||||
: QWidget(parent), det(detector), treeDet(nullptr),
|
: QWidget(parent), det(detector), treeDet(nullptr),
|
||||||
lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr),
|
lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr),
|
||||||
lblDetectorSoftware(nullptr) {
|
lblDetectorSoftware(nullptr) {
|
||||||
@ -62,7 +64,7 @@ void qTabDebugging::GetDetectorStatus() {
|
|||||||
LOG(logDEBUG) << "Getting Status";
|
LOG(logDEBUG) << "Getting Status";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::string status = sls::ToString(
|
std::string status = ToString(
|
||||||
det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||||
}
|
}
|
||||||
@ -88,7 +90,7 @@ void qTabDebugging::GetInfo() {
|
|||||||
lblDetectorFirmware->setFixedWidth(100);
|
lblDetectorFirmware->setFixedWidth(100);
|
||||||
layout->addWidget(dispFrame, 0, 1);
|
layout->addWidget(dispFrame, 0, 1);
|
||||||
QString detName =
|
QString detName =
|
||||||
QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
QString(ToString(det->getDetectorType().squash()).c_str());
|
||||||
|
|
||||||
switch (det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
|
|
||||||
@ -241,3 +243,5 @@ void qTabDebugging::Refresh() {
|
|||||||
GetDetectorStatus();
|
GetDetectorStatus();
|
||||||
LOG(logDEBUG) << "**Updated Debugging Tab";
|
LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
#include "qDacWidget.h"
|
#include "qDacWidget.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
qTabDeveloper::qTabDeveloper(QWidget *parent, sls::Detector *detector)
|
namespace sls {
|
||||||
|
|
||||||
|
qTabDeveloper::qTabDeveloper(QWidget *parent, Detector *detector)
|
||||||
: QWidget(parent), det(detector) {
|
: QWidget(parent), det(detector) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -16,12 +18,6 @@ qTabDeveloper::~qTabDeveloper() {}
|
|||||||
void qTabDeveloper::SetupWidgetWindow() {
|
void qTabDeveloper::SetupWidgetWindow() {
|
||||||
int tempid = 0;
|
int tempid = 0;
|
||||||
|
|
||||||
comboHV->hide();
|
|
||||||
lblComboHV->hide();
|
|
||||||
lblSpinHV->hide();
|
|
||||||
spinHV->hide();
|
|
||||||
hvmin = HV_MIN;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
@ -82,8 +78,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
comboHV->show();
|
|
||||||
lblComboHV->show();
|
|
||||||
dacWidgets.push_back(new qDacWidget(
|
dacWidgets.push_back(new qDacWidget(
|
||||||
this, det, true,
|
this, det, true,
|
||||||
"v Reference: ", getSLSIndex(detType, tempid++)));
|
"v Reference: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -117,8 +111,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
dacWidgets.push_back(
|
dacWidgets.push_back(
|
||||||
new qDacWidget(this, det, true,
|
new qDacWidget(this, det, true,
|
||||||
"v vb comp: ", getSLSIndex(detType, tempid++)));
|
"v vb comp: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -148,8 +140,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
dacWidgets.push_back(
|
dacWidgets.push_back(
|
||||||
new qDacWidget(this, det, true,
|
new qDacWidget(this, det, true,
|
||||||
"vbp_colbuf: ", getSLSIndex(detType, tempid++)));
|
"vbp_colbuf: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -173,9 +163,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
hvmin = 0;
|
|
||||||
dacWidgets.push_back(new qDacWidget(
|
dacWidgets.push_back(new qDacWidget(
|
||||||
this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
|
this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
|
||||||
dacWidgets.push_back(new qDacWidget(
|
dacWidgets.push_back(new qDacWidget(
|
||||||
@ -216,9 +203,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
hvmin = 0;
|
|
||||||
dacWidgets.push_back(
|
dacWidgets.push_back(
|
||||||
new qDacWidget(this, det, true,
|
new qDacWidget(this, det, true,
|
||||||
"vref_h_adc: ", getSLSIndex(detType, tempid++)));
|
"vref_h_adc: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -290,9 +274,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
void qTabDeveloper::Initialization() {
|
void qTabDeveloper::Initialization() {
|
||||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(Refresh()));
|
SLOT(Refresh()));
|
||||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SetHighVoltage()));
|
|
||||||
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDeveloper::PopulateDetectors() {
|
void qTabDeveloper::PopulateDetectors() {
|
||||||
@ -309,75 +290,6 @@ void qTabDeveloper::PopulateDetectors() {
|
|||||||
comboDetector->setCurrentIndex(0);
|
comboDetector->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDeveloper::GetHighVoltage() {
|
|
||||||
// not enabled for eiger
|
|
||||||
if (!comboHV->isVisible() && !spinHV->isVisible())
|
|
||||||
return;
|
|
||||||
LOG(logDEBUG) << "Getting High Voltage";
|
|
||||||
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
|
||||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SetHighVoltage()));
|
|
||||||
try {
|
|
||||||
// dac units
|
|
||||||
auto retval = det->getHighVoltage({comboDetector->currentIndex() - 1})
|
|
||||||
.tsquash("Inconsistent values for high voltage.");
|
|
||||||
// spinHV
|
|
||||||
if (spinHV->isVisible()) {
|
|
||||||
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
|
|
||||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") +
|
|
||||||
std::to_string(retval));
|
|
||||||
}
|
|
||||||
spinHV->setValue(retval);
|
|
||||||
}
|
|
||||||
// combo HV
|
|
||||||
else {
|
|
||||||
switch (retval) {
|
|
||||||
case 0:
|
|
||||||
comboHV->setCurrentIndex(HV_0);
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
comboHV->setCurrentIndex(HV_90);
|
|
||||||
break;
|
|
||||||
case 110:
|
|
||||||
comboHV->setCurrentIndex(HV_110);
|
|
||||||
break;
|
|
||||||
case 120:
|
|
||||||
comboHV->setCurrentIndex(HV_120);
|
|
||||||
break;
|
|
||||||
case 150:
|
|
||||||
comboHV->setCurrentIndex(HV_150);
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
comboHV->setCurrentIndex(HV_180);
|
|
||||||
break;
|
|
||||||
case 200:
|
|
||||||
comboHV->setCurrentIndex(HV_200);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") +
|
|
||||||
std::to_string(retval));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CATCH_DISPLAY("Could not get high voltage.",
|
|
||||||
"qTabDeveloper::GetHighVoltage")
|
|
||||||
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
|
||||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SetHighVoltage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabDeveloper::SetHighVoltage() {
|
|
||||||
int val = (comboHV->isVisible() ? comboHV->currentText().toInt()
|
|
||||||
: spinHV->value());
|
|
||||||
LOG(logINFO) << "Setting high voltage:" << val;
|
|
||||||
|
|
||||||
try {
|
|
||||||
det->setHighVoltage({comboDetector->currentIndex() - 1});
|
|
||||||
}
|
|
||||||
CATCH_HANDLE("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
|
|
||||||
this, &qTabDeveloper::GetHighVoltage)
|
|
||||||
}
|
|
||||||
|
|
||||||
slsDetectorDefs::dacIndex
|
slsDetectorDefs::dacIndex
|
||||||
qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
@ -431,7 +343,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 22:
|
case 22:
|
||||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
throw RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -458,7 +370,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 9:
|
case 9:
|
||||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
throw RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -484,7 +396,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 8:
|
case 8:
|
||||||
return slsDetectorDefs::TEMPERATURE_ADC;
|
return slsDetectorDefs::TEMPERATURE_ADC;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
throw RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -508,7 +420,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 7:
|
case 7:
|
||||||
return slsDetectorDefs::IBIAS_SFP;
|
return slsDetectorDefs::IBIAS_SFP;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
throw RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -550,7 +462,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 16:
|
case 16:
|
||||||
return slsDetectorDefs::VTHRESHOLD;
|
return slsDetectorDefs::VTHRESHOLD;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
throw RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -586,13 +498,13 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 13:
|
case 13:
|
||||||
return slsDetectorDefs::VCOM_ADC2;
|
return slsDetectorDefs::VCOM_ADC2;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
throw RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown detector type"));
|
throw RuntimeError(std::string("Unknown detector type"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,6 +516,7 @@ void qTabDeveloper::Refresh() {
|
|||||||
for (const auto &it : adcWidgets) {
|
for (const auto &it : adcWidgets) {
|
||||||
it->SetDetectorIndex(comboDetector->currentIndex() - 1);
|
it->SetDetectorIndex(comboDetector->currentIndex() - 1);
|
||||||
}
|
}
|
||||||
GetHighVoltage();
|
|
||||||
LOG(logDEBUG) << "**Updated Developer Tab";
|
LOG(logDEBUG) << "**Updated Developer Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
qTabMeasurement::qTabMeasurement(QWidget *parent, sls::Detector *detector,
|
namespace sls {
|
||||||
|
|
||||||
|
qTabMeasurement::qTabMeasurement(QWidget *parent, Detector *detector,
|
||||||
qDrawPlot *p)
|
qDrawPlot *p)
|
||||||
: QWidget(parent), det(detector), plot(p), progressTimer(nullptr) {
|
: QWidget(parent), det(detector), plot(p), progressTimer(nullptr) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -337,9 +339,26 @@ void qTabMeasurement::GetTimingMode() {
|
|||||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetTimingMode(int)));
|
SLOT(SetTimingMode(int)));
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
slsDetectorDefs::timingMode retval{slsDetectorDefs::AUTO_TIMING};
|
||||||
|
// m3: remove slave modes (always trigger) before squashing
|
||||||
|
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
|
||||||
|
auto retvals = det->getTimingMode();
|
||||||
|
auto is_master = det->getMaster();
|
||||||
|
Result<slsDetectorDefs::timingMode> masterRetvals;
|
||||||
|
for (size_t i = 0; i != is_master.size(); ++i) {
|
||||||
|
if (is_master[i]) {
|
||||||
|
masterRetvals.push_back(retvals[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
retval = masterRetvals.tsquash(
|
||||||
|
"Inconsistent timing mode for all detectors.");
|
||||||
|
} else {
|
||||||
|
retval = det->getTimingMode().tsquash(
|
||||||
|
"Inconsistent timing mode for all detectors.");
|
||||||
|
}
|
||||||
|
|
||||||
auto oldMode = comboTimingMode->currentIndex();
|
auto oldMode = comboTimingMode->currentIndex();
|
||||||
auto retval = det->getTimingMode().tsquash(
|
|
||||||
"Inconsistent timing mode for all detectors.");
|
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case slsDetectorDefs::AUTO_TIMING:
|
case slsDetectorDefs::AUTO_TIMING:
|
||||||
case slsDetectorDefs::TRIGGER_EXPOSURE:
|
case slsDetectorDefs::TRIGGER_EXPOSURE:
|
||||||
@ -353,7 +372,7 @@ void qTabMeasurement::GetTimingMode() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown timing mode: ") +
|
throw RuntimeError(std::string("Unknown timing mode: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,7 +409,7 @@ void qTabMeasurement::GetBurstMode() {
|
|||||||
ShowTriggerDelay();
|
ShowTriggerDelay();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown burst mode: ") +
|
throw RuntimeError(std::string("Unknown burst mode: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1000,3 +1019,5 @@ void qTabMeasurement::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated Measurement Tab";
|
LOG(logDEBUG) << "**Updated Measurement Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -142,3 +144,5 @@ void qTabMessages::Refresh() {
|
|||||||
dispCommand->clear();
|
dispCommand->clear();
|
||||||
dispCommand->setFocus();
|
dispCommand->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <QStackedLayout>
|
#include <QStackedLayout>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
QString qTabPlot::defaultPlotTitle("");
|
QString qTabPlot::defaultPlotTitle("");
|
||||||
QString qTabPlot::defaultHistXAxisTitle("Channel Number");
|
QString qTabPlot::defaultHistXAxisTitle("Channel Number");
|
||||||
QString qTabPlot::defaultHistYAxisTitle("Counts");
|
QString qTabPlot::defaultHistYAxisTitle("Counts");
|
||||||
@ -13,7 +15,7 @@ QString qTabPlot::defaultImageXAxisTitle("Pixel");
|
|||||||
QString qTabPlot::defaultImageYAxisTitle("Pixel");
|
QString qTabPlot::defaultImageYAxisTitle("Pixel");
|
||||||
QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||||
|
|
||||||
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
|
qTabPlot::qTabPlot(QWidget *parent, Detector *detector, qDrawPlot *p)
|
||||||
: QWidget(parent), det(detector), plot(p), is1d(false) {
|
: QWidget(parent), det(detector), plot(p), is1d(false) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -74,6 +76,10 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
// set zmq high water mark to GUI_ZMQ_RCV_HWM (2)
|
// set zmq high water mark to GUI_ZMQ_RCV_HWM (2)
|
||||||
spinSndHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
spinSndHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
||||||
spinRcvHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
spinRcvHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
||||||
|
|
||||||
|
if (chkGapPixels->isEnabled()) {
|
||||||
|
chkGapPixels->setChecked(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::Initialization() {
|
void qTabPlot::Initialization() {
|
||||||
@ -327,6 +333,7 @@ void qTabPlot::SetGapPixels(bool enable) {
|
|||||||
LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
||||||
try {
|
try {
|
||||||
det->setGapPixelsinCallback(enable);
|
det->setGapPixelsinCallback(enable);
|
||||||
|
plot->SetGapPixels(enable);
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels",
|
CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels",
|
||||||
this, &qTabPlot::GetGapPixels)
|
this, &qTabPlot::GetGapPixels)
|
||||||
@ -792,3 +799,5 @@ void qTabPlot::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated Plot Tab";
|
LOG(logDEBUG) << "**Updated Plot Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
#include "sls/bit_utils.h"
|
#include "sls/bit_utils.h"
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector)
|
namespace sls {
|
||||||
|
|
||||||
|
qTabSettings::qTabSettings(QWidget *parent, Detector *detector)
|
||||||
: QWidget(parent), det(detector) {
|
: QWidget(parent), det(detector) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -17,6 +19,12 @@ qTabSettings::~qTabSettings() {}
|
|||||||
|
|
||||||
void qTabSettings::SetupWidgetWindow() {
|
void qTabSettings::SetupWidgetWindow() {
|
||||||
|
|
||||||
|
comboHV->hide();
|
||||||
|
lblComboHV->hide();
|
||||||
|
lblSpinHV->hide();
|
||||||
|
spinHV->hide();
|
||||||
|
hvmin = HV_MIN;
|
||||||
|
|
||||||
counters = std::vector<QCheckBox *>{chkCounter1, chkCounter2, chkCounter3};
|
counters = std::vector<QCheckBox *>{chkCounter1, chkCounter2, chkCounter3};
|
||||||
|
|
||||||
spinThreshold2->hide();
|
spinThreshold2->hide();
|
||||||
@ -35,6 +43,9 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
||||||
if (detType == slsDetectorDefs::MYTHEN3) {
|
if (detType == slsDetectorDefs::MYTHEN3) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
hvmin = 0;
|
||||||
lblDynamicRange->setEnabled(true);
|
lblDynamicRange->setEnabled(true);
|
||||||
comboDynamicRange->setEnabled(true);
|
comboDynamicRange->setEnabled(true);
|
||||||
|
|
||||||
@ -60,22 +71,43 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
QStandardItemModel *model =
|
QStandardItemModel *model =
|
||||||
qobject_cast<QStandardItemModel *>(comboDynamicRange->model());
|
qobject_cast<QStandardItemModel *>(comboDynamicRange->model());
|
||||||
if (model) {
|
if (model) {
|
||||||
QModelIndex index;
|
|
||||||
QStandardItem *item;
|
QStandardItem *item;
|
||||||
index =
|
int dr = DYNAMICRANGE_4;
|
||||||
model->index(DYNAMICRANGE_4, comboDynamicRange->modelColumn(),
|
for (int i = 0; i != 2; ++i) {
|
||||||
comboDynamicRange->rootModelIndex());
|
// disable dr 4
|
||||||
item = model->itemFromIndex(index);
|
QModelIndex index =
|
||||||
item->setEnabled(false);
|
model->index(dr, comboDynamicRange->modelColumn(),
|
||||||
|
comboDynamicRange->rootModelIndex());
|
||||||
|
item = model->itemFromIndex(index);
|
||||||
|
item->setEnabled(false);
|
||||||
|
|
||||||
|
// disable dr 12
|
||||||
|
dr = DYNAMICRANGE_12;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (detType == slsDetectorDefs::EIGER) {
|
} else if (detType == slsDetectorDefs::EIGER) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
hvmin = 0;
|
||||||
lblDynamicRange->setEnabled(true);
|
lblDynamicRange->setEnabled(true);
|
||||||
comboDynamicRange->setEnabled(true);
|
comboDynamicRange->setEnabled(true);
|
||||||
lblThreshold->setEnabled(true);
|
lblThreshold->setEnabled(true);
|
||||||
spinThreshold->setEnabled(true);
|
spinThreshold->setEnabled(true);
|
||||||
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
lblGainMode->setEnabled(true);
|
lblGainMode->setEnabled(true);
|
||||||
comboGainMode->setEnabled(true);
|
comboGainMode->setEnabled(true);
|
||||||
|
} else if (detType == slsDetectorDefs::GOTTHARD) {
|
||||||
|
comboHV->show();
|
||||||
|
lblComboHV->show();
|
||||||
|
} else if (detType == slsDetectorDefs::MOENCH) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
} else if (detType == slsDetectorDefs::GOTTHARD2) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
hvmin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default settings for the disabled
|
// default settings for the disabled
|
||||||
@ -157,6 +189,11 @@ void qTabSettings::ShowFixG0(bool expertMode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::Initialization() {
|
void qTabSettings::Initialization() {
|
||||||
|
// High voltage
|
||||||
|
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetHighVoltage()));
|
||||||
|
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
if (comboSettings->isEnabled())
|
if (comboSettings->isEnabled())
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -193,6 +230,91 @@ void qTabSettings::Initialization() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabSettings::GetHighVoltage() {
|
||||||
|
// not enabled for eiger
|
||||||
|
if (!comboHV->isVisible() && !spinHV->isVisible())
|
||||||
|
return;
|
||||||
|
LOG(logDEBUG) << "Getting High Voltage";
|
||||||
|
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
|
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetHighVoltage()));
|
||||||
|
try {
|
||||||
|
Result<int> retvals = det->getHighVoltage();
|
||||||
|
|
||||||
|
int retval = 0;
|
||||||
|
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
|
||||||
|
retval = retvals.tsquash("Inconsistent values for high voltage.");
|
||||||
|
}
|
||||||
|
// eiger slaves return -999
|
||||||
|
else {
|
||||||
|
|
||||||
|
auto is_master = det->getMaster();
|
||||||
|
Result<int> master_retvals;
|
||||||
|
for (size_t i = 0; i != retvals.size(); ++i) {
|
||||||
|
if (is_master[i]) {
|
||||||
|
master_retvals.push_back(retvals[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
retval = master_retvals.tsquash("Inconsistent values for high voltage.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// spinHV
|
||||||
|
if (spinHV->isVisible()) {
|
||||||
|
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
|
||||||
|
throw RuntimeError(std::string("Unknown High Voltage: ") +
|
||||||
|
std::to_string(retval));
|
||||||
|
}
|
||||||
|
spinHV->setValue(retval);
|
||||||
|
}
|
||||||
|
// combo HV
|
||||||
|
else {
|
||||||
|
switch (retval) {
|
||||||
|
case 0:
|
||||||
|
comboHV->setCurrentIndex(HV_0);
|
||||||
|
break;
|
||||||
|
case 90:
|
||||||
|
comboHV->setCurrentIndex(HV_90);
|
||||||
|
break;
|
||||||
|
case 110:
|
||||||
|
comboHV->setCurrentIndex(HV_110);
|
||||||
|
break;
|
||||||
|
case 120:
|
||||||
|
comboHV->setCurrentIndex(HV_120);
|
||||||
|
break;
|
||||||
|
case 150:
|
||||||
|
comboHV->setCurrentIndex(HV_150);
|
||||||
|
break;
|
||||||
|
case 180:
|
||||||
|
comboHV->setCurrentIndex(HV_180);
|
||||||
|
break;
|
||||||
|
case 200:
|
||||||
|
comboHV->setCurrentIndex(HV_200);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw RuntimeError(std::string("Unknown High Voltage: ") +
|
||||||
|
std::to_string(retval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get high voltage.",
|
||||||
|
"qTabSettings::GetHighVoltage")
|
||||||
|
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
|
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetHighVoltage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabSettings::SetHighVoltage() {
|
||||||
|
int val = (comboHV->isVisible() ? comboHV->currentText().toInt()
|
||||||
|
: spinHV->value());
|
||||||
|
LOG(logINFO) << "Setting high voltage:" << val;
|
||||||
|
|
||||||
|
try {
|
||||||
|
det->setHighVoltage(val);
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set high voltage.", "qTabSettings::SetHighVoltage",
|
||||||
|
this, &qTabSettings::GetHighVoltage)
|
||||||
|
}
|
||||||
|
|
||||||
void qTabSettings::GetSettings() {
|
void qTabSettings::GetSettings() {
|
||||||
LOG(logDEBUG) << "Getting settings";
|
LOG(logDEBUG) << "Getting settings";
|
||||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -209,7 +331,7 @@ void qTabSettings::GetSettings() {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
|
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
|
||||||
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
throw RuntimeError(std::string("Unknown settings: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
comboSettings->setCurrentIndex(retval);
|
comboSettings->setCurrentIndex(retval);
|
||||||
@ -225,7 +347,7 @@ void qTabSettings::SetSettings(int index) {
|
|||||||
// settings
|
// settings
|
||||||
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
|
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
|
||||||
try {
|
try {
|
||||||
LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
|
LOG(logINFO) << "Setting Settings to " << ToString(val);
|
||||||
det->setSettings(val);
|
det->setSettings(val);
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set settings.", "qTabSettings::SetSettings", this,
|
CATCH_HANDLE("Could not set settings.", "qTabSettings::SetSettings", this,
|
||||||
@ -244,7 +366,7 @@ void qTabSettings::GetGainMode() {
|
|||||||
auto retval = det->getGainMode().tsquash(
|
auto retval = det->getGainMode().tsquash(
|
||||||
"Inconsistent gain mode for all detectors.");
|
"Inconsistent gain mode for all detectors.");
|
||||||
if ((int)retval < 0 || (int)retval >= comboGainMode->count()) {
|
if ((int)retval < 0 || (int)retval >= comboGainMode->count()) {
|
||||||
throw sls::RuntimeError(std::string("Unknown gain mode: ") +
|
throw RuntimeError(std::string("Unknown gain mode: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
// warning when using fix_g0 and not in export mode
|
// warning when using fix_g0 and not in export mode
|
||||||
@ -305,6 +427,9 @@ void qTabSettings::GetDynamicRange() {
|
|||||||
case 16:
|
case 16:
|
||||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_16);
|
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_16);
|
||||||
break;
|
break;
|
||||||
|
case 12:
|
||||||
|
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_12);
|
||||||
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_8);
|
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_8);
|
||||||
break;
|
break;
|
||||||
@ -312,7 +437,7 @@ void qTabSettings::GetDynamicRange() {
|
|||||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
throw RuntimeError(std::string("Unknown dynamic range: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,6 +458,9 @@ void qTabSettings::SetDynamicRange(int index) {
|
|||||||
case DYNAMICRANGE_16:
|
case DYNAMICRANGE_16:
|
||||||
det->setDynamicRange(16);
|
det->setDynamicRange(16);
|
||||||
break;
|
break;
|
||||||
|
case DYNAMICRANGE_12:
|
||||||
|
det->setDynamicRange(12);
|
||||||
|
break;
|
||||||
case DYNAMICRANGE_8:
|
case DYNAMICRANGE_8:
|
||||||
det->setDynamicRange(8);
|
det->setDynamicRange(8);
|
||||||
break;
|
break;
|
||||||
@ -340,7 +468,7 @@ void qTabSettings::SetDynamicRange(int index) {
|
|||||||
det->setDynamicRange(4);
|
det->setDynamicRange(4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
throw RuntimeError(std::string("Unknown dynamic range: ") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,7 +515,7 @@ void qTabSettings::SetThresholdEnergies() {
|
|||||||
slsDetectorDefs::detectorSettings sett =
|
slsDetectorDefs::detectorSettings sett =
|
||||||
static_cast<slsDetectorDefs::detectorSettings>(
|
static_cast<slsDetectorDefs::detectorSettings>(
|
||||||
comboSettings->currentIndex());
|
comboSettings->currentIndex());
|
||||||
LOG(logINFO) << "Setting Threshold Energies to " << sls::ToString(eV)
|
LOG(logINFO) << "Setting Threshold Energies to " << ToString(eV)
|
||||||
<< " (eV)";
|
<< " (eV)";
|
||||||
try {
|
try {
|
||||||
det->setThresholdEnergy(eV, sett);
|
det->setThresholdEnergy(eV, sett);
|
||||||
@ -418,7 +546,7 @@ void qTabSettings::GetCounterMask() {
|
|||||||
disconnect(chkCounter3, SIGNAL(toggled(bool)), this,
|
disconnect(chkCounter3, SIGNAL(toggled(bool)), this,
|
||||||
SLOT(SetCounterMask()));
|
SLOT(SetCounterMask()));
|
||||||
try {
|
try {
|
||||||
auto retval = sls::getSetBits(det->getCounterMask().tsquash(
|
auto retval = getSetBits(det->getCounterMask().tsquash(
|
||||||
"Counter mask is inconsistent for all detectors."));
|
"Counter mask is inconsistent for all detectors."));
|
||||||
// default to unchecked
|
// default to unchecked
|
||||||
for (auto p : counters) {
|
for (auto p : counters) {
|
||||||
@ -427,7 +555,7 @@ void qTabSettings::GetCounterMask() {
|
|||||||
// if retval[i] = 2, chkCounter2 is checked
|
// if retval[i] = 2, chkCounter2 is checked
|
||||||
for (auto i : retval) {
|
for (auto i : retval) {
|
||||||
if (i > 3) {
|
if (i > 3) {
|
||||||
throw sls::RuntimeError(
|
throw RuntimeError(
|
||||||
std::string("Unknown counter index : ") +
|
std::string("Unknown counter index : ") +
|
||||||
std::to_string(static_cast<int>(i)));
|
std::to_string(static_cast<int>(i)));
|
||||||
}
|
}
|
||||||
@ -458,6 +586,8 @@ void qTabSettings::SetCounterMask() {
|
|||||||
void qTabSettings::Refresh() {
|
void qTabSettings::Refresh() {
|
||||||
LOG(logDEBUG) << "**Updating Settings Tab";
|
LOG(logDEBUG) << "**Updating Settings Tab";
|
||||||
|
|
||||||
|
GetHighVoltage();
|
||||||
|
|
||||||
if (comboSettings->isEnabled()) {
|
if (comboSettings->isEnabled()) {
|
||||||
GetSettings();
|
GetSettings();
|
||||||
}
|
}
|
||||||
@ -484,3 +614,5 @@ void qTabSettings::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated Settings Tab";
|
LOG(logDEBUG) << "**Updated Settings Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
||||||
|
Binary file not shown.
@ -433,16 +433,21 @@ void initControlServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
|
if (!updateFlag && initError == OK) {
|
||||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
if (mapCSP0() == FAIL) {
|
if (mapCSP0() == FAIL) {
|
||||||
LOG(logERROR,
|
initError = FAIL;
|
||||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
strcpy(initErrorMessage,
|
||||||
exit(EXIT_FAILURE);
|
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||||
}
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
initCheckDone = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up detector */
|
/* set up detector */
|
||||||
@ -702,8 +707,16 @@ void resetPeripheral() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set parameters - dr, adcenablemask */
|
/* set parameters - dr, adcenablemask */
|
||||||
|
int setDynamicRange(int dr) {
|
||||||
|
if (dr == 16)
|
||||||
|
return OK;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
|
int getDynamicRange(int *retval) {
|
||||||
|
*retval = DYNAMIC_RANGE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int setADCEnableMask(uint32_t mask) {
|
int setADCEnableMask(uint32_t mask) {
|
||||||
if (mask == 0u) {
|
if (mask == 0u) {
|
||||||
@ -2047,8 +2060,8 @@ void *start_timer(void *arg) {
|
|||||||
header->frameNumber = frameNr + iframes;
|
header->frameNumber = frameNr + iframes;
|
||||||
header->packetNumber = i;
|
header->packetNumber = i;
|
||||||
header->modId = 0;
|
header->modId = 0;
|
||||||
header->row = detPos[X];
|
header->row = detPos[Y];
|
||||||
header->column = detPos[Y];
|
header->column = detPos[X];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
|
@ -177,7 +177,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) {
|
|||||||
ip->ip_header_checksum[1] = ip_checksum & 0xff;
|
ip->ip_header_checksum[1] = ip_checksum & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
int Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
||||||
*top = 0;
|
*top = 0;
|
||||||
*master = 0;
|
*master = 0;
|
||||||
// mapping new memory to read master top module configuration
|
// mapping new memory to read master top module configuration
|
||||||
@ -187,6 +187,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
|||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG(logERROR, ("Module Configuration FAIL\n"));
|
LOG(logERROR, ("Module Configuration FAIL\n"));
|
||||||
|
return FAIL;
|
||||||
} else {
|
} else {
|
||||||
// read data
|
// read data
|
||||||
ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST);
|
ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST);
|
||||||
@ -202,6 +203,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
|||||||
// close file pointer
|
// close file pointer
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
}
|
}
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
||||||
@ -862,11 +864,17 @@ void Beb_ResetFrameNumber() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Beb_SetUpTransferParameters(short the_bit_mode) {
|
int Beb_SetUpTransferParameters(short the_bit_mode) {
|
||||||
if (the_bit_mode != 4 && the_bit_mode != 8 && the_bit_mode != 16 &&
|
switch (the_bit_mode) {
|
||||||
the_bit_mode != 32)
|
case 4:
|
||||||
|
case 8:
|
||||||
|
case 12:
|
||||||
|
case 16:
|
||||||
|
case 32:
|
||||||
|
Beb_bit_mode = the_bit_mode;
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
Beb_bit_mode = the_bit_mode;
|
}
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Beb_StopAcquisition() {
|
int Beb_StopAcquisition() {
|
||||||
@ -1087,19 +1095,19 @@ int *Beb_GetDetectorPosition() { return Beb_positions; }
|
|||||||
int Beb_SetDetectorPosition(int pos[]) {
|
int Beb_SetDetectorPosition(int pos[]) {
|
||||||
if (!Beb_activated)
|
if (!Beb_activated)
|
||||||
return OK;
|
return OK;
|
||||||
LOG(logINFO, ("Got Position values %d %d...\n", pos[0], pos[1]));
|
LOG(logINFO, ("Setting Position: (%d, %d)\n", pos[X], pos[Y]));
|
||||||
|
|
||||||
// save positions
|
// save positions
|
||||||
Beb_positions[0] = pos[0];
|
Beb_positions[Y] = pos[Y];
|
||||||
Beb_positions[1] = pos[1];
|
Beb_positions[X] = pos[X];
|
||||||
|
|
||||||
// get left and right
|
// get left and right
|
||||||
int posLeft[2] = {pos[0], Beb_top ? pos[1] : pos[1] + 1};
|
int posLeft[2] = {Beb_top ? pos[X] : pos[X] + 1, pos[Y]};
|
||||||
int posRight[2] = {pos[0], Beb_top ? pos[1] + 1 : pos[1]};
|
int posRight[2] = {Beb_top ? pos[X] + 1 : pos[X], pos[Y]};
|
||||||
|
|
||||||
if (Beb_quadEnable) {
|
if (Beb_quadEnable) {
|
||||||
posRight[0] = 1; // right is next row
|
posRight[Y] = 1; // right is next row
|
||||||
posRight[1] = 0; // right same first column
|
posRight[X] = 0; // right same first column
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
@ -1114,7 +1122,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
uint32_t value = 0;
|
uint32_t value = 0;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
// x left
|
// x left
|
||||||
int posval = Beb_swap_uint16(posLeft[0]);
|
int posval = Beb_swap_uint16(posLeft[Y]);
|
||||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||||
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST,
|
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST,
|
||||||
@ -1126,7 +1134,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
// x right
|
// x right
|
||||||
posval = Beb_swap_uint16(posRight[0]);
|
posval = Beb_swap_uint16(posRight[Y]);
|
||||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||||
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST,
|
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST,
|
||||||
@ -1139,7 +1147,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// y left (column)
|
// y left (column)
|
||||||
posval = Beb_swap_uint16(posLeft[1]);
|
posval = Beb_swap_uint16(posLeft[X]);
|
||||||
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
||||||
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
||||||
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST,
|
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST,
|
||||||
@ -1152,7 +1160,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// y right
|
// y right
|
||||||
posval = Beb_swap_uint16(posRight[1]);
|
posval = Beb_swap_uint16(posRight[X]);
|
||||||
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
||||||
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
||||||
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST,
|
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST,
|
||||||
@ -1168,10 +1176,10 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
}
|
}
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
LOG(logINFO, ("Position set to...\n"
|
LOG(logINFO, ("Position set to (col, row):\n"
|
||||||
"\tLeft: [%d, %d]\n"
|
"\tLeft: [%d, %d]\n"
|
||||||
"\tRight:[%d, %d]\n",
|
"\tRight:[%d, %d]\n",
|
||||||
posLeft[0], posLeft[1], posRight[0], posRight[1]));
|
posLeft[X], posLeft[Y], posRight[X], posRight[Y]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1251,20 +1259,20 @@ int Beb_GetNextFrameNumber(uint64_t *retval, int tengigaEnable) {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
uint64_t left10g =
|
uint64_t left10g =
|
||||||
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_MSB_OFST);
|
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_MSB_OFST);
|
||||||
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_LSB_OFST);
|
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_LSB_OFST);
|
||||||
left10g = ((left10g << 32) | temp) >> 16;
|
left10g = ((left10g << 32) | temp) >> 16;
|
||||||
++left10g; // increment for firmware
|
++left10g; // increment for firmware
|
||||||
|
|
||||||
uint64_t right10g =
|
uint64_t right10g =
|
||||||
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_MSB_OFST);
|
Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_MSB_OFST);
|
||||||
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_1G_LEFT_LSB_OFST);
|
temp = Beb_Read32(csp0base, UDP_HEADER_GET_FNUM_10G_LEFT_LSB_OFST);
|
||||||
right10g = ((right10g << 32) | temp) >> 16;
|
right10g = ((right10g << 32) | temp) >> 16;
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
++right10g; // increment for firmware
|
++right10g; // increment for firmware
|
||||||
|
|
||||||
if (left10g != right10g) {
|
if (left10g != right10g) {
|
||||||
LOG(logERROR, ("Retrieved inconsistent frame numbers from `0g left "
|
LOG(logERROR, ("Retrieved inconsistent frame numbers from 10g left "
|
||||||
"%llu and right %llu\n",
|
"%llu and right %llu\n",
|
||||||
(long long int)left10g, (long long int)right10g));
|
(long long int)left10g, (long long int)right10g));
|
||||||
*retval = (left10g > right10g)
|
*retval = (left10g > right10g)
|
||||||
|
@ -15,7 +15,7 @@ int Beb_SetHeaderData(uint64_t src_mac, uint32_t src_ip, uint16_t src_port,
|
|||||||
uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port);
|
uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port);
|
||||||
void Beb_AdjustIPChecksum(struct udp_header_type *ip);
|
void Beb_AdjustIPChecksum(struct udp_header_type *ip);
|
||||||
|
|
||||||
void Beb_GetModuleConfiguration(int *master, int *top, int *normal);
|
int Beb_GetModuleConfiguration(int *master, int *top, int *normal);
|
||||||
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay);
|
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay);
|
||||||
|
|
||||||
void Beb_SetTopVariable(int val);
|
void Beb_SetTopVariable(int val);
|
||||||
|
@ -16,91 +16,31 @@ include_directories(
|
|||||||
../../slsSupportLib/include
|
../../slsSupportLib/include
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(eigerDetectorServerMaster_virtual
|
add_executable(eigerDetectorServer_virtual
|
||||||
${src}
|
${src}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(eigerDetectorServerMaster_virtual
|
target_include_directories(eigerDetectorServer_virtual
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(eigerDetectorServerMaster_virtual
|
target_compile_definitions(eigerDetectorServer_virtual
|
||||||
PUBLIC EIGERD PCCOMPILE STOP_SERVER
|
|
||||||
PUBLIC VIRTUAL #VIRTUAL_9M
|
|
||||||
PUBLIC VIRTUAL_MASTER
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(eigerDetectorServerMaster_virtual
|
|
||||||
PUBLIC pthread rt slsProjectCSettings
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(eigerDetectorServerMaster_virtual PROPERTIES
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS eigerDetectorServerMaster_virtual
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_executable(eigerDetectorServerSlaveTop_virtual
|
|
||||||
${src}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(eigerDetectorServerSlaveTop_virtual
|
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(eigerDetectorServerSlaveTop_virtual
|
|
||||||
PUBLIC EIGERD PCCOMPILE STOP_SERVER
|
|
||||||
PUBLIC VIRTUAL #VIRTUAL_9M
|
|
||||||
PUBLIC VIRTUAL_TOP
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(eigerDetectorServerSlaveTop_virtual
|
|
||||||
PUBLIC pthread rt slsProjectCSettings
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(eigerDetectorServerSlaveTop_virtual PROPERTIES
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS eigerDetectorServerSlaveTop_virtual
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_executable(eigerDetectorServerSlaveBottom_virtual
|
|
||||||
${src}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(eigerDetectorServerSlaveBottom_virtual
|
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(eigerDetectorServerSlaveBottom_virtual
|
|
||||||
PUBLIC EIGERD PCCOMPILE STOP_SERVER
|
PUBLIC EIGERD PCCOMPILE STOP_SERVER
|
||||||
PUBLIC VIRTUAL #VIRTUAL_9M
|
PUBLIC VIRTUAL #VIRTUAL_9M
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(eigerDetectorServerSlaveBottom_virtual
|
target_link_libraries(eigerDetectorServer_virtual
|
||||||
PUBLIC pthread rt slsProjectCSettings
|
PUBLIC pthread rt slsProjectCSettings
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES
|
set_target_properties(eigerDetectorServer_virtual PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS eigerDetectorServerSlaveBottom_virtual
|
install(TARGETS eigerDetectorServer_virtual
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)
|
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)
|
||||||
configure_file(detid_eiger.txt ${CMAKE_BINARY_DIR}/bin/detid_eiger.txt COPYONLY)
|
configure_file(detid_eiger.txt ${CMAKE_BINARY_DIR}/bin/detid_eiger.txt COPYONLY)
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
const unsigned int Feb_Control_leftAddress = 0x100;
|
const unsigned int Feb_Control_leftAddress = 0x100;
|
||||||
const unsigned int Feb_Control_rightAddress = 0x200;
|
const unsigned int Feb_Control_rightAddress = 0x200;
|
||||||
|
|
||||||
int Feb_Control_master = 0;
|
int Feb_Control_master = -1;
|
||||||
int Feb_Control_normal = 0;
|
int Feb_Control_normal = 0;
|
||||||
int Feb_Control_activated = 1;
|
int Feb_Control_activated = 1;
|
||||||
|
|
||||||
@ -50,17 +50,16 @@ double ratemax = -1;
|
|||||||
// setup
|
// setup
|
||||||
void Feb_Control_activate(int activate) { Feb_Control_activated = activate; }
|
void Feb_Control_activate(int activate) { Feb_Control_activated = activate; }
|
||||||
|
|
||||||
void Feb_Control_FebControl() {
|
int Feb_Control_FebControl(int normal) {
|
||||||
Feb_Control_staticBits = Feb_Control_acquireNReadoutMode =
|
Feb_Control_staticBits = 0;
|
||||||
Feb_Control_triggerMode = Feb_Control_externalEnableMode =
|
Feb_Control_acquireNReadoutMode = 0;
|
||||||
Feb_Control_subFrameMode = 0;
|
Feb_Control_triggerMode = 0;
|
||||||
|
Feb_Control_externalEnableMode = 0;
|
||||||
|
Feb_Control_subFrameMode = 0;
|
||||||
Feb_Control_trimbit_size = 263680;
|
Feb_Control_trimbit_size = 263680;
|
||||||
Feb_Control_last_downloaded_trimbits =
|
Feb_Control_last_downloaded_trimbits =
|
||||||
malloc(Feb_Control_trimbit_size * sizeof(int));
|
malloc(Feb_Control_trimbit_size * sizeof(int));
|
||||||
}
|
|
||||||
|
|
||||||
int Feb_Control_Init(int master, int normal) {
|
|
||||||
Feb_Control_master = master;
|
|
||||||
Feb_Control_normal = normal;
|
Feb_Control_normal = normal;
|
||||||
Feb_Interface_SetAddress(Feb_Control_rightAddress, Feb_Control_leftAddress);
|
Feb_Interface_SetAddress(Feb_Control_rightAddress, Feb_Control_leftAddress);
|
||||||
if (Feb_Control_activated) {
|
if (Feb_Control_activated) {
|
||||||
@ -931,7 +930,10 @@ unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec) {
|
|||||||
|
|
||||||
int Feb_Control_PrepareForAcquisition() {
|
int Feb_Control_PrepareForAcquisition() {
|
||||||
LOG(logINFOBLUE, ("Preparing for Acquisition\n"));
|
LOG(logINFOBLUE, ("Preparing for Acquisition\n"));
|
||||||
Feb_Control_PrintAcquisitionSetup();
|
if (!Feb_Control_PrintAcquisitionSetup()) {
|
||||||
|
LOG(logERROR, ("Could not prepare acquisition\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (Feb_Control_Reset() == STATUS_ERROR) {
|
if (Feb_Control_Reset() == STATUS_ERROR) {
|
||||||
LOG(logERROR, ("Trouble reseting daq or data stream\n"));
|
LOG(logERROR, ("Trouble reseting daq or data stream\n"));
|
||||||
@ -988,20 +990,26 @@ int Feb_Control_PrepareForAcquisition() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Feb_Control_PrintAcquisitionSetup() {
|
int Feb_Control_PrintAcquisitionSetup() {
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
time(&rawtime);
|
time(&rawtime);
|
||||||
struct tm *timeinfo = localtime(&rawtime);
|
struct tm *timeinfo = localtime(&rawtime);
|
||||||
LOG(logINFO,
|
int dr = 0;
|
||||||
("Starting an exposure: (%s)"
|
if (!Feb_Control_GetDynamicRange(&dr)) {
|
||||||
"\t Dynamic range nbits: %d\n"
|
LOG(logERROR, ("Could not print acquisition set up\n"));
|
||||||
"\t Trigger mode: 0x%x\n"
|
return 0;
|
||||||
"\t Number of exposures: %d\n"
|
}
|
||||||
"\t Exsposure time (if used): %f seconds.\n"
|
LOG(logINFO, ("Starting an exposure: (%s)"
|
||||||
"\t Exsposure period (if used): %f seconds.\n\n",
|
"\t Dynamic range nbits: %d\n"
|
||||||
asctime(timeinfo), Feb_Control_GetDynamicRange(),
|
"\t Trigger mode: 0x%x\n"
|
||||||
Feb_Control_triggerMode, Feb_Control_GetNExposures(),
|
"\t Number of exposures: %d\n"
|
||||||
Feb_Control_exposure_time_in_sec, Feb_Control_exposure_period_in_sec));
|
"\t Exsposure time (if used): %f seconds.\n"
|
||||||
|
"\t Exsposure period (if used): %f seconds.\n\n",
|
||||||
|
asctime(timeinfo), dr, Feb_Control_triggerMode,
|
||||||
|
Feb_Control_GetNExposures(), Feb_Control_exposure_time_in_sec,
|
||||||
|
Feb_Control_exposure_period_in_sec));
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_StartAcquisition() {
|
int Feb_Control_StartAcquisition() {
|
||||||
@ -1169,49 +1177,106 @@ int Feb_Control_SoftwareTrigger(int block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo) {
|
int Feb_Control_SetDynamicRange(int dr) {
|
||||||
static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM |
|
static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM |
|
||||||
DAQ_STATIC_BIT_CHIP_TEST |
|
DAQ_STATIC_BIT_CHIP_TEST |
|
||||||
DAQ_STATIC_BIT_ROTEST;
|
DAQ_STATIC_BIT_ROTEST;
|
||||||
if (four_eight_sixteen_or_thirtytwo == 4) {
|
switch (dr) {
|
||||||
|
case 4:
|
||||||
Feb_Control_staticBits =
|
Feb_Control_staticBits =
|
||||||
DAQ_STATIC_BIT_M4 |
|
DAQ_STATIC_BIT_M4 |
|
||||||
(Feb_Control_staticBits &
|
(Feb_Control_staticBits &
|
||||||
everything_but_bit_mode); // leave test bits in currernt state
|
everything_but_bit_mode); // leave test bits in currernt state
|
||||||
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
||||||
} else if (four_eight_sixteen_or_thirtytwo == 8) {
|
break;
|
||||||
|
case 8:
|
||||||
Feb_Control_staticBits = DAQ_STATIC_BIT_M8 | (Feb_Control_staticBits &
|
Feb_Control_staticBits = DAQ_STATIC_BIT_M8 | (Feb_Control_staticBits &
|
||||||
everything_but_bit_mode);
|
everything_but_bit_mode);
|
||||||
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
||||||
} else if (four_eight_sixteen_or_thirtytwo == 16) {
|
break;
|
||||||
|
case 12:
|
||||||
|
case 16:
|
||||||
Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits &
|
Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits &
|
||||||
everything_but_bit_mode);
|
everything_but_bit_mode);
|
||||||
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
||||||
} else if (four_eight_sixteen_or_thirtytwo == 32) {
|
|
||||||
|
// disable 16 bit conversion if 12 bit mode (enable if 16 bit)
|
||||||
|
if (!Feb_Control_Disable16bitConversion(dr == 12))
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits &
|
Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits &
|
||||||
everything_but_bit_mode);
|
everything_but_bit_mode);
|
||||||
Feb_Control_subFrameMode |= DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
Feb_Control_subFrameMode |= DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
|
||||||
} else {
|
break;
|
||||||
LOG(logERROR, ("dynamic range (%d) not valid, not setting bit mode.\n",
|
default:
|
||||||
four_eight_sixteen_or_thirtytwo));
|
LOG(logERROR,
|
||||||
|
("dynamic range (%d) not valid, not setting bit mode.\n", dr));
|
||||||
LOG(logINFO, ("Set dynamic range int must equal 4,8 16, or 32.\n"));
|
LOG(logINFO, ("Set dynamic range int must equal 4,8 16, or 32.\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(logINFO,
|
LOG(logINFO, ("Dynamic range set to %d\n", dr));
|
||||||
("Dynamic range set to %d\n", four_eight_sixteen_or_thirtytwo));
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Feb_Control_GetDynamicRange() {
|
int Feb_Control_GetDynamicRange(int *retval) {
|
||||||
if (Feb_Control_subFrameMode & DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING)
|
if (Feb_Control_subFrameMode & DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING) {
|
||||||
return 32;
|
*retval = 32;
|
||||||
else if (DAQ_STATIC_BIT_M4 & Feb_Control_staticBits)
|
} else if (DAQ_STATIC_BIT_M4 & Feb_Control_staticBits) {
|
||||||
return 4;
|
*retval = 4;
|
||||||
else if (DAQ_STATIC_BIT_M8 & Feb_Control_staticBits)
|
} else if (DAQ_STATIC_BIT_M8 & Feb_Control_staticBits) {
|
||||||
return 8;
|
*retval = 8;
|
||||||
|
} else {
|
||||||
|
int disable16 = 0;
|
||||||
|
if (!Feb_Control_Get16bitConversionDisabled(&disable16)) {
|
||||||
|
LOG(logERROR, ("Could not get dynamic range (12 or 16 bit)\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (disable16) {
|
||||||
|
*retval = 12;
|
||||||
|
} else {
|
||||||
|
*retval = 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 16;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Feb_Control_Disable16bitConversion(int disable) {
|
||||||
|
LOG(logINFO, ("%s 16 bit expansion\n", disable ? "Disabling" : "Enabling"));
|
||||||
|
unsigned int regval = 0;
|
||||||
|
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, ®val)) {
|
||||||
|
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
|
||||||
|
(disable ? "disable" : "enable")));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (disable) {
|
||||||
|
regval |= DAQ_REG_HRDWRE_DSBL_16BIT_MSK;
|
||||||
|
} else {
|
||||||
|
regval &= ~DAQ_REG_HRDWRE_DSBL_16BIT_MSK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval)) {
|
||||||
|
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
|
||||||
|
(disable ? "disable" : "enable")));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Feb_Control_Get16bitConversionDisabled(int *ret) {
|
||||||
|
unsigned int regval = 0;
|
||||||
|
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, ®val)) {
|
||||||
|
LOG(logERROR, ("Could not get 16 bit expansion (bit mode)\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (regval & DAQ_REG_HRDWRE_DSBL_16BIT_MSK) {
|
||||||
|
*ret = 1;
|
||||||
|
} else {
|
||||||
|
*ret = 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed) {
|
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed) {
|
||||||
@ -1490,9 +1555,8 @@ int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Feb_Control_SetMasterVariable(int val) { Feb_Control_master = val; }
|
|
||||||
|
|
||||||
int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
||||||
|
|
||||||
uint32_t offset = DAQ_REG_HRDWRE;
|
uint32_t offset = DAQ_REG_HRDWRE;
|
||||||
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
|
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
|
||||||
char *master_names[] = {MASTER_NAMES};
|
char *master_names[] = {MASTER_NAMES};
|
||||||
@ -1529,9 +1593,31 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
|||||||
LOG(logINFOBLUE, ("%s Master flag to %s Feb\n",
|
LOG(logINFOBLUE, ("%s Master flag to %s Feb\n",
|
||||||
(ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"),
|
(ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"),
|
||||||
master_names[ind]));
|
master_names[ind]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Feb_Control_SetMasterEffects(int master, int controlServer) {
|
||||||
|
int prevMaster = Feb_Control_master;
|
||||||
|
|
||||||
|
Feb_Control_master = master;
|
||||||
|
// change in master for 9m
|
||||||
|
if (controlServer && prevMaster != Feb_Control_master &&
|
||||||
|
!Feb_Control_normal) {
|
||||||
|
if (prevMaster) {
|
||||||
|
Feb_Control_CloseSerialCommunication();
|
||||||
|
}
|
||||||
|
if (Feb_Control_master) {
|
||||||
|
if (!Feb_Control_OpenSerialCommunication()) {
|
||||||
|
LOG(logERROR, ("Could not intitalize feb control serial "
|
||||||
|
"communication\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int Feb_Control_SetQuad(int val) {
|
int Feb_Control_SetQuad(int val) {
|
||||||
LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
|
LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
|
||||||
Feb_Control_quadMode = val;
|
Feb_Control_quadMode = val;
|
||||||
@ -1554,7 +1640,10 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
|
|||||||
regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
|
regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval);
|
if (!Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval)) {
|
||||||
|
LOG(logERROR, ("Could not set chip signals to trim quad\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1604,7 +1693,7 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
|||||||
|
|
||||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||||
if (run[iloop]) {
|
if (run[iloop]) {
|
||||||
LOG(logINFO,
|
LOG(logDEBUG1,
|
||||||
("Writing 0x%x to %s 0x%x\n", data, side[iloop], actualOffset));
|
("Writing 0x%x to %s 0x%x\n", data, side[iloop], actualOffset));
|
||||||
if (!Feb_Interface_WriteRegister(addr[iloop], actualOffset, data, 0,
|
if (!Feb_Interface_WriteRegister(addr[iloop], actualOffset, data, 0,
|
||||||
0)) {
|
0)) {
|
||||||
@ -1612,6 +1701,18 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
|||||||
side[iloop], actualOffset));
|
side[iloop], actualOffset));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
uint32_t regVal = 0;
|
||||||
|
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
|
||||||
|
®Val)) {
|
||||||
|
LOG(logERROR, ("Could not read %s register\n", addr[iloop]));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (regVal != data) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Could not write %s register. Write 0x%x, read 0x%x\n",
|
||||||
|
addr[iloop], data, regVal));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1648,8 +1749,8 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
|
|||||||
side[iloop], actualOffset));
|
side[iloop], actualOffset));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Read 0x%x from %s 0x%x\n", value[iloop], side[iloop],
|
LOG(logDEBUG1, ("Read 0x%x from %s 0x%x\n", value[iloop],
|
||||||
actualOffset));
|
side[iloop], actualOffset));
|
||||||
*retval = value[iloop];
|
*retval = value[iloop];
|
||||||
// if not the other (left, not right OR right, not left), return the
|
// if not the other (left, not right OR right, not left), return the
|
||||||
// value
|
// value
|
||||||
@ -1824,7 +1925,11 @@ int64_t Feb_Control_Get_RateTable_Period_in_nsec() {
|
|||||||
|
|
||||||
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||||
// period = exptime if 16bit, period = subexptime if 32 bit
|
// period = exptime if 16bit, period = subexptime if 32 bit
|
||||||
int dr = Feb_Control_GetDynamicRange();
|
int dr = 0;
|
||||||
|
if (!Feb_Control_GetDynamicRange(&dr)) {
|
||||||
|
LOG(logERROR, ("Could not set rate correction tau\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
double period_in_sec =
|
double period_in_sec =
|
||||||
(double)(Feb_Control_GetSubFrameExposureTime()) / (double)1e9;
|
(double)(Feb_Control_GetSubFrameExposureTime()) / (double)1e9;
|
||||||
if (dr == 16)
|
if (dr == 16)
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
// setup
|
// setup
|
||||||
void Feb_Control_activate(int activate);
|
void Feb_Control_activate(int activate);
|
||||||
void Feb_Control_FebControl();
|
int Feb_Control_FebControl(int normal);
|
||||||
int Feb_Control_Init(int master, int normal);
|
|
||||||
int Feb_Control_OpenSerialCommunication();
|
int Feb_Control_OpenSerialCommunication();
|
||||||
void Feb_Control_CloseSerialCommunication();
|
void Feb_Control_CloseSerialCommunication();
|
||||||
int Feb_Control_CheckSetup();
|
int Feb_Control_CheckSetup();
|
||||||
@ -55,7 +54,7 @@ int Feb_Control_ResetChipPartially();
|
|||||||
int Feb_Control_SendBitModeToBebServer();
|
int Feb_Control_SendBitModeToBebServer();
|
||||||
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
|
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
|
||||||
int Feb_Control_PrepareForAcquisition();
|
int Feb_Control_PrepareForAcquisition();
|
||||||
void Feb_Control_PrintAcquisitionSetup();
|
int Feb_Control_PrintAcquisitionSetup();
|
||||||
int Feb_Control_StartAcquisition();
|
int Feb_Control_StartAcquisition();
|
||||||
int Feb_Control_StopAcquisition();
|
int Feb_Control_StopAcquisition();
|
||||||
int Feb_Control_IsReadyForTrigger(int *readyForTrigger);
|
int Feb_Control_IsReadyForTrigger(int *readyForTrigger);
|
||||||
@ -63,8 +62,10 @@ int Feb_Control_SendSoftwareTrigger();
|
|||||||
int Feb_Control_SoftwareTrigger(int block);
|
int Feb_Control_SoftwareTrigger(int block);
|
||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
int Feb_Control_SetDynamicRange(int dr);
|
||||||
unsigned int Feb_Control_GetDynamicRange();
|
int Feb_Control_GetDynamicRange(int *retval);
|
||||||
|
int Feb_Control_Disable16bitConversion(int disable);
|
||||||
|
int Feb_Control_Get16bitConversionDisabled();
|
||||||
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed);
|
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed);
|
||||||
int Feb_Control_SetReadoutMode(unsigned int readout_mode);
|
int Feb_Control_SetReadoutMode(unsigned int readout_mode);
|
||||||
int Feb_Control_SetTriggerMode(unsigned int trigger_mode);
|
int Feb_Control_SetTriggerMode(unsigned int trigger_mode);
|
||||||
@ -86,8 +87,8 @@ int Feb_Control_Get_Counter_Bit();
|
|||||||
int Feb_Control_SetInterruptSubframe(int val);
|
int Feb_Control_SetInterruptSubframe(int val);
|
||||||
int Feb_Control_GetInterruptSubframe();
|
int Feb_Control_GetInterruptSubframe();
|
||||||
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
|
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
|
||||||
void Feb_Control_SetMasterVariable(int val);
|
|
||||||
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
||||||
|
int Feb_Control_SetMasterEffects(int master, int controlServer);
|
||||||
int Feb_Control_SetQuad(int val);
|
int Feb_Control_SetQuad(int val);
|
||||||
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
|
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
|
||||||
int Feb_Control_SetReadNRows(int value);
|
int Feb_Control_SetReadNRows(int value);
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#define DAQ_REG_HRDWRE_OW_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_MASTER_OFST)
|
#define DAQ_REG_HRDWRE_OW_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_MASTER_OFST)
|
||||||
#define DAQ_REG_HRDWRE_MASTER_OFST (4)
|
#define DAQ_REG_HRDWRE_MASTER_OFST (4)
|
||||||
#define DAQ_REG_HRDWRE_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_MASTER_OFST)
|
#define DAQ_REG_HRDWRE_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_MASTER_OFST)
|
||||||
|
#define DAQ_REG_HRDWRE_DSBL_16BIT_OFST (5)
|
||||||
|
#define DAQ_REG_HRDWRE_DSBL_16BIT_MSK (0x00000001 << DAQ_REG_HRDWRE_DSBL_16BIT_OFST)
|
||||||
#define DAQ_REG_HRDWRE_PROGRAM_OFST (30)
|
#define DAQ_REG_HRDWRE_PROGRAM_OFST (30)
|
||||||
#define DAQ_REG_HRDWRE_PROGRAM_MSK (0x00000001 << DAQ_REG_HRDWRE_PROGRAM_OFST)
|
#define DAQ_REG_HRDWRE_PROGRAM_MSK (0x00000001 << DAQ_REG_HRDWRE_PROGRAM_OFST)
|
||||||
#define DAQ_REG_HRDWRE_M8_OFST (31)
|
#define DAQ_REG_HRDWRE_M8_OFST (31)
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#define LINKED_SERVER_NAME "eigerDetectorServer"
|
#define LINKED_SERVER_NAME "eigerDetectorServer"
|
||||||
|
|
||||||
#define REQUIRED_FIRMWARE_VERSION (29)
|
#define REQUIRED_FIRMWARE_VERSION (30)
|
||||||
// virtual ones renamed for consistency
|
// virtual ones renamed for consistency
|
||||||
// real ones keep previous name for compatibility (already in production)
|
// real ones keep previous name for compatibility (already in production)
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
Binary file not shown.
@ -28,12 +28,16 @@ extern int updateFlag;
|
|||||||
extern int checkModuleFlag;
|
extern int checkModuleFlag;
|
||||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
extern int ignoreConfigFileFlag;
|
||||||
|
|
||||||
// Global variable from communication_funcs.c
|
// Global variable from communication_funcs.c
|
||||||
extern int isControlServer;
|
extern int isControlServer;
|
||||||
extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
|
extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
|
||||||
extern void getIpAddressinString(char *cip, uint32_t ip);
|
extern void getIpAddressinString(char *cip, uint32_t ip);
|
||||||
|
|
||||||
|
// Variables that will be exported
|
||||||
|
int masterCommandLine = -1;
|
||||||
|
|
||||||
int initError = OK;
|
int initError = OK;
|
||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
char initErrorMessage[MAX_STR_LENGTH];
|
char initErrorMessage[MAX_STR_LENGTH];
|
||||||
@ -69,6 +73,7 @@ int64_t burstPeriodReg = 0;
|
|||||||
int filterResistor = 0;
|
int filterResistor = 0;
|
||||||
int cdsGain = 0;
|
int cdsGain = 0;
|
||||||
int detPos[2] = {};
|
int detPos[2] = {};
|
||||||
|
int master = 1;
|
||||||
|
|
||||||
int isInitCheckDone() { return initCheckDone; }
|
int isInitCheckDone() { return initCheckDone; }
|
||||||
|
|
||||||
@ -295,6 +300,18 @@ void setModuleId(int modid) {
|
|||||||
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int updateModuleId() {
|
||||||
|
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||||
|
if (initError == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
virtual_moduleid = modid;
|
||||||
|
#endif
|
||||||
|
setModuleId(modid);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
u_int64_t getDetectorMAC() {
|
u_int64_t getDetectorMAC() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
@ -358,16 +375,27 @@ void initControlServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
|
if (!updateFlag && initError == OK) {
|
||||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
if (mapCSP0() == FAIL) {
|
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||||
LOG(logERROR,
|
if (mapCSP0() == FAIL) {
|
||||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
initError = FAIL;
|
||||||
exit(EXIT_FAILURE);
|
strcpy(initErrorMessage,
|
||||||
}
|
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
|
// not reading config file (nothing of interest to stop server)
|
||||||
|
if (checkCommandLineConfiguration() == FAIL) {
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
initCheckDone = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up detector */
|
/* set up detector */
|
||||||
@ -480,15 +508,13 @@ void setupDetector() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set module id in register
|
// master for virtual
|
||||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
if (checkCommandLineConfiguration() == FAIL)
|
||||||
#ifdef VIRTUAL
|
return;
|
||||||
virtual_moduleid = modid;
|
|
||||||
#endif
|
if (updateModuleId() == FAIL) {
|
||||||
if (initError == FAIL) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setModuleId(modid);
|
|
||||||
|
|
||||||
setBurstMode(DEFAULT_BURST_MODE);
|
setBurstMode(DEFAULT_BURST_MODE);
|
||||||
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||||
@ -600,6 +626,11 @@ int readConfigFile() {
|
|||||||
return initError;
|
return initError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ignoreConfigFileFlag) {
|
||||||
|
LOG(logWARNING, ("Ignoring Config file\n"));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
// require a sleep before and after the rst dac signal
|
// require a sleep before and after the rst dac signal
|
||||||
usleep(INITIAL_STARTUP_WAIT);
|
usleep(INITIAL_STARTUP_WAIT);
|
||||||
|
|
||||||
@ -924,6 +955,21 @@ int readConfigFile() {
|
|||||||
return initError;
|
return initError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int checkCommandLineConfiguration() {
|
||||||
|
if (masterCommandLine != -1) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
master = masterCommandLine;
|
||||||
|
#else
|
||||||
|
initError = FAIL;
|
||||||
|
strcpy(initErrorMessage,
|
||||||
|
"Cannot set Master from command line for this detector. "
|
||||||
|
"Should have been caught before!\n");
|
||||||
|
return FAIL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* firmware functions (resets) */
|
/* firmware functions (resets) */
|
||||||
|
|
||||||
void cleanFifos() {
|
void cleanFifos() {
|
||||||
@ -952,7 +998,16 @@ void resetPeripheral() {
|
|||||||
|
|
||||||
/* set parameters - dr, roi */
|
/* set parameters - dr, roi */
|
||||||
|
|
||||||
int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
|
int setDynamicRange(int dr) {
|
||||||
|
if (dr == 16)
|
||||||
|
return OK;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDynamicRange(int *retval) {
|
||||||
|
*retval = DYNAMIC_RANGE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* parameters - timer */
|
/* parameters - timer */
|
||||||
void setNumFrames(int64_t val) {
|
void setNumFrames(int64_t val) {
|
||||||
@ -1442,6 +1497,11 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing */
|
/* parameters - timing */
|
||||||
|
|
||||||
|
int isMaster(int *retval) {
|
||||||
|
*retval = master;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void updatingRegisters() {
|
void updatingRegisters() {
|
||||||
LOG(logINFO, ("\tUpdating registers\n"));
|
LOG(logINFO, ("\tUpdating registers\n"));
|
||||||
// burst
|
// burst
|
||||||
@ -1857,7 +1917,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
// row
|
// row
|
||||||
value = detPos[X];
|
value = detPos[Y];
|
||||||
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
||||||
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||||
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||||
@ -1868,7 +1928,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// col
|
// col
|
||||||
value = detPos[Y];
|
value = detPos[X];
|
||||||
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
||||||
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||||
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||||
@ -1879,7 +1939,8 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
LOG(logINFO,
|
||||||
|
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1921,9 +1982,17 @@ int checkDetectorType() {
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) &&
|
if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) <= TYPE_TOLERANCE) {
|
||||||
(abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) &&
|
LOG(logINFOBLUE, ("MASTER 25um Module\n"));
|
||||||
(abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) {
|
master = 1;
|
||||||
|
} else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) <=
|
||||||
|
TYPE_TOLERANCE) {
|
||||||
|
master = 0;
|
||||||
|
LOG(logINFOBLUE, ("SLAVE 25um Module\n"));
|
||||||
|
} else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) {
|
||||||
|
master = -1;
|
||||||
|
LOG(logINFOBLUE, ("50um Module\n"));
|
||||||
|
} else {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got "
|
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got "
|
||||||
"%d\n",
|
"%d\n",
|
||||||
@ -2228,6 +2297,24 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
setPhase(i, oldPhases[i], 1);
|
setPhase(i, oldPhases[i], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update system frequency and time settings that depend on it
|
||||||
|
if (ind == SYSTEM_C0) {
|
||||||
|
LOG(logINFO, ("\tUpdating time settings (sys freq change)\n"));
|
||||||
|
int64_t exptime = getExpTime();
|
||||||
|
int64_t period = getPeriod();
|
||||||
|
int64_t delayAfterTrigger = getDelayAfterTrigger();
|
||||||
|
int64_t burstPeriod = getBurstPeriod();
|
||||||
|
|
||||||
|
systemFrequency = ((double)getVCOFrequency(SYSTEM_C0) /
|
||||||
|
(double)clkDivider[SYSTEM_C0]);
|
||||||
|
|
||||||
|
setExpTime(exptime);
|
||||||
|
setPeriod(period);
|
||||||
|
setDelayAfterTrigger(delayAfterTrigger);
|
||||||
|
setBurstPeriod(burstPeriod);
|
||||||
|
LOG(logINFO, ("\tDone updating time settings\n"));
|
||||||
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2729,13 +2816,10 @@ void setTimingSource(enum timingSourceType value) {
|
|||||||
case TIMING_INTERNAL:
|
case TIMING_INTERNAL:
|
||||||
LOG(logINFO, ("Setting timing source to internal\n"));
|
LOG(logINFO, ("Setting timing source to internal\n"));
|
||||||
bus_w(addr, (bus_r(addr) & ~CONTROL_TIMING_SOURCE_EXT_MSK));
|
bus_w(addr, (bus_r(addr) & ~CONTROL_TIMING_SOURCE_EXT_MSK));
|
||||||
systemFrequency = INT_SYSTEM_C0_FREQUENCY;
|
|
||||||
break;
|
break;
|
||||||
case TIMING_EXTERNAL:
|
case TIMING_EXTERNAL:
|
||||||
LOG(logINFO, ("Setting timing source to exernal\n"));
|
LOG(logINFO, ("Setting timing source to exernal\n"));
|
||||||
bus_w(addr, (bus_r(addr) | CONTROL_TIMING_SOURCE_EXT_MSK));
|
bus_w(addr, (bus_r(addr) | CONTROL_TIMING_SOURCE_EXT_MSK));
|
||||||
systemFrequency = ((double)getVCOFrequency(SYSTEM_C0) /
|
|
||||||
(double)clkDivider[SYSTEM_C0]);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("Unknown timing source %d\n", value));
|
LOG(logERROR, ("Unknown timing source %d\n", value));
|
||||||
@ -3027,8 +3111,8 @@ void *start_timer(void *arg) {
|
|||||||
header->frameNumber = virtual_currentFrameNumber;
|
header->frameNumber = virtual_currentFrameNumber;
|
||||||
header->packetNumber = 0;
|
header->packetNumber = 0;
|
||||||
header->modId = virtual_moduleid;
|
header->modId = virtual_moduleid;
|
||||||
header->row = detPos[X];
|
header->row = detPos[Y];
|
||||||
header->column = detPos[Y];
|
header->column = detPos[X];
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
||||||
datasize);
|
datasize);
|
||||||
|
Binary file not shown.
@ -25,9 +25,11 @@ extern int debugflag;
|
|||||||
extern int updateFlag;
|
extern int updateFlag;
|
||||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
extern int ignoreConfigFileFlag;
|
||||||
|
|
||||||
// Variables that will be exported
|
// Variables that will be exported
|
||||||
int phaseShift = DEFAULT_PHASE_SHIFT;
|
int phaseShift = DEFAULT_PHASE_SHIFT;
|
||||||
|
int masterCommandLine = -1;
|
||||||
|
|
||||||
// Global variable from communication_funcs.c
|
// Global variable from communication_funcs.c
|
||||||
extern int isControlServer;
|
extern int isControlServer;
|
||||||
@ -359,16 +361,28 @@ void initControlServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
if (mapCSP0() == FAIL) {
|
if (!updateFlag && initError == OK) {
|
||||||
LOG(logERROR,
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||||
exit(EXIT_FAILURE);
|
if (mapCSP0() == FAIL) {
|
||||||
}
|
initError = FAIL;
|
||||||
|
strcpy(initErrorMessage,
|
||||||
|
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
#endif
|
#endif
|
||||||
// to get master from file
|
// to get master from file
|
||||||
readConfigFile();
|
if (readConfigFile() == FAIL ||
|
||||||
|
checkCommandLineConfiguration() == FAIL) {
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initCheckDone = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up detector */
|
/* set up detector */
|
||||||
@ -418,9 +432,18 @@ void setupDetector() {
|
|||||||
// roi, gbit readout
|
// roi, gbit readout
|
||||||
rois.xmin = -1;
|
rois.xmin = -1;
|
||||||
rois.xmax = -1;
|
rois.xmax = -1;
|
||||||
|
rois.ymin = -1;
|
||||||
|
rois.ymax = -1;
|
||||||
setROI(rois); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
|
setROI(rois); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
|
||||||
setGbitReadout();
|
setGbitReadout();
|
||||||
|
|
||||||
|
// no config file or not first time server
|
||||||
|
if (readConfigFile() == FAIL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (checkCommandLineConfiguration() == FAIL)
|
||||||
|
return;
|
||||||
|
|
||||||
// master, slave (25um)
|
// master, slave (25um)
|
||||||
setMasterSlaveConfiguration();
|
setMasterSlaveConfiguration();
|
||||||
|
|
||||||
@ -624,6 +647,16 @@ void setGbitReadout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int readConfigFile() {
|
int readConfigFile() {
|
||||||
|
|
||||||
|
if (initError == FAIL) {
|
||||||
|
return initError;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ignoreConfigFileFlag) {
|
||||||
|
LOG(logWARNING, ("Ignoring Config file\n"));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
const int fileNameSize = 128;
|
const int fileNameSize = 128;
|
||||||
char fname[fileNameSize];
|
char fname[fileNameSize];
|
||||||
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
@ -647,7 +680,6 @@ int readConfigFile() {
|
|||||||
memset(key, 0, keySize);
|
memset(key, 0, keySize);
|
||||||
char value[keySize];
|
char value[keySize];
|
||||||
memset(value, 0, keySize);
|
memset(value, 0, keySize);
|
||||||
int scan = OK;
|
|
||||||
|
|
||||||
// keep reading a line
|
// keep reading a line
|
||||||
while (fgets(line, lineSize, fd)) {
|
while (fgets(line, lineSize, fd)) {
|
||||||
@ -667,19 +699,22 @@ int readConfigFile() {
|
|||||||
master = 0;
|
master = 0;
|
||||||
LOG(logINFOBLUE, ("\tSlave or No Master\n"));
|
LOG(logINFOBLUE, ("\tSlave or No Master\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logERROR,
|
initError = FAIL;
|
||||||
("\tCould not scan masterflags %s value from config file\n",
|
sprintf(
|
||||||
value));
|
initErrorMessage,
|
||||||
scan = FAIL;
|
"Could not scan masterflags %s value from config file\n",
|
||||||
break;
|
value);
|
||||||
|
LOG(logERROR, (initErrorMessage))
|
||||||
|
fclose(fd);
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not first server since detector power on
|
// not first server since detector power on
|
||||||
if (!detectorFirstServer) {
|
if (!detectorFirstServer) {
|
||||||
LOG(logINFOBLUE, ("\tServer has been started up before. "
|
LOG(logWARNING, ("\tServer has been started up before. "
|
||||||
"Ignoring rest of config file\n"));
|
"Ignoring rest of config file\n"));
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return FAIL;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,11 +723,14 @@ int readConfigFile() {
|
|||||||
// convert value to int
|
// convert value to int
|
||||||
int ival = 0;
|
int ival = 0;
|
||||||
if (sscanf(value, "%d", &ival) <= 0) {
|
if (sscanf(value, "%d", &ival) <= 0) {
|
||||||
LOG(logERROR, ("\tCould not scan parameter %s value %s from "
|
initError = FAIL;
|
||||||
"config file\n",
|
sprintf(initErrorMessage,
|
||||||
key, value));
|
"Could not scan parameter %s value %s from "
|
||||||
scan = FAIL;
|
"config file\n",
|
||||||
break;
|
key, value);
|
||||||
|
LOG(logERROR, (initErrorMessage))
|
||||||
|
fclose(fd);
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
// set value
|
// set value
|
||||||
if (!strcasecmp(key, "masterdefaultdelay"))
|
if (!strcasecmp(key, "masterdefaultdelay"))
|
||||||
@ -710,16 +748,16 @@ int readConfigFile() {
|
|||||||
else if (!strcasecmp(key, "startacqdelay"))
|
else if (!strcasecmp(key, "startacqdelay"))
|
||||||
startacqdelay = ival;
|
startacqdelay = ival;
|
||||||
else {
|
else {
|
||||||
LOG(logERROR,
|
initError = FAIL;
|
||||||
("\tCould not scan parameter %s from config file\n", key));
|
sprintf(initErrorMessage,
|
||||||
scan = FAIL;
|
"Could not scan parameter %s from config file\n", key);
|
||||||
break;
|
LOG(logERROR, (initErrorMessage))
|
||||||
|
fclose(fd);
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
if (scan == FAIL)
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
|
|
||||||
LOG(logINFOBLUE,
|
LOG(logINFOBLUE,
|
||||||
("\tmasterdefaultdelay:%d\n"
|
("\tmasterdefaultdelay:%d\n"
|
||||||
@ -734,13 +772,28 @@ int readConfigFile() {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int checkCommandLineConfiguration() {
|
||||||
|
if (masterCommandLine != -1) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
master = masterCommandLine;
|
||||||
|
#else
|
||||||
|
initError = FAIL;
|
||||||
|
strcpy(initErrorMessage,
|
||||||
|
"Cannot set Master from command line for this detector. "
|
||||||
|
"Should have been caught before!\n");
|
||||||
|
return FAIL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void setMasterSlaveConfiguration() {
|
void setMasterSlaveConfiguration() {
|
||||||
LOG(logINFO, ("Reading Master Slave Configuration\n"));
|
// not the first time its being read
|
||||||
|
if (!detectorFirstServer) {
|
||||||
// no config file or not first time server
|
|
||||||
if (readConfigFile() == FAIL)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logINFO, ("Reading Master Slave Configuration\n"));
|
||||||
// master configuration
|
// master configuration
|
||||||
if (master) {
|
if (master) {
|
||||||
// master default delay set, so reset delay
|
// master default delay set, so reset delay
|
||||||
@ -788,7 +841,16 @@ void setMasterSlaveConfiguration() {
|
|||||||
|
|
||||||
/* set parameters - dr, roi */
|
/* set parameters - dr, roi */
|
||||||
|
|
||||||
int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
|
int setDynamicRange(int dr) {
|
||||||
|
if (dr == 16)
|
||||||
|
return OK;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDynamicRange(int *retval) {
|
||||||
|
*retval = DYNAMIC_RANGE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int setROI(ROI arg) {
|
int setROI(ROI arg) {
|
||||||
|
|
||||||
@ -797,8 +859,10 @@ int setROI(ROI arg) {
|
|||||||
LOG(logINFO, ("Clearing ROI\n"));
|
LOG(logINFO, ("Clearing ROI\n"));
|
||||||
rois.xmin = -1;
|
rois.xmin = -1;
|
||||||
rois.xmax = -1;
|
rois.xmax = -1;
|
||||||
|
rois.ymin = -1;
|
||||||
|
rois.ymax = -1;
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("Setting ROI:(%d, %d)\n", arg.xmin, arg.xmax));
|
LOG(logINFO, ("Setting ROI:(%d, %d, %d, %d)\n", arg.xmin, arg.xmax, arg.ymin, arg.ymax));
|
||||||
// validation
|
// validation
|
||||||
// xmin divisible by 256 and less than 1280
|
// xmin divisible by 256 and less than 1280
|
||||||
if (((arg.xmin % NCHAN_PER_ADC) != 0) ||
|
if (((arg.xmin % NCHAN_PER_ADC) != 0) ||
|
||||||
@ -832,7 +896,7 @@ ROI getROI() {
|
|||||||
if (rois.xmin == -1) {
|
if (rois.xmin == -1) {
|
||||||
LOG(logINFO, ("\tROI: None\n"));
|
LOG(logINFO, ("\tROI: None\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("ROI: (%d,%d)\n", rois.xmin, rois.xmax));
|
LOG(logINFO, ("ROI: (%d,%d,%d,%d)\n", rois.xmin, rois.xmax, rois.ymin, rois.ymax));
|
||||||
}
|
}
|
||||||
return rois;
|
return rois;
|
||||||
}
|
}
|
||||||
@ -1238,7 +1302,10 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
int isMaster() { return master; }
|
int isMaster(int *retval) {
|
||||||
|
*retval = master;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
u_int32_t addr = EXT_SIGNAL_REG;
|
u_int32_t addr = EXT_SIGNAL_REG;
|
||||||
|
@ -25,7 +25,7 @@ target_include_directories(jungfrauDetectorServer_virtual
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(jungfrauDetectorServer_virtual
|
target_compile_definitions(jungfrauDetectorServer_virtual
|
||||||
PUBLIC JUNGFRAUD VIRTUAL STOP_SERVER
|
PUBLIC JUNGFRAUD VIRTUAL STOP_SERVER #TEST_MOD_GEOMETRY
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(jungfrauDetectorServer_virtual
|
target_link_libraries(jungfrauDetectorServer_virtual
|
||||||
|
Binary file not shown.
@ -21,13 +21,14 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
extern int portno;
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
extern int updateFlag;
|
extern int updateFlag;
|
||||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||||
extern int numUdpDestinations;
|
extern int numUdpDestinations;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
extern int ignoreConfigFileFlag;
|
||||||
|
|
||||||
// Global variable from communication_funcs.c
|
// Global variable from communication_funcs.c
|
||||||
extern int isControlServer;
|
extern int isControlServer;
|
||||||
@ -392,19 +393,29 @@ void initControlServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
|
if (!updateFlag && initError == OK) {
|
||||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
if (mapCSP0() == FAIL) {
|
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||||
LOG(logERROR,
|
if (mapCSP0() == FAIL) {
|
||||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
initError = FAIL;
|
||||||
exit(EXIT_FAILURE);
|
strcpy(initErrorMessage,
|
||||||
}
|
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (readConfigFile() == FAIL) {
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
// temp threshold and reset event (read by stop server)
|
// temp threshold and reset event (read by stop server)
|
||||||
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
||||||
setTemperatureEvent(0);
|
setTemperatureEvent(0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
initCheckDone = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up detector */
|
/* set up detector */
|
||||||
@ -643,6 +654,11 @@ int readConfigFile() {
|
|||||||
return initError;
|
return initError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ignoreConfigFileFlag) {
|
||||||
|
LOG(logWARNING, ("Ignoring Config file\n"));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
const int fileNameSize = 128;
|
const int fileNameSize = 128;
|
||||||
char fname[fileNameSize];
|
char fname[fileNameSize];
|
||||||
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
@ -796,7 +812,16 @@ void resetPeripheral() {
|
|||||||
|
|
||||||
/* set parameters - dr, roi */
|
/* set parameters - dr, roi */
|
||||||
|
|
||||||
int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
|
int setDynamicRange(int dr) {
|
||||||
|
if (dr == 16)
|
||||||
|
return OK;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDynamicRange(int *retval) {
|
||||||
|
*retval = DYNAMIC_RANGE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void setADCInvertRegister(uint32_t val) {
|
void setADCInvertRegister(uint32_t val) {
|
||||||
LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val));
|
LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val));
|
||||||
@ -1596,6 +1621,7 @@ int configureMAC() {
|
|||||||
|
|
||||||
int setDetectorPosition(int pos[]) {
|
int setDetectorPosition(int pos[]) {
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
// row, col
|
||||||
uint32_t innerPos[2] = {pos[X], pos[Y]};
|
uint32_t innerPos[2] = {pos[X], pos[Y]};
|
||||||
uint32_t outerPos[2] = {pos[X], pos[Y]};
|
uint32_t outerPos[2] = {pos[X], pos[Y]};
|
||||||
int selInterface = getPrimaryInterface();
|
int selInterface = getPrimaryInterface();
|
||||||
@ -1605,15 +1631,16 @@ int setDetectorPosition(int pos[]) {
|
|||||||
("Setting detector position: 1 Interface %s \n(%d, %d)\n",
|
("Setting detector position: 1 Interface %s \n(%d, %d)\n",
|
||||||
(selInterface ? "Inner" : "Outer"), innerPos[X], innerPos[Y]));
|
(selInterface ? "Inner" : "Outer"), innerPos[X], innerPos[Y]));
|
||||||
} else {
|
} else {
|
||||||
++outerPos[X];
|
// top has row incremented by 1
|
||||||
|
++innerPos[Y];
|
||||||
LOG(logDEBUG, ("Setting detector position: 2 Interfaces \n"
|
LOG(logDEBUG, ("Setting detector position: 2 Interfaces \n"
|
||||||
" inner top(%d, %d), outer bottom(%d, %d)\n",
|
" inner top(%d, %d), outer bottom(%d, %d)\n",
|
||||||
innerPos[X], innerPos[Y], outerPos[X], outerPos[Y]));
|
innerPos[X], innerPos[Y], outerPos[X], outerPos[Y]));
|
||||||
}
|
}
|
||||||
detPos[0] = innerPos[0];
|
detPos[0] = innerPos[X];
|
||||||
detPos[1] = innerPos[1];
|
detPos[1] = innerPos[Y];
|
||||||
detPos[2] = outerPos[0];
|
detPos[2] = outerPos[X];
|
||||||
detPos[3] = outerPos[1];
|
detPos[3] = outerPos[Y];
|
||||||
|
|
||||||
// row
|
// row
|
||||||
// outer
|
// outer
|
||||||
@ -1651,8 +1678,8 @@ int setDetectorPosition(int pos[]) {
|
|||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
if (getNumberofUDPInterfaces() == 1) {
|
if (getNumberofUDPInterfaces() == 1) {
|
||||||
LOG(logINFOBLUE,
|
LOG(logINFOBLUE, ("Position set to [%d, %d] #(col, row)\n",
|
||||||
("Position set to [%d, %d]\n", innerPos[X], innerPos[Y]));
|
innerPos[X], innerPos[Y]));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFOBLUE, (" Inner (top) position set to [%d, %d]\n",
|
LOG(logINFOBLUE, (" Inner (top) position set to [%d, %d]\n",
|
||||||
innerPos[X], innerPos[Y]));
|
innerPos[X], innerPos[Y]));
|
||||||
@ -2506,8 +2533,16 @@ void *start_timer(void *arg) {
|
|||||||
if (i > 0 && i % pixelsPerPacket == 0) {
|
if (i > 0 && i % pixelsPerPacket == 0) {
|
||||||
++pixelVal;
|
++pixelVal;
|
||||||
}
|
}
|
||||||
|
// to debug multi module geometry (row, column) in virtual servers (all pixels
|
||||||
|
// in a module set to particular value)
|
||||||
|
#ifdef TEST_MOD_GEOMETRY
|
||||||
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||||
|
portno % 1900 + (i >= npixels / 2 ? 1 : 0);
|
||||||
|
#else
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)pixelVal;
|
virtual_image_test_mode ? 0x0FFE : (uint16_t)pixelVal;
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2532,6 +2567,10 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
int srcOffset = 0;
|
int srcOffset = 0;
|
||||||
int srcOffset2 = DATA_BYTES / 2;
|
int srcOffset2 = DATA_BYTES / 2;
|
||||||
|
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);
|
||||||
|
int col0 = (numInterfaces == 1 ? detPos[0] : detPos[2]);
|
||||||
|
int row1 = detPos[1];
|
||||||
|
int col1 = detPos[0];
|
||||||
// loop packet (128 packets)
|
// loop packet (128 packets)
|
||||||
for (int i = 0; i != maxPacketsPerFrame; ++i) {
|
for (int i = 0; i != maxPacketsPerFrame; ++i) {
|
||||||
|
|
||||||
@ -2551,8 +2590,8 @@ void *start_timer(void *arg) {
|
|||||||
header->frameNumber = frameNr + iframes;
|
header->frameNumber = frameNr + iframes;
|
||||||
header->packetNumber = pnum;
|
header->packetNumber = pnum;
|
||||||
header->modId = 0;
|
header->modId = 0;
|
||||||
header->row = detPos[0];
|
header->row = row0;
|
||||||
header->column = detPos[1];
|
header->column = col0;
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
@ -2578,8 +2617,8 @@ void *start_timer(void *arg) {
|
|||||||
header->frameNumber = frameNr + iframes;
|
header->frameNumber = frameNr + iframes;
|
||||||
header->packetNumber = pnum;
|
header->packetNumber = pnum;
|
||||||
header->modId = 0;
|
header->modId = 0;
|
||||||
header->row = detPos[2];
|
header->row = row1;
|
||||||
header->column = detPos[3];
|
header->column = col1;
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||||
|
Binary file not shown.
@ -436,16 +436,22 @@ void initControlServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
|
if (!updateFlag && initError == OK) {
|
||||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
if (mapCSP0() == FAIL) {
|
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||||
LOG(logERROR,
|
if (mapCSP0() == FAIL) {
|
||||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
initError = FAIL;
|
||||||
exit(EXIT_FAILURE);
|
strcpy(initErrorMessage,
|
||||||
}
|
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
initCheckDone = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up detector */
|
/* set up detector */
|
||||||
@ -706,7 +712,16 @@ void resetPeripheral() {
|
|||||||
|
|
||||||
/* set parameters - dr, adcenablemask */
|
/* set parameters - dr, adcenablemask */
|
||||||
|
|
||||||
int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
|
int setDynamicRange(int dr) {
|
||||||
|
if (dr == 16)
|
||||||
|
return OK;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDynamicRange(int *retval) {
|
||||||
|
*retval = DYNAMIC_RANGE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int setADCEnableMask(uint32_t mask) {
|
int setADCEnableMask(uint32_t mask) {
|
||||||
if (mask == 0u) {
|
if (mask == 0u) {
|
||||||
@ -1716,8 +1731,8 @@ void *start_timer(void *arg) {
|
|||||||
header->frameNumber = frameNr + iframes;
|
header->frameNumber = frameNr + iframes;
|
||||||
header->packetNumber = i;
|
header->packetNumber = i;
|
||||||
header->modId = 0;
|
header->modId = 0;
|
||||||
header->row = detPos[X];
|
header->row = detPos[Y];
|
||||||
header->column = detPos[Y];
|
header->column = detPos[X];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
|
Binary file not shown.
@ -10,20 +10,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/*
|
|
||||||
// Common C/C++ structure to handle pattern data
|
|
||||||
typedef struct __attribute__((packed)) {
|
|
||||||
uint64_t word[MAX_PATTERN_LENGTH];
|
|
||||||
uint64_t ioctrl;
|
|
||||||
uint32_t limits[2];
|
|
||||||
// loop0 start, loop0 stop .. loop2 start, loop2 stop
|
|
||||||
uint32_t loop[6];
|
|
||||||
uint32_t nloop[3];
|
|
||||||
uint32_t wait[3];
|
|
||||||
uint64_t waittime[3];
|
|
||||||
} patternParameters;
|
|
||||||
*/
|
|
||||||
|
|
||||||
int chipStatusRegister = 0;
|
int chipStatusRegister = 0;
|
||||||
|
|
||||||
int setBit(int ibit, int patword) { return patword |= (1 << ibit); }
|
int setBit(int ibit, int patword) { return patword |= (1 << ibit); }
|
||||||
@ -32,44 +18,6 @@ int clearBit(int ibit, int patword) { return patword &= ~(1 << ibit); }
|
|||||||
|
|
||||||
int getChipStatusRegister() { return chipStatusRegister; }
|
int getChipStatusRegister() { return chipStatusRegister; }
|
||||||
|
|
||||||
int gainCapsToCsr(int caps) {
|
|
||||||
// Translates bit representation
|
|
||||||
int csr = 0;
|
|
||||||
if (!(caps & M3_C10pre))
|
|
||||||
csr |= 1 << _CSR_C10pre;
|
|
||||||
if (caps & M3_C15sh)
|
|
||||||
csr |= 1 << CSR_C15sh;
|
|
||||||
if (caps & M3_C30sh)
|
|
||||||
csr |= 1 << CSR_C30sh;
|
|
||||||
if (caps & M3_C50sh)
|
|
||||||
csr |= 1 << CSR_C50sh;
|
|
||||||
if (caps & M3_C225ACsh)
|
|
||||||
csr |= 1 << CSR_C225ACsh;
|
|
||||||
if (!(caps & M3_C15pre))
|
|
||||||
csr |= 1 << _CSR_C15pre;
|
|
||||||
|
|
||||||
return csr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int csrToGainCaps(int csr) {
|
|
||||||
// Translates bit representation
|
|
||||||
int caps = 0;
|
|
||||||
if (!(csr & (1 << _CSR_C10pre)))
|
|
||||||
caps |= M3_C10pre;
|
|
||||||
if (csr & (1 << CSR_C15sh))
|
|
||||||
caps |= M3_C15sh;
|
|
||||||
if (csr & (1 << CSR_C30sh))
|
|
||||||
caps |= M3_C30sh;
|
|
||||||
if (csr & (1 << CSR_C50sh))
|
|
||||||
caps |= M3_C50sh;
|
|
||||||
if (csr & (1 << CSR_C225ACsh))
|
|
||||||
caps |= M3_C225ACsh;
|
|
||||||
if (!(csr & (1 << _CSR_C15pre)))
|
|
||||||
caps |= M3_C15pre;
|
|
||||||
|
|
||||||
return caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
patternParameters *setChipStatusRegisterPattern(int csr) {
|
patternParameters *setChipStatusRegisterPattern(int csr) {
|
||||||
int iaddr = 0;
|
int iaddr = 0;
|
||||||
int nbits = 18;
|
int nbits = 18;
|
||||||
@ -149,54 +97,116 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
|
|||||||
return pat;
|
return pat;
|
||||||
}
|
}
|
||||||
|
|
||||||
patternParameters *setInterpolation(int mask) {
|
int getGainCaps() {
|
||||||
int csr;
|
int csr = chipStatusRegister;
|
||||||
if (mask)
|
// Translates bit representation
|
||||||
csr = chipStatusRegister | (1 << CSR_interp);
|
int caps = 0;
|
||||||
else
|
if (!(csr & (1 << _CSR_C10pre)))
|
||||||
csr = chipStatusRegister & ~(1 << CSR_interp);
|
caps |= M3_C10pre;
|
||||||
|
if (csr & (1 << CSR_C15sh))
|
||||||
|
caps |= M3_C15sh;
|
||||||
|
if (csr & (1 << CSR_C30sh))
|
||||||
|
caps |= M3_C30sh;
|
||||||
|
if (csr & (1 << CSR_C50sh))
|
||||||
|
caps |= M3_C50sh;
|
||||||
|
if (csr & (1 << CSR_C225ACsh))
|
||||||
|
caps |= M3_C225ACsh;
|
||||||
|
if (!(csr & (1 << _CSR_C15pre)))
|
||||||
|
caps |= M3_C15pre;
|
||||||
|
|
||||||
return setChipStatusRegisterPattern(csr);
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
patternParameters *setPumpProbe(int mask) {
|
int M3SetGainCaps(int caps) {
|
||||||
int csr;
|
int csr = chipStatusRegister & ~GAIN_MASK;
|
||||||
if (mask)
|
|
||||||
csr = chipStatusRegister | (1 << CSR_pumprobe);
|
|
||||||
else
|
|
||||||
csr = chipStatusRegister & ~(1 << CSR_pumprobe);
|
|
||||||
|
|
||||||
return setChipStatusRegisterPattern(csr);
|
// Translates bit representation
|
||||||
|
if (!(caps & M3_C10pre))
|
||||||
|
csr |= 1 << _CSR_C10pre;
|
||||||
|
if (caps & M3_C15sh)
|
||||||
|
csr |= 1 << CSR_C15sh;
|
||||||
|
if (caps & M3_C30sh)
|
||||||
|
csr |= 1 << CSR_C30sh;
|
||||||
|
if (caps & M3_C50sh)
|
||||||
|
csr |= 1 << CSR_C50sh;
|
||||||
|
if (caps & M3_C225ACsh)
|
||||||
|
csr |= 1 << CSR_C225ACsh;
|
||||||
|
if (!(caps & M3_C15pre))
|
||||||
|
csr |= 1 << _CSR_C15pre;
|
||||||
|
|
||||||
|
return csr;
|
||||||
}
|
}
|
||||||
patternParameters *setDigitalPulsing(int mask) {
|
|
||||||
|
|
||||||
int csr;
|
int getInterpolation() {
|
||||||
if (mask)
|
return ((chipStatusRegister & CSR_interp_MSK) >> CSR_interp);
|
||||||
csr = chipStatusRegister | (1 << CSR_dpulse);
|
|
||||||
else
|
|
||||||
csr = chipStatusRegister & ~(1 << CSR_dpulse);
|
|
||||||
|
|
||||||
return setChipStatusRegisterPattern(csr);
|
|
||||||
}
|
}
|
||||||
patternParameters *setAnalogPulsing(int mask) {
|
|
||||||
|
|
||||||
int csr;
|
int M3SetInterpolation(int enable) {
|
||||||
if (mask)
|
int csr = 0;
|
||||||
csr = chipStatusRegister | (1 << CSR_apulse);
|
if (enable)
|
||||||
|
csr = chipStatusRegister | CSR_interp_MSK;
|
||||||
else
|
else
|
||||||
csr = chipStatusRegister & ~(1 << CSR_apulse);
|
csr = chipStatusRegister & ~CSR_interp_MSK;
|
||||||
|
return csr;
|
||||||
return setChipStatusRegisterPattern(csr);
|
|
||||||
}
|
}
|
||||||
patternParameters *setNegativePolarity(int mask) {
|
|
||||||
|
|
||||||
int csr;
|
int getPumpProbe() {
|
||||||
if (mask)
|
return ((chipStatusRegister & CSR_pumprobe_MSK) >> CSR_pumprobe);
|
||||||
csr = chipStatusRegister | (1 << CSR_invpol);
|
}
|
||||||
|
|
||||||
|
int M3SetPumpProbe(int enable) {
|
||||||
|
LOG(logINFO, ("%s Pump Probe\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
int csr = 0;
|
||||||
|
if (enable)
|
||||||
|
csr = chipStatusRegister | CSR_pumprobe_MSK;
|
||||||
else
|
else
|
||||||
csr = chipStatusRegister & ~(1 << CSR_invpol);
|
csr = chipStatusRegister & ~CSR_pumprobe_MSK;
|
||||||
|
return csr;
|
||||||
|
}
|
||||||
|
|
||||||
return setChipStatusRegisterPattern(csr);
|
int getDigitalPulsing() {
|
||||||
|
return ((chipStatusRegister & CSR_dpulse_MSK) >> CSR_dpulse);
|
||||||
|
}
|
||||||
|
|
||||||
|
int M3SetDigitalPulsing(int enable) {
|
||||||
|
LOG(logINFO,
|
||||||
|
("%s Digital Pulsing\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
int csr = 0;
|
||||||
|
if (enable)
|
||||||
|
csr = chipStatusRegister | CSR_dpulse_MSK;
|
||||||
|
else
|
||||||
|
csr = chipStatusRegister & ~CSR_dpulse_MSK;
|
||||||
|
return csr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getAnalogPulsing() {
|
||||||
|
return ((chipStatusRegister & CSR_apulse_MSK) >> CSR_apulse);
|
||||||
|
}
|
||||||
|
|
||||||
|
int M3SetAnalogPulsing(int enable) {
|
||||||
|
LOG(logINFO,
|
||||||
|
("%s Analog Pulsing\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
int csr = 0;
|
||||||
|
if (enable)
|
||||||
|
csr = chipStatusRegister | CSR_apulse_MSK;
|
||||||
|
else
|
||||||
|
csr = chipStatusRegister & ~CSR_apulse_MSK;
|
||||||
|
return csr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getNegativePolarity() {
|
||||||
|
return ((chipStatusRegister & CSR_invpol_MSK) >> CSR_invpol);
|
||||||
|
}
|
||||||
|
|
||||||
|
int M3SetNegativePolarity(int enable) {
|
||||||
|
LOG(logINFO,
|
||||||
|
("%s Negative Polarity\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
int csr = 0;
|
||||||
|
if (enable)
|
||||||
|
csr = chipStatusRegister | CSR_invpol_MSK;
|
||||||
|
else
|
||||||
|
csr = chipStatusRegister & ~CSR_invpol_MSK;
|
||||||
|
return csr;
|
||||||
}
|
}
|
||||||
|
|
||||||
patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits) {
|
patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits) {
|
||||||
|
@ -49,6 +49,12 @@
|
|||||||
// shaper)
|
// shaper)
|
||||||
#define _CSR_C15pre 14 // negative polarity
|
#define _CSR_C15pre 14 // negative polarity
|
||||||
|
|
||||||
|
#define CSR_invpol_MSK (0x1 << CSR_invpol)
|
||||||
|
#define CSR_dpulse_MSK (0x1 << CSR_dpulse)
|
||||||
|
#define CSR_interp_MSK (0x1 << CSR_interp)
|
||||||
|
#define CSR_pumprobe_MSK (0x1 << CSR_pumprobe)
|
||||||
|
#define CSR_apulse_MSK (0x1 << CSR_apulse)
|
||||||
|
|
||||||
#define CSR_default (1 << _CSR_C10pre) | (1 << CSR_C30sh)
|
#define CSR_default (1 << _CSR_C10pre) | (1 << CSR_C30sh)
|
||||||
|
|
||||||
#define GAIN_MASK \
|
#define GAIN_MASK \
|
||||||
@ -58,15 +64,20 @@
|
|||||||
int setBit(int ibit, int patword);
|
int setBit(int ibit, int patword);
|
||||||
int clearBit(int ibit, int patword);
|
int clearBit(int ibit, int patword);
|
||||||
int getChipStatusRegister();
|
int getChipStatusRegister();
|
||||||
int gainCapsToCsr(int caps);
|
|
||||||
int csrToGainCaps(int csr);
|
|
||||||
|
|
||||||
patternParameters *setChipStatusRegisterPattern(int csr);
|
patternParameters *setChipStatusRegisterPattern(int csr);
|
||||||
patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits);
|
patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits);
|
||||||
patternParameters *setInterpolation(int mask);
|
int getGainCaps();
|
||||||
patternParameters *setPumpProbe(int mask);
|
int M3SetGainCaps(int caps);
|
||||||
patternParameters *setDigitalPulsing(int mask);
|
int getInterpolation();
|
||||||
patternParameters *setAnalogPulsing(int mask);
|
int M3SetInterpolation(int enable);
|
||||||
patternParameters *setNegativePolarity(int mask);
|
int getPumpProbe();
|
||||||
|
int M3SetPumpProbe(int enable);
|
||||||
|
int getDigitalPulsing();
|
||||||
|
int M3SetDigitalPulsing(int enable);
|
||||||
|
int getAnalogPulsing();
|
||||||
|
int M3SetAnalogPulsing(int enable);
|
||||||
|
int getNegativePolarity();
|
||||||
|
int M3SetNegativePolarity(int enable);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,6 +35,9 @@ extern int isControlServer;
|
|||||||
extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
|
extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
|
||||||
extern void getIpAddressinString(char *cip, uint32_t ip);
|
extern void getIpAddressinString(char *cip, uint32_t ip);
|
||||||
|
|
||||||
|
// Variables that will be exported
|
||||||
|
int masterCommandLine = -1;
|
||||||
|
|
||||||
int initError = OK;
|
int initError = OK;
|
||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
char initErrorMessage[MAX_STR_LENGTH];
|
char initErrorMessage[MAX_STR_LENGTH];
|
||||||
@ -65,6 +68,7 @@ int64_t exptimeReg[NCOUNTERS] = {0, 0, 0};
|
|||||||
int64_t gateDelayReg[NCOUNTERS] = {0, 0, 0};
|
int64_t gateDelayReg[NCOUNTERS] = {0, 0, 0};
|
||||||
int vthEnabledVals[NCOUNTERS] = {0, 0, 0};
|
int vthEnabledVals[NCOUNTERS] = {0, 0, 0};
|
||||||
int detID = 0;
|
int detID = 0;
|
||||||
|
int counterMask = 0x0;
|
||||||
|
|
||||||
int isInitCheckDone() { return initCheckDone; }
|
int isInitCheckDone() { return initCheckDone; }
|
||||||
|
|
||||||
@ -289,6 +293,18 @@ void setModuleId(int modid) {
|
|||||||
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int updateModuleId() {
|
||||||
|
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||||
|
if (initError == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
virtual_moduleid = modid;
|
||||||
|
#endif
|
||||||
|
setModuleId(modid);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
u_int64_t getDetectorMAC() {
|
u_int64_t getDetectorMAC() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
@ -352,16 +368,26 @@ void initControlServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
|
if (!updateFlag && initError == OK) {
|
||||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
if (mapCSP0() == FAIL) {
|
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||||
LOG(logERROR,
|
if (mapCSP0() == FAIL) {
|
||||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
initError = FAIL;
|
||||||
exit(EXIT_FAILURE);
|
strcpy(initErrorMessage,
|
||||||
}
|
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||||
|
LOG(logERROR, (initErrorMessage));
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
|
if (checkCommandLineConfiguration() == FAIL) {
|
||||||
|
initCheckDone = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
initCheckDone = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up detector */
|
/* set up detector */
|
||||||
@ -396,7 +422,7 @@ void allocateDetectorStructureMemory() {
|
|||||||
detectorDacs[idac] = 0;
|
detectorDacs[idac] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// trimbits start at 0 //TODO: restart server will not have 0 always
|
// trimbits start at 0
|
||||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||||
*((detectorModules->chanregs) + ichan) = 0;
|
*((detectorModules->chanregs) + ichan) = 0;
|
||||||
}
|
}
|
||||||
@ -407,6 +433,12 @@ void setupDetector() {
|
|||||||
|
|
||||||
allocateDetectorStructureMemory();
|
allocateDetectorStructureMemory();
|
||||||
|
|
||||||
|
if (checkCommandLineConfiguration() == FAIL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (updateModuleId() == FAIL)
|
||||||
|
return;
|
||||||
|
|
||||||
clkDivider[READOUT_C0] = DEFAULT_READOUT_C0;
|
clkDivider[READOUT_C0] = DEFAULT_READOUT_C0;
|
||||||
clkDivider[READOUT_C1] = DEFAULT_READOUT_C1;
|
clkDivider[READOUT_C1] = DEFAULT_READOUT_C1;
|
||||||
clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0;
|
clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0;
|
||||||
@ -443,27 +475,19 @@ void setupDetector() {
|
|||||||
|
|
||||||
// defaults
|
// defaults
|
||||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||||
resetToDefaultDacs(0);
|
|
||||||
setASICDefaults();
|
setASICDefaults();
|
||||||
setADIFDefaults();
|
setADIFDefaults();
|
||||||
|
|
||||||
// set module id in register
|
// enable all counters before setting dacs (vthx)
|
||||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
setCounterMask(MAX_COUNTER_MSK);
|
||||||
#ifdef VIRTUAL
|
resetToDefaultDacs(0);
|
||||||
virtual_moduleid = modid;
|
|
||||||
#endif
|
|
||||||
if (initError == FAIL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setModuleId(modid);
|
|
||||||
|
|
||||||
// set trigger flow for m3 (for all timing modes)
|
// set trigger flow for m3 (for all timing modes)
|
||||||
bus_w(FLOW_TRIGGER_REG, bus_r(FLOW_TRIGGER_REG) | FLOW_TRIGGER_MSK);
|
bus_w(FLOW_TRIGGER_REG, bus_r(FLOW_TRIGGER_REG) | FLOW_TRIGGER_MSK);
|
||||||
|
|
||||||
// dynamic range
|
// dynamic range
|
||||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||||
// enable all counters
|
|
||||||
setCounterMask(MAX_COUNTER_MSK);
|
|
||||||
|
|
||||||
// Initialization of acquistion parameters
|
// Initialization of acquistion parameters
|
||||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||||
@ -480,10 +504,6 @@ void setupDetector() {
|
|||||||
setInitialExtSignals();
|
setInitialExtSignals();
|
||||||
// 10G UDP
|
// 10G UDP
|
||||||
enableTenGigabitEthernet(1);
|
enableTenGigabitEthernet(1);
|
||||||
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
|
||||||
if (initError == FAIL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setSettings(DEFAULT_SETTINGS);
|
setSettings(DEFAULT_SETTINGS);
|
||||||
|
|
||||||
// check module type attached if not in debug mode
|
// check module type attached if not in debug mode
|
||||||
@ -579,8 +599,8 @@ int resetToDefaultDacs(int hardReset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set to defualt
|
// set to default (last arg to ensure counter check)
|
||||||
setDAC((enum DACINDEX)i, value, 0);
|
setDAC((enum DACINDEX)i, value, 0, 1);
|
||||||
if (detectorDacs[i] != value) {
|
if (detectorDacs[i] != value) {
|
||||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||||
value, detectorDacs[i]));
|
value, detectorDacs[i]));
|
||||||
@ -700,6 +720,27 @@ void setADIFDefaults() {
|
|||||||
ADIF_ADDTNL_OFST_MSK)));
|
ADIF_ADDTNL_OFST_MSK)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int checkCommandLineConfiguration() {
|
||||||
|
if (masterCommandLine != -1) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (masterCommandLine == 1) {
|
||||||
|
bus_w(SYSTEM_STATUS_REG,
|
||||||
|
bus_r(SYSTEM_STATUS_REG) & ~SYSTEM_STATUS_SLV_BRD_DTCT_MSK);
|
||||||
|
} else {
|
||||||
|
bus_w(SYSTEM_STATUS_REG,
|
||||||
|
bus_r(SYSTEM_STATUS_REG) | SYSTEM_STATUS_SLV_BRD_DTCT_MSK);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
initError = FAIL;
|
||||||
|
strcpy(initErrorMessage,
|
||||||
|
"Cannot set Master from command line for this detector. "
|
||||||
|
"Should have been caught before!\n");
|
||||||
|
return FAIL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* firmware functions (resets) */
|
/* firmware functions (resets) */
|
||||||
|
|
||||||
void cleanFifos() {
|
void cleanFifos() {
|
||||||
@ -729,46 +770,54 @@ void resetPeripheral() {
|
|||||||
/* set parameters - dr, roi */
|
/* set parameters - dr, roi */
|
||||||
|
|
||||||
int setDynamicRange(int dr) {
|
int setDynamicRange(int dr) {
|
||||||
if (dr > 0) {
|
if (dr <= 0) {
|
||||||
uint32_t regval = 0;
|
return FAIL;
|
||||||
switch (dr) {
|
|
||||||
/*case 1: TODO:Not implemented in firmware yet
|
|
||||||
regval = CONFIG_DYNAMIC_RANGE_1_VAL;
|
|
||||||
break;*/
|
|
||||||
case 8:
|
|
||||||
regval = CONFIG_DYNAMIC_RANGE_8_VAL;
|
|
||||||
break;
|
|
||||||
case 16:
|
|
||||||
regval = CONFIG_DYNAMIC_RANGE_16_VAL;
|
|
||||||
break;
|
|
||||||
case 32:
|
|
||||||
regval = CONFIG_DYNAMIC_RANGE_24_VAL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG(logERROR, ("Invalid dynamic range %d\n", dr));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// set it
|
|
||||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_DYNAMIC_RANGE_MSK);
|
|
||||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | regval);
|
|
||||||
updatePacketizing();
|
|
||||||
}
|
}
|
||||||
|
uint32_t regval = 0;
|
||||||
|
switch (dr) {
|
||||||
|
/*case 1: TODO:Not implemented in firmware yet
|
||||||
|
regval = CONFIG_DYNAMIC_RANGE_1_VAL;
|
||||||
|
break;*/
|
||||||
|
case 8:
|
||||||
|
regval = CONFIG_DYNAMIC_RANGE_8_VAL;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
regval = CONFIG_DYNAMIC_RANGE_16_VAL;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
regval = CONFIG_DYNAMIC_RANGE_24_VAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG(logERROR, ("Invalid dynamic range %d\n", dr));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// set it
|
||||||
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_DYNAMIC_RANGE_MSK);
|
||||||
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | regval);
|
||||||
|
updatePacketizing();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDynamicRange(int *retval) {
|
||||||
uint32_t regval = bus_r(CONFIG_REG) & CONFIG_DYNAMIC_RANGE_MSK;
|
uint32_t regval = bus_r(CONFIG_REG) & CONFIG_DYNAMIC_RANGE_MSK;
|
||||||
switch (regval) {
|
switch (regval) {
|
||||||
/*case CONFIG_DYNAMIC_RANGE_1_VAL: TODO:Not implemented in firmware yet
|
/*case CONFIG_DYNAMIC_RANGE_1_VAL: TODO:Not implemented in firmware yet
|
||||||
return 1;*/
|
return 1;*/
|
||||||
case CONFIG_DYNAMIC_RANGE_8_VAL:
|
case CONFIG_DYNAMIC_RANGE_8_VAL:
|
||||||
return 8;
|
*retval = 8;
|
||||||
|
break;
|
||||||
case CONFIG_DYNAMIC_RANGE_16_VAL:
|
case CONFIG_DYNAMIC_RANGE_16_VAL:
|
||||||
return 16;
|
*retval = 16;
|
||||||
|
break;
|
||||||
case CONFIG_DYNAMIC_RANGE_24_VAL:
|
case CONFIG_DYNAMIC_RANGE_24_VAL:
|
||||||
return 32;
|
*retval = 32;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("Invalid dynamic range %d read back\n",
|
LOG(logERROR, ("Invalid dynamic range %d read back\n",
|
||||||
regval >> CONFIG_DYNAMIC_RANGE_OFST));
|
regval >> CONFIG_DYNAMIC_RANGE_OFST));
|
||||||
return -1;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set parameters - readout */
|
/* set parameters - readout */
|
||||||
@ -1041,12 +1090,44 @@ int64_t getGateDelay(int gateIndex) {
|
|||||||
return retval / (1E-9 * getFrequency(SYSTEM_C0));
|
return retval / (1E-9 * getFrequency(SYSTEM_C0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateVthAndCounterMask() {
|
||||||
|
LOG(logINFO, ("\tUpdating Vth and countermask\n"));
|
||||||
|
int interpolation = getInterpolation();
|
||||||
|
int pumpProbe = getPumpProbe();
|
||||||
|
|
||||||
|
if (interpolation) {
|
||||||
|
// enable all counters
|
||||||
|
setCounterMaskWithUpdateFlag(MAX_COUNTER_MSK, 0);
|
||||||
|
// disable vth3
|
||||||
|
setVthDac(2, 0);
|
||||||
|
} else {
|
||||||
|
// previous counter values
|
||||||
|
setCounterMaskWithUpdateFlag(counterMask, 0);
|
||||||
|
}
|
||||||
|
if (pumpProbe) {
|
||||||
|
// enable only vth2
|
||||||
|
setVthDac(0, 0);
|
||||||
|
setVthDac(1, 1);
|
||||||
|
setVthDac(2, 0);
|
||||||
|
} else {
|
||||||
|
setVthDac(0, (counterMask & (1 << 0)));
|
||||||
|
setVthDac(1, (counterMask & (1 << 1)));
|
||||||
|
}
|
||||||
|
if (!interpolation && !pumpProbe) {
|
||||||
|
setVthDac(2, (counterMask & (1 << 2)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setCounterMask(uint32_t arg) {
|
void setCounterMask(uint32_t arg) {
|
||||||
|
setCounterMaskWithUpdateFlag(arg, 1);
|
||||||
|
updateVthAndCounterMask();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCounterMaskWithUpdateFlag(uint32_t arg, int updateMaskFlag) {
|
||||||
if (arg == 0 || arg > MAX_COUNTER_MSK) {
|
if (arg == 0 || arg > MAX_COUNTER_MSK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t oldmask = getCounterMask();
|
LOG(logINFO, ("\tSetting counter mask to 0x%x\n", arg));
|
||||||
LOG(logINFO, ("Setting counter mask to 0x%x\n", arg));
|
|
||||||
uint32_t addr = CONFIG_REG;
|
uint32_t addr = CONFIG_REG;
|
||||||
bus_w(addr, bus_r(addr) & ~CONFIG_COUNTERS_ENA_MSK);
|
bus_w(addr, bus_r(addr) & ~CONFIG_COUNTERS_ENA_MSK);
|
||||||
bus_w(addr, bus_r(addr) | ((arg << CONFIG_COUNTERS_ENA_OFST) &
|
bus_w(addr, bus_r(addr) | ((arg << CONFIG_COUNTERS_ENA_OFST) &
|
||||||
@ -1062,19 +1143,8 @@ void setCounterMask(uint32_t arg) {
|
|||||||
setGateDelay(i, ns);
|
setGateDelay(i, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(logINFO, ("\tUpdating Vth dacs\n"));
|
if (updateMaskFlag) {
|
||||||
enum DACINDEX vthdacs[] = {M_VTH1, M_VTH2, M_VTH3};
|
counterMask = arg;
|
||||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
|
||||||
// if change in enable
|
|
||||||
if ((arg & (1 << i)) ^ (oldmask & (1 << i))) {
|
|
||||||
// disable, disable value
|
|
||||||
int value = DEFAULT_COUNTER_DISABLED_VTH_VAL;
|
|
||||||
// enable, set saved values
|
|
||||||
if (arg & (1 << i)) {
|
|
||||||
value = vthEnabledVals[i];
|
|
||||||
}
|
|
||||||
setGeneralDAC(vthdacs[i], value, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1091,7 +1161,8 @@ void updatePacketizing() {
|
|||||||
|
|
||||||
// 10g
|
// 10g
|
||||||
if (tgEnable) {
|
if (tgEnable) {
|
||||||
const int dr = setDynamicRange(-1);
|
int dr = 0;
|
||||||
|
getDynamicRange(&dr);
|
||||||
packetsPerFrame = 1;
|
packetsPerFrame = 1;
|
||||||
if (dr == 32 && ncounters > 1) {
|
if (dr == 32 && ncounters > 1) {
|
||||||
packetsPerFrame = 2;
|
packetsPerFrame = 2;
|
||||||
@ -1194,7 +1265,8 @@ int64_t getMeasurementTime() {
|
|||||||
int setDACS(int *dacs) {
|
int setDACS(int *dacs) {
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
if (dacs[i] != -1) {
|
if (dacs[i] != -1) {
|
||||||
setDAC((enum DACINDEX)i, dacs[i], 0);
|
// set to default (last arg to ensure counter check)
|
||||||
|
setDAC((enum DACINDEX)i, dacs[i], 0, 1);
|
||||||
if (dacs[i] != detectorDacs[i]) {
|
if (dacs[i] != detectorDacs[i]) {
|
||||||
// dont complain if that counter was disabled
|
// dont complain if that counter was disabled
|
||||||
if ((i == M_VTH1 || i == M_VTH2 || i == M_VTH3) &&
|
if ((i == M_VTH1 || i == M_VTH2 || i == M_VTH3) &&
|
||||||
@ -1208,21 +1280,55 @@ int setDACS(int *dacs) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getModule(sls_detector_module* myMod) {
|
||||||
|
// serial number
|
||||||
|
myMod->serialnumber = detectorModules->serialnumber;
|
||||||
|
// csr reg
|
||||||
|
myMod->reg = detectorModules->reg;
|
||||||
|
// eV
|
||||||
|
myMod->eV[0] = detectorModules->eV[0];
|
||||||
|
myMod->eV[1] = detectorModules->eV[1];
|
||||||
|
myMod->eV[2] = detectorModules->eV[2];
|
||||||
|
// dacs
|
||||||
|
for (int idac = 0; idac < (detectorModules->ndac); idac++) {
|
||||||
|
*((myMod->dacs) + idac) = *((detectorModules->dacs) + idac);
|
||||||
|
}
|
||||||
|
// trimbits
|
||||||
|
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||||
|
*((myMod->chanregs) + ichan) = *((detectorModules->chanregs) + ichan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int setModule(sls_detector_module myMod, char *mess) {
|
int setModule(sls_detector_module myMod, char *mess) {
|
||||||
LOG(logINFO, ("Setting module\n"));
|
LOG(logINFO, ("Setting module\n"));
|
||||||
|
|
||||||
|
if (((myMod.nchan) > (detectorModules->nchan)) || ((myMod.ndac) > (detectorModules->ndac))) {
|
||||||
|
strcpy(mess, "Could not set module as the number of channels or dacs do not match to the one in the detector server\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// serial number (pointless)
|
||||||
|
detectorModules->serialnumber = myMod.serialnumber;
|
||||||
|
|
||||||
|
// csr reg
|
||||||
if (setChipStatusRegister(myMod.reg)) {
|
if (setChipStatusRegister(myMod.reg)) {
|
||||||
sprintf(mess, "Could not CSR from module\n");
|
sprintf(mess, "Could not CSR from module\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dacs
|
||||||
if (setDACS(myMod.dacs)) {
|
if (setDACS(myMod.dacs)) {
|
||||||
sprintf(mess, "Could not set dacs\n");
|
sprintf(mess, "Could not set dacs\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update vth and countermask
|
||||||
|
updateVthAndCounterMask();
|
||||||
|
|
||||||
|
// threshold energy
|
||||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||||
if (myMod.eV[i] >= 0) {
|
if (myMod.eV[i] >= 0) {
|
||||||
setThresholdEnergy(i, myMod.eV[i]);
|
setThresholdEnergy(i, myMod.eV[i]);
|
||||||
@ -1253,7 +1359,7 @@ int setTrimbits(int *trimbits) {
|
|||||||
uint32_t prevRunClk = clkDivider[SYSTEM_C0];
|
uint32_t prevRunClk = clkDivider[SYSTEM_C0];
|
||||||
|
|
||||||
// set to trimming clock
|
// set to trimming clock
|
||||||
if (setClockDivider(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV) == FAIL) {
|
if (setClockDividerWithTimeUpdateOption(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV, 0) == FAIL) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Could not start trimming. Could not set to trimming clock\n"));
|
("Could not start trimming. Could not set to trimming clock\n"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -1286,11 +1392,17 @@ int setTrimbits(int *trimbits) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set back to previous clock
|
// set back to previous clock
|
||||||
if (setClockDivider(SYSTEM_C0, prevRunClk) == FAIL) {
|
if (setClockDividerWithTimeUpdateOption(SYSTEM_C0, prevRunClk, 0) == FAIL) {
|
||||||
LOG(logERROR, ("Could not set to previous run clock after trimming\n"));
|
LOG(logERROR, ("Could not set to previous run clock after trimming\n"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copying trimbits locally (if tirmbit value > -1)
|
||||||
|
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||||
|
if (*(trimbits + ichan) >= 0)
|
||||||
|
*((detectorModules->chanregs) + ichan) = *(trimbits + ichan);
|
||||||
|
}
|
||||||
|
|
||||||
return (error ? FAIL : OK);
|
return (error ? FAIL : OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1356,7 +1468,8 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
// set special dacs
|
// set special dacs
|
||||||
const int specialDacs[] = SPECIALDACINDEX;
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
setDAC(specialDacs[i], dacVals[i], 0);
|
// set to default (last arg to ensure counter check)
|
||||||
|
setDAC(specialDacs[i], dacVals[i], 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||||
@ -1364,6 +1477,9 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void validateSettings() {
|
void validateSettings() {
|
||||||
|
LOG(logWARNING, ("Not validating dac settings temporarily"));
|
||||||
|
return;
|
||||||
|
|
||||||
// if any special dac value is changed individually => undefined
|
// if any special dac value is changed individually => undefined
|
||||||
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||||
int *specialDacValues[] = {defaultDacValue_standard, defaultDacValue_fast,
|
int *specialDacValues[] = {defaultDacValue_standard, defaultDacValue_fast,
|
||||||
@ -1413,7 +1529,8 @@ void setThresholdEnergy(int counterIndex, int eV) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parameters - dac, hv */
|
/* parameters - dac, hv */
|
||||||
void setDAC(enum DACINDEX ind, int val, int mV) {
|
// counterEnableCheck false only if setDAC called directly
|
||||||
|
void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck) {
|
||||||
// invalid value
|
// invalid value
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
return;
|
return;
|
||||||
@ -1424,7 +1541,10 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// threshold dacs (remember value, vthreshold: skip disabled)
|
// threshold dacs
|
||||||
|
// remember value, vthreshold: skip disabled,
|
||||||
|
// others: disable or enable dac if counter mask
|
||||||
|
// setDAC called directly: will set independent of counter enable
|
||||||
if (ind == M_VTHRESHOLD || ind == M_VTH1 || ind == M_VTH2 ||
|
if (ind == M_VTHRESHOLD || ind == M_VTH1 || ind == M_VTH2 ||
|
||||||
ind == M_VTH3) {
|
ind == M_VTH3) {
|
||||||
char *dac_names[] = {DAC_NAMES};
|
char *dac_names[] = {DAC_NAMES};
|
||||||
@ -1435,7 +1555,6 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
int dacval = val;
|
int dacval = val;
|
||||||
// if not disabled value, remember value
|
// if not disabled value, remember value
|
||||||
if (dacval != DEFAULT_COUNTER_DISABLED_VTH_VAL) {
|
if (dacval != DEFAULT_COUNTER_DISABLED_VTH_VAL) {
|
||||||
// convert mv to dac
|
|
||||||
if (mV) {
|
if (mV) {
|
||||||
if (LTC2620_D_VoltageToDac(val, &dacval) == FAIL) {
|
if (LTC2620_D_VoltageToDac(val, &dacval) == FAIL) {
|
||||||
return;
|
return;
|
||||||
@ -1445,9 +1564,16 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Remembering %s [%d]\n", dac_names[ind], dacval));
|
("Remembering %s [%d]\n", dac_names[ind], dacval));
|
||||||
}
|
}
|
||||||
// if vthreshold,skip for disabled counters
|
// disabled counter
|
||||||
if ((ind == M_VTHRESHOLD) && (!(counters & (1 << i)))) {
|
if (!(counters & (1 << i))) {
|
||||||
continue;
|
// skip setting vthx dac (value remembered anyway)
|
||||||
|
if (ind == M_VTHRESHOLD) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// disable dac (except when setting dac directly)
|
||||||
|
if (counterEnableCheck) {
|
||||||
|
val = DEFAULT_COUNTER_DISABLED_VTH_VAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setGeneralDAC(vthdacs[i], val, mV);
|
setGeneralDAC(vthdacs[i], val, mV);
|
||||||
}
|
}
|
||||||
@ -1488,6 +1614,19 @@ void setGeneralDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setVthDac(int index, int enable) {
|
||||||
|
LOG(logINFO, ("\t%s vth%d\n", (enable ? "Enabling" : "Disabing"), index));
|
||||||
|
// enables (from remembered values) or disables vthx
|
||||||
|
enum DACINDEX vthdacs[] = {M_VTH1, M_VTH2, M_VTH3};
|
||||||
|
// disable value
|
||||||
|
int value = DEFAULT_COUNTER_DISABLED_VTH_VAL;
|
||||||
|
// enable, set saved values
|
||||||
|
if (enable) {
|
||||||
|
value = vthEnabledVals[index];
|
||||||
|
}
|
||||||
|
setGeneralDAC(vthdacs[index], value, 0);
|
||||||
|
}
|
||||||
|
|
||||||
int getDAC(enum DACINDEX ind, int mV) {
|
int getDAC(enum DACINDEX ind, int mV) {
|
||||||
if (ind == M_VTHRESHOLD) {
|
if (ind == M_VTHRESHOLD) {
|
||||||
int ret = -1, ret1 = -1;
|
int ret = -1, ret1 = -1;
|
||||||
@ -1545,14 +1684,18 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing */
|
/* parameters - timing */
|
||||||
|
|
||||||
int isMaster() {
|
int isMaster(int *retval) {
|
||||||
return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
|
int slave = ((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
|
||||||
SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
|
SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
|
||||||
|
*retval = (slave == 0 ? 1 : 0);
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
|
|
||||||
if (!isMaster() && arg == AUTO_TIMING)
|
int master = 0;
|
||||||
|
isMaster(&master);
|
||||||
|
if (!master && arg == AUTO_TIMING)
|
||||||
arg = TRIGGER_EXPOSURE;
|
arg = TRIGGER_EXPOSURE;
|
||||||
|
|
||||||
uint32_t addr = CONFIG_REG;
|
uint32_t addr = CONFIG_REG;
|
||||||
@ -1638,6 +1781,56 @@ void setInitialExtSignals() {
|
|||||||
DOUTIF_RISING_LNGTH_PORT_1_MSK));
|
DOUTIF_RISING_LNGTH_PORT_1_MSK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setGainCaps(int caps) {
|
||||||
|
LOG(logINFO, ("Setting gain caps to: %u\n", caps));
|
||||||
|
int csr = M3SetGainCaps(caps);
|
||||||
|
return setChipStatusRegister(csr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setInterpolation(int enable) {
|
||||||
|
LOG(logINFO,
|
||||||
|
("%s Interpolation\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
|
||||||
|
int csr = M3SetInterpolation(enable);
|
||||||
|
int ret = setChipStatusRegister(csr);
|
||||||
|
if (ret == OK) {
|
||||||
|
updateVthAndCounterMask();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setPumpProbe(int enable) {
|
||||||
|
LOG(logINFO, ("%s Pump Probe\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
|
||||||
|
int csr = M3SetPumpProbe(enable);
|
||||||
|
int ret = setChipStatusRegister(csr);
|
||||||
|
if (ret == OK) {
|
||||||
|
updateVthAndCounterMask();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDigitalPulsing(int enable) {
|
||||||
|
LOG(logINFO,
|
||||||
|
("%s Digital Pulsing\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
int csr = M3SetDigitalPulsing(enable);
|
||||||
|
return setChipStatusRegister(csr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setAnalogPulsing(int enable) {
|
||||||
|
LOG(logINFO,
|
||||||
|
("%s Analog Pulsing\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
int csr = M3SetAnalogPulsing(enable);
|
||||||
|
return setChipStatusRegister(csr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setNegativePolarity(int enable) {
|
||||||
|
LOG(logINFO,
|
||||||
|
("%s Negative Polarity\n", enable == 0 ? "Disabling" : "Enabling"));
|
||||||
|
int csr = M3SetNegativePolarity(enable);
|
||||||
|
return setChipStatusRegister(csr);
|
||||||
|
}
|
||||||
|
|
||||||
void setExtSignal(int signalIndex, enum externalSignalFlag mode) {
|
void setExtSignal(int signalIndex, enum externalSignalFlag mode) {
|
||||||
LOG(logDEBUG1, ("Setting signal flag[%d] to %d\n", signalIndex, mode));
|
LOG(logDEBUG1, ("Setting signal flag[%d] to %d\n", signalIndex, mode));
|
||||||
|
|
||||||
@ -1841,7 +2034,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
// row
|
// row
|
||||||
value = detPos[X];
|
value = detPos[Y];
|
||||||
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
||||||
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||||
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||||
@ -1852,7 +2045,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// col
|
// col
|
||||||
value = detPos[Y];
|
value = detPos[X];
|
||||||
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
||||||
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||||
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||||
@ -1863,7 +2056,8 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
LOG(logINFO,
|
||||||
|
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -2074,6 +2268,10 @@ int getVCOFrequency(enum CLKINDEX ind) {
|
|||||||
int getMaxClockDivider() { return ALTERA_PLL_C10_GetMaxClockDivider(); }
|
int getMaxClockDivider() { return ALTERA_PLL_C10_GetMaxClockDivider(); }
|
||||||
|
|
||||||
int setClockDivider(enum CLKINDEX ind, int val) {
|
int setClockDivider(enum CLKINDEX ind, int val) {
|
||||||
|
return setClockDividerWithTimeUpdateOption(ind, val, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setClockDividerWithTimeUpdateOption(enum CLKINDEX ind, int val, int timeUpdate) {
|
||||||
if (ind < 0 || ind >= NUM_CLOCKS) {
|
if (ind < 0 || ind >= NUM_CLOCKS) {
|
||||||
LOG(logERROR, ("Unknown clock index %d to set clock divider\n", ind));
|
LOG(logERROR, ("Unknown clock index %d to set clock divider\n", ind));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -2098,6 +2296,32 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||||
ALTERA_PLL_C10_SetOuputClockDivider(pllIndex, clkIndex, val);
|
ALTERA_PLL_C10_SetOuputClockDivider(pllIndex, clkIndex, val);
|
||||||
|
|
||||||
|
// Update time settings that depend on system frequency
|
||||||
|
// timeUpdate = 0 for setChipRegister/setTrimbits etc
|
||||||
|
// as clk reverted back again
|
||||||
|
if (timeUpdate && ind == SYSTEM_C0) {
|
||||||
|
LOG(logINFO, ("\tUpdating time settings (sys freq change)\n"));
|
||||||
|
int64_t exptime[3] = {0, 0, 0};
|
||||||
|
int64_t gateDelay[3] = {0, 0, 0};
|
||||||
|
for (int i = 0; i != 3; ++i) {
|
||||||
|
exptime[i] = getExpTime(i);
|
||||||
|
gateDelay[i] = getGateDelay(i);
|
||||||
|
}
|
||||||
|
int64_t period = getPeriod();
|
||||||
|
int64_t delayAfterTrigger = getDelayAfterTrigger();
|
||||||
|
|
||||||
|
clkDivider[ind] = val;
|
||||||
|
|
||||||
|
for (int i = 0; i != 3; ++i) {
|
||||||
|
setExpTime(i, exptime[i]);
|
||||||
|
setGateDelay(i, gateDelay[i]);
|
||||||
|
}
|
||||||
|
setPeriod(period);
|
||||||
|
setDelayAfterTrigger(delayAfterTrigger);
|
||||||
|
LOG(logINFO, ("\tDone updating time settings\n"));
|
||||||
|
}
|
||||||
|
|
||||||
clkDivider[ind] = val;
|
clkDivider[ind] = val;
|
||||||
LOG(logINFO, ("\t%s clock (%d) divider set to %d\n", clock_names[ind], ind,
|
LOG(logINFO, ("\t%s clock (%d) divider set to %d\n", clock_names[ind], ind,
|
||||||
clkDivider[ind]));
|
clkDivider[ind]));
|
||||||
@ -2202,7 +2426,8 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
const int imageSize = calculateDataBytes();
|
const int imageSize = calculateDataBytes();
|
||||||
const int tgEnable = enableTenGigabitEthernet(-1);
|
const int tgEnable = enableTenGigabitEthernet(-1);
|
||||||
const int dr = setDynamicRange(-1);
|
int dr = 0;
|
||||||
|
getDynamicRange(&dr);
|
||||||
int ncounters = __builtin_popcount(getCounterMask());
|
int ncounters = __builtin_popcount(getCounterMask());
|
||||||
int dataSize = 0;
|
int dataSize = 0;
|
||||||
int packetsPerFrame = 0;
|
int packetsPerFrame = 0;
|
||||||
@ -2212,6 +2437,7 @@ void *start_timer(void *arg) {
|
|||||||
if (dr == 32 && ncounters > 1) {
|
if (dr == 32 && ncounters > 1) {
|
||||||
packetsPerFrame = 2;
|
packetsPerFrame = 2;
|
||||||
}
|
}
|
||||||
|
dataSize = imageSize / packetsPerFrame;
|
||||||
}
|
}
|
||||||
// 1g
|
// 1g
|
||||||
else {
|
else {
|
||||||
@ -2233,27 +2459,22 @@ void *start_timer(void *arg) {
|
|||||||
{
|
{
|
||||||
const int nchannels = NCHAN_1_COUNTER * NCHIP * ncounters;
|
const int nchannels = NCHAN_1_COUNTER * NCHIP * ncounters;
|
||||||
|
|
||||||
switch (dr) {
|
for (int i = 0; i < nchannels; ++i) {
|
||||||
/*case 1: // TODO: Not implemented in firmware yet
|
switch (dr) {
|
||||||
break;*/
|
//case 1: // TODO: Not implemented in firmware yet
|
||||||
case 8:
|
// break;
|
||||||
for (int i = 0; i < nchannels; ++i) {
|
case 8:
|
||||||
*((uint8_t *)(imageData + i)) = (uint8_t)i;
|
*((uint8_t *)(imageData + i)) = (uint8_t)i;
|
||||||
}
|
break;
|
||||||
break;
|
case 16:
|
||||||
case 16:
|
|
||||||
for (int i = 0; i < nchannels; ++i) {
|
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = (uint16_t)i;
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = (uint16_t)i;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
*((uint32_t *)(imageData + i * sizeof(uint32_t))) = ((uint32_t)i & 0xFFFFFF); // 24 bit
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case 32:
|
|
||||||
for (int i = 0; i < nchannels; ++i) {
|
|
||||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
|
||||||
((uint32_t)i & 0xFFFFFF); // 24 bit
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2271,6 +2492,7 @@ void *start_timer(void *arg) {
|
|||||||
clock_gettime(CLOCK_REALTIME, &begin);
|
clock_gettime(CLOCK_REALTIME, &begin);
|
||||||
usleep(expUs);
|
usleep(expUs);
|
||||||
|
|
||||||
|
|
||||||
int srcOffset = 0;
|
int srcOffset = 0;
|
||||||
// loop packet
|
// loop packet
|
||||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||||
@ -2284,14 +2506,13 @@ void *start_timer(void *arg) {
|
|||||||
header->frameNumber = virtual_currentFrameNumber;
|
header->frameNumber = virtual_currentFrameNumber;
|
||||||
header->packetNumber = i;
|
header->packetNumber = i;
|
||||||
header->modId = virtual_moduleid;
|
header->modId = virtual_moduleid;
|
||||||
header->row = detPos[X];
|
header->row = detPos[Y];
|
||||||
header->column = detPos[Y];
|
header->column = detPos[X];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
imageData + srcOffset, dataSize);
|
imageData + srcOffset, dataSize);
|
||||||
srcOffset += dataSize;
|
srcOffset += dataSize;
|
||||||
|
|
||||||
sendUDPPacket(0, 0, packetData, packetSize);
|
sendUDPPacket(0, 0, packetData, packetSize);
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Sent frame: %d [%lld]\n", frameNr,
|
LOG(logINFO, ("Sent frame: %d [%lld]\n", frameNr,
|
||||||
@ -2471,59 +2692,10 @@ u_int32_t runBusy() {
|
|||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
|
||||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
|
||||||
LOG(logDEBUG1, ("Copying module\n"));
|
|
||||||
|
|
||||||
if (srcMod->serialnumber >= 0) {
|
|
||||||
destMod->serialnumber = srcMod->serialnumber;
|
|
||||||
}
|
|
||||||
// no trimbit feature
|
|
||||||
if (destMod->nchan && ((srcMod->nchan) > (destMod->nchan))) {
|
|
||||||
LOG(logINFO, ("Number of channels of source is larger than number of "
|
|
||||||
"channels of destination\n"));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
if ((srcMod->ndac) > (destMod->ndac)) {
|
|
||||||
LOG(logINFO, ("Number of dacs of source is larger than number of dacs "
|
|
||||||
"of destination\n"));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG(logDEBUG1, ("DACs: src %d, dest %d\n", srcMod->ndac, destMod->ndac));
|
|
||||||
LOG(logDEBUG1, ("Chans: src %d, dest %d\n", srcMod->nchan, destMod->nchan));
|
|
||||||
if (srcMod->reg >= 0)
|
|
||||||
destMod->reg = srcMod->reg;
|
|
||||||
/*
|
|
||||||
if (srcMod->iodelay >= 0)
|
|
||||||
destMod->iodelay = srcMod->iodelay;
|
|
||||||
if (srcMod->tau >= 0)
|
|
||||||
destMod->tau = srcMod->tau;
|
|
||||||
*/
|
|
||||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
|
||||||
if (srcMod->eV[i] >= 0)
|
|
||||||
destMod->eV[i] = srcMod->eV[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Copying register %x (%x)\n", destMod->reg, srcMod->reg));
|
|
||||||
|
|
||||||
if (destMod->nchan != 0 && srcMod->nchan != 0) {
|
|
||||||
for (int ichan = 0; ichan < (srcMod->nchan); ichan++) {
|
|
||||||
*((destMod->chanregs) + ichan) = *((srcMod->chanregs) + ichan);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
LOG(logINFO, ("Not Copying trimbits\n"));
|
|
||||||
|
|
||||||
for (int idac = 0; idac < (srcMod->ndac); idac++) {
|
|
||||||
if (*((srcMod->dacs) + idac) >= 0) {
|
|
||||||
*((destMod->dacs) + idac) = *((srcMod->dacs) + idac);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int calculateDataBytes() {
|
int calculateDataBytes() {
|
||||||
int numCounters = __builtin_popcount(getCounterMask());
|
int numCounters = __builtin_popcount(getCounterMask());
|
||||||
int dr = setDynamicRange(-1);
|
int dr = 0;
|
||||||
|
getDynamicRange(&dr);
|
||||||
return (NCHAN_1_COUNTER * NCHIP * numCounters * ((double)dr / 8.00));
|
return (NCHAN_1_COUNTER * NCHIP * numCounters * ((double)dr / 8.00));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2540,7 +2712,7 @@ int setChipStatusRegister(int csr) {
|
|||||||
uint32_t prevRunClk = clkDivider[SYSTEM_C0];
|
uint32_t prevRunClk = clkDivider[SYSTEM_C0];
|
||||||
|
|
||||||
// set to trimming clock
|
// set to trimming clock
|
||||||
if (setClockDivider(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV) == FAIL) {
|
if (setClockDividerWithTimeUpdateOption(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV, 0) == FAIL) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Could not set to trimming clock in order to change CSR\n"));
|
("Could not set to trimming clock in order to change CSR\n"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -2562,29 +2734,12 @@ int setChipStatusRegister(int csr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set back to previous clock
|
// set back to previous clock
|
||||||
if (setClockDivider(SYSTEM_C0, prevRunClk) == FAIL) {
|
if (setClockDividerWithTimeUpdateOption(SYSTEM_C0, prevRunClk, 0) == FAIL) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Could not set to previous run clock after changing CSR\n"));
|
("Could not set to previous run clock after changing CSR\n"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detectorModules->reg = csr;
|
||||||
return iret;
|
return iret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setGainCaps(int caps) {
|
|
||||||
LOG(logINFO, ("Setting gain caps to: %u\n", caps));
|
|
||||||
// Update only gain caps, leave the rest of the CSR unchanged
|
|
||||||
int csr = getChipStatusRegister();
|
|
||||||
csr &= ~GAIN_MASK;
|
|
||||||
|
|
||||||
caps = gainCapsToCsr(caps);
|
|
||||||
// caps &= GAIN_MASK;
|
|
||||||
csr |= caps;
|
|
||||||
return setChipStatusRegister(csr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int getGainCaps() {
|
|
||||||
int csr = getChipStatusRegister();
|
|
||||||
int caps = csrToGainCaps(csr);
|
|
||||||
return caps;
|
|
||||||
}
|
|
||||||
|
@ -105,7 +105,7 @@ enum DACINDEX {
|
|||||||
1220, /* vIpreOut */ \
|
1220, /* vIpreOut */ \
|
||||||
2800, /* Vth3 */ \
|
2800, /* Vth3 */ \
|
||||||
2800, /* Vth1 */ \
|
2800, /* Vth1 */ \
|
||||||
1708, /* vIcin */ \
|
800, /* vIcin */ \
|
||||||
1800, /* cas */ \
|
1800, /* cas */ \
|
||||||
1100, /* Vrpreamp */ \
|
1100, /* Vrpreamp */ \
|
||||||
1100, /* Vcal_n */ \
|
1100, /* Vcal_n */ \
|
||||||
|
@ -66,3 +66,5 @@ int moveBinaryFile(char *mess, char *dest, char *src, char *errorPrefix);
|
|||||||
|
|
||||||
int createEmptyFile(char *mess, char *fname, char *errorPrefix);
|
int createEmptyFile(char *mess, char *fname, char *errorPrefix);
|
||||||
int deleteFile(char *mess, char *fname, char *errorPrefix);
|
int deleteFile(char *mess, char *fname, char *errorPrefix);
|
||||||
|
|
||||||
|
int deleteOldServers(char *mess, char *newServerPath, char *errorPrefix);
|
||||||
|
@ -26,6 +26,7 @@ int receiveData(int file_des, void *buf, int length, intType itype);
|
|||||||
int sendDataOnly(int file_des, void *buf, int length);
|
int sendDataOnly(int file_des, void *buf, int length);
|
||||||
int receiveDataOnly(int file_des, void *buf, int length);
|
int receiveDataOnly(int file_des, void *buf, int length);
|
||||||
|
|
||||||
|
int sendModule(int file_des, sls_detector_module *myMod);
|
||||||
int receiveModule(int file_des, sls_detector_module *myMod);
|
int receiveModule(int file_des, sls_detector_module *myMod);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#define BLACKFIN_DEFINED
|
#define BLACKFIN_DEFINED
|
||||||
|
|
||||||
int defineGPIOpins(char *mess);
|
int defineGPIOpins(char *mess);
|
||||||
int FPGAdontTouchFlash(char *mess);
|
int FPGAdontTouchFlash(char *mess, int programming);
|
||||||
int FPGATouchFlash(char *mess);
|
int FPGATouchFlash(char *mess, int programming);
|
||||||
int resetFPGA(char *mess);
|
int resetFPGA(char *mess);
|
||||||
|
|
||||||
int emptyTempFolder(char *mess);
|
int emptyTempFolder(char *mess);
|
||||||
@ -26,10 +26,12 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd,
|
|||||||
uint64_t fsize);
|
uint64_t fsize);
|
||||||
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
||||||
char *functionType, char *clientChecksum,
|
char *functionType, char *clientChecksum,
|
||||||
ssize_t fsize);
|
ssize_t fsize, int forceDeleteNormalFile);
|
||||||
int getDrive(char *mess, enum PROGRAM_INDEX index);
|
int getDrive(char *mess, enum PROGRAM_INDEX index);
|
||||||
/** Notify fpga not to touch flash, open src and flash drive to write */
|
/** Notify fpga not to touch flash, open src and flash drive to write */
|
||||||
int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd);
|
int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
|
||||||
|
int forceDeleteNormalFile);
|
||||||
|
int checkNormalFile(char *mess, enum PROGRAM_INDEX index, int forceDeleteNormalFile);
|
||||||
int eraseFlash(char *mess);
|
int eraseFlash(char *mess);
|
||||||
/* write from tmp file to flash */
|
/* write from tmp file to flash */
|
||||||
int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd);
|
int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd);
|
||||||
|
@ -97,6 +97,9 @@ u_int32_t getDetectorNumber();
|
|||||||
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)
|
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)
|
||||||
int getModuleId(int *ret, char *mess);
|
int getModuleId(int *ret, char *mess);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(EIGERD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
int updateModuleId();
|
||||||
|
#endif
|
||||||
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
||||||
void setModuleId(int modid);
|
void setModuleId(int modid);
|
||||||
#endif
|
#endif
|
||||||
@ -110,7 +113,11 @@ u_int32_t getBoardRevision();
|
|||||||
void initControlServer();
|
void initControlServer();
|
||||||
void initStopServer();
|
void initStopServer();
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
void getModuleConfiguration();
|
int updateModuleConfiguration();
|
||||||
|
int getModuleConfiguration(int *m, int *t, int *n);
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
void checkVirtual9MFlag();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set up detector
|
// set up detector
|
||||||
@ -137,6 +144,10 @@ void setADIFDefaults();
|
|||||||
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)
|
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)
|
||||||
int readConfigFile();
|
int readConfigFile();
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||||
|
defined(MYTHEN3D)
|
||||||
|
int checkCommandLineConfiguration();
|
||||||
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
void resetToHardwareSettings();
|
void resetToHardwareSettings();
|
||||||
#endif
|
#endif
|
||||||
@ -173,6 +184,7 @@ void setMasterSlaveConfiguration();
|
|||||||
|
|
||||||
// parameters - dr, roi
|
// parameters - dr, roi
|
||||||
int setDynamicRange(int dr);
|
int setDynamicRange(int dr);
|
||||||
|
int getDynamicRange(int *retval);
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
int setROI(ROI arg);
|
int setROI(ROI arg);
|
||||||
ROI getROI();
|
ROI getROI();
|
||||||
@ -269,6 +281,7 @@ int getNumDigitalSamples();
|
|||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
void setCounterMask(uint32_t arg);
|
void setCounterMask(uint32_t arg);
|
||||||
|
void setCounterMaskWithUpdateFlag(uint32_t arg, int updateMaskFlag);
|
||||||
uint32_t getCounterMask();
|
uint32_t getCounterMask();
|
||||||
void updatePacketizing();
|
void updatePacketizing();
|
||||||
#endif
|
#endif
|
||||||
@ -296,9 +309,16 @@ int64_t getMeasurementTime();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parameters - module, settings
|
// parameters - module, settings
|
||||||
|
#if defined(MYTHEN3D) || defined(EIGERD)
|
||||||
|
void getModule(sls_detector_module* myMod);
|
||||||
|
#endif
|
||||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(GOTTHARD2D))
|
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(GOTTHARD2D))
|
||||||
int setModule(sls_detector_module myMod, char *mess);
|
int setModule(sls_detector_module myMod, char *mess);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EIGERD
|
||||||
|
int setTrimbits(int* chanregs, char* mess);
|
||||||
|
#endif
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
int setTrimbits(int *trimbits);
|
int setTrimbits(int *trimbits);
|
||||||
int setAllTrimbits(int val);
|
int setAllTrimbits(int val);
|
||||||
@ -328,9 +348,12 @@ void setThresholdEnergy(int counterIndex, int eV);
|
|||||||
int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val);
|
int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val);
|
||||||
int getOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex);
|
int getOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex);
|
||||||
#endif
|
#endif
|
||||||
void setDAC(enum DACINDEX ind, int val, int mV);
|
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
|
void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck);
|
||||||
void setGeneralDAC(enum DACINDEX ind, int val, int mV);
|
void setGeneralDAC(enum DACINDEX ind, int val, int mV);
|
||||||
|
void setVthDac(int index, int enable);
|
||||||
|
#else
|
||||||
|
void setDAC(enum DACINDEX ind, int val, int mV);
|
||||||
#endif
|
#endif
|
||||||
int getDAC(enum DACINDEX ind, int mV);
|
int getDAC(enum DACINDEX ind, int mV);
|
||||||
int getMaxDacSteps();
|
int getMaxDacSteps();
|
||||||
@ -362,9 +385,16 @@ int getADC(enum ADCINDEX ind);
|
|||||||
int setHighVoltage(int val);
|
int setHighVoltage(int val);
|
||||||
|
|
||||||
// parameters - timing, extsig
|
// parameters - timing, extsig
|
||||||
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD)
|
#ifdef EIGERD
|
||||||
int isMaster();
|
int setMaster(enum MASTERINDEX m);
|
||||||
|
int setTop(enum TOPINDEX t);
|
||||||
|
int isTop(int *retval);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
|
||||||
|
defined(GOTTHARD2D)
|
||||||
|
int isMaster(int *retval);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef GOTTHARD2D
|
#ifdef GOTTHARD2D
|
||||||
void updatingRegisters();
|
void updatingRegisters();
|
||||||
#endif
|
#endif
|
||||||
@ -372,9 +402,13 @@ void setTiming(enum timingMode arg);
|
|||||||
enum timingMode getTiming();
|
enum timingMode getTiming();
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
void setInitialExtSignals();
|
void setInitialExtSignals();
|
||||||
int setGainCaps(int caps);
|
|
||||||
int getGainCaps();
|
|
||||||
int setChipStatusRegister(int csr);
|
int setChipStatusRegister(int csr);
|
||||||
|
int setGainCaps(int caps);
|
||||||
|
int setInterpolation(int enable);
|
||||||
|
int setPumpProbe(int enable);
|
||||||
|
int setDigitalPulsing(int enable);
|
||||||
|
int setAnalogPulsing(int enable);
|
||||||
|
int setNegativePolarity(int enable);
|
||||||
int setDACS(int *dacs);
|
int setDACS(int *dacs);
|
||||||
#endif
|
#endif
|
||||||
#if defined(GOTTHARDD) || defined(MYTHEN3D)
|
#if defined(GOTTHARDD) || defined(MYTHEN3D)
|
||||||
@ -535,6 +569,7 @@ int getFrequency(enum CLKINDEX ind);
|
|||||||
int getVCOFrequency(enum CLKINDEX ind);
|
int getVCOFrequency(enum CLKINDEX ind);
|
||||||
int getMaxClockDivider();
|
int getMaxClockDivider();
|
||||||
int setClockDivider(enum CLKINDEX ind, int val);
|
int setClockDivider(enum CLKINDEX ind, int val);
|
||||||
|
int setClockDividerWithTimeUpdateOption(enum CLKINDEX ind, int val, int timeUpdate);
|
||||||
int getClockDivider(enum CLKINDEX ind);
|
int getClockDivider(enum CLKINDEX ind);
|
||||||
|
|
||||||
#elif GOTTHARD2D
|
#elif GOTTHARD2D
|
||||||
@ -639,9 +674,6 @@ u_int32_t runState(enum TLogLevel lev);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// common
|
// common
|
||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
|
||||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
|
|
||||||
#endif
|
|
||||||
int calculateDataBytes();
|
int calculateDataBytes();
|
||||||
int getTotalNumberOfChannels();
|
int getTotalNumberOfChannels();
|
||||||
#if defined(MOENCHD) || defined(CHIPTESTBOARDD)
|
#if defined(MOENCHD) || defined(CHIPTESTBOARDD)
|
||||||
|
@ -132,7 +132,6 @@ int check_version(int);
|
|||||||
int software_trigger(int);
|
int software_trigger(int);
|
||||||
int led(int);
|
int led(int);
|
||||||
int digital_io_delay(int);
|
int digital_io_delay(int);
|
||||||
int copy_detector_server(int);
|
|
||||||
int reboot_controller(int);
|
int reboot_controller(int);
|
||||||
int set_adc_enable_mask(int);
|
int set_adc_enable_mask(int);
|
||||||
int get_adc_enable_mask(int);
|
int get_adc_enable_mask(int);
|
||||||
@ -245,6 +244,7 @@ int get_pattern(int);
|
|||||||
int load_default_pattern(int);
|
int load_default_pattern(int);
|
||||||
int get_all_threshold_energy(int);
|
int get_all_threshold_energy(int);
|
||||||
int get_master(int);
|
int get_master(int);
|
||||||
|
int set_master(int);
|
||||||
int get_csr();
|
int get_csr();
|
||||||
int set_gain_caps(int);
|
int set_gain_caps(int);
|
||||||
int get_gain_caps(int);
|
int get_gain_caps(int);
|
||||||
@ -284,9 +284,23 @@ int update_detector_server(int);
|
|||||||
int receive_program(int file_des, enum PROGRAM_INDEX index);
|
int receive_program(int file_des, enum PROGRAM_INDEX index);
|
||||||
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
||||||
char *functionType, uint64_t filesize,
|
char *functionType, uint64_t filesize,
|
||||||
char *checksum, char *serverName);
|
char *checksum, char *serverName,
|
||||||
|
int forceDeleteNormalFile);
|
||||||
void receive_program_default(int file_des, enum PROGRAM_INDEX index,
|
void receive_program_default(int file_des, enum PROGRAM_INDEX index,
|
||||||
char *functionType, uint64_t filesize,
|
char *functionType, uint64_t filesize,
|
||||||
char *checksum, char *serverName);
|
char *checksum, char *serverName);
|
||||||
int get_update_mode(int);
|
int get_update_mode(int);
|
||||||
int set_update_mode(int);
|
int set_update_mode(int);
|
||||||
|
int get_top(int);
|
||||||
|
int set_top(int);
|
||||||
|
int get_polarity(int);
|
||||||
|
int set_polarity(int);
|
||||||
|
int get_interpolation(int);
|
||||||
|
int set_interpolation(int);
|
||||||
|
int get_pump_probe(int);
|
||||||
|
int set_pump_probe(int);
|
||||||
|
int get_analog_pulsing(int);
|
||||||
|
int set_analog_pulsing(int);
|
||||||
|
int get_digital_pulsing(int);
|
||||||
|
int set_digital_pulsing(int);
|
||||||
|
int get_module(int);
|
||||||
|
@ -50,6 +50,10 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
||||||
|
if (fname[0] == '/') {
|
||||||
|
strcpy(buf, fname);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
// get path of current binary
|
// get path of current binary
|
||||||
char path[bufSize];
|
char path[bufSize];
|
||||||
memset(path, 0, bufSize);
|
memset(path, 0, bufSize);
|
||||||
@ -60,10 +64,14 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
|||||||
}
|
}
|
||||||
path[len] = '\0';
|
path[len] = '\0';
|
||||||
|
|
||||||
// get dir path and attach config file name
|
// get dir path and attach file name
|
||||||
char *dir = dirname(path);
|
char *dir = dirname(path);
|
||||||
memset(buf, 0, bufSize);
|
memset(buf, 0, bufSize);
|
||||||
sprintf(buf, "%s/%s", dir, fname);
|
if (!strcmp(dir, "/")) {
|
||||||
|
sprintf(buf, "/%s", fname);
|
||||||
|
} else {
|
||||||
|
sprintf(buf, "%s/%s", dir, fname);
|
||||||
|
}
|
||||||
LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf));
|
LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -466,7 +474,7 @@ int setupDetectorServer(char *mess, char *sname) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSymbolic link created\n"));
|
LOG(logINFO, ("\tSymbolic link created %s -> %s\n", linkname, sname));
|
||||||
|
|
||||||
// blackfin boards (respawn) (only kept for backwards compatibility)
|
// blackfin boards (respawn) (only kept for backwards compatibility)
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
@ -485,7 +493,7 @@ int setupDetectorServer(char *mess, char *sname) {
|
|||||||
|
|
||||||
// add new link name to /etc/inittab
|
// add new link name to /etc/inittab
|
||||||
if (snprintf(cmd, MAX_STR_LENGTH,
|
if (snprintf(cmd, MAX_STR_LENGTH,
|
||||||
"echo 'ttyS0::respawn:/./%s' >> /etc/inittab",
|
"echo 'ttyS0::respawn:%s' >> /etc/inittab",
|
||||||
linkname) >= MAX_STR_LENGTH) {
|
linkname) >= MAX_STR_LENGTH) {
|
||||||
strcpy(mess, "Could not copy detector server. Command "
|
strcpy(mess, "Could not copy detector server. Command "
|
||||||
"to add new server for spawning is too long\n");
|
"to add new server for spawning is too long\n");
|
||||||
@ -670,3 +678,26 @@ int deleteFile(char *mess, char *fname, char *errorPrefix) {
|
|||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int deleteOldServers(char *mess, char *newServerPath, char *errorPrefix) {
|
||||||
|
LOG(logINFO, ("\tChecking if current binary is to be deleted ...\n"))
|
||||||
|
// get path of current binary (get file name if link)
|
||||||
|
char currentBinary[MAX_STR_LENGTH];
|
||||||
|
memset(currentBinary, 0, MAX_STR_LENGTH);
|
||||||
|
ssize_t len = readlink("/proc/self/exe", currentBinary, MAX_STR_LENGTH - 1);
|
||||||
|
if (len < 0) {
|
||||||
|
LOG(logWARNING, ("(%s): Could not delete old servers. Could not "
|
||||||
|
"readlink current binary\n",
|
||||||
|
errorPrefix));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
currentBinary[len] = '\0';
|
||||||
|
LOG(logDEBUG1, ("Current binary:%s\n", currentBinary));
|
||||||
|
|
||||||
|
// delete file
|
||||||
|
if (deleteFile(mess, currentBinary, errorPrefix) == FAIL) {
|
||||||
|
LOG(logWARNING, ("(%s). Could not delete old servers\n", errorPrefix));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
@ -406,66 +406,139 @@ int receiveDataOnly(int file_des, void *buf, int length) {
|
|||||||
return total_received;
|
return total_received;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sendModule(int file_des, sls_detector_module *myMod) {
|
||||||
|
enum TLogLevel level = logDEBUG1;
|
||||||
|
LOG(level, ("Sending Module\n"));
|
||||||
|
int ts = 0, n = 0;
|
||||||
|
|
||||||
|
n = sendData(file_des, &(myMod->serialnumber),
|
||||||
|
sizeof(myMod->serialnumber), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("serialno sent %d bytes. serialno: %d\n", n,
|
||||||
|
myMod->serialnumber));
|
||||||
|
n = sendData(file_des, &(myMod->nchan), sizeof(myMod->nchan), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("nchan sent %d bytes. nchan: %d\n", n, myMod->nchan));
|
||||||
|
n = sendData(file_des, &(myMod->nchip), sizeof(myMod->nchip), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("nchip sent %d bytes. nchip: %d\n", n, myMod->nchip));
|
||||||
|
n = sendData(file_des, &(myMod->ndac), sizeof(myMod->ndac), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("ndac sent %d bytes. ndac: %d\n", n, myMod->ndac));
|
||||||
|
n = sendData(file_des, &(myMod->reg), sizeof(myMod->reg), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("reg sent %d bytes. reg: %d\n", n, myMod->reg));
|
||||||
|
n = sendData(file_des, &(myMod->iodelay), sizeof(myMod->iodelay), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level,
|
||||||
|
("iodelay sent %d bytes. iodelay: %d\n", n, myMod->iodelay));
|
||||||
|
n = sendData(file_des, &(myMod->tau), sizeof(myMod->tau), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("tau sent %d bytes. tau: %d\n", n, myMod->tau));
|
||||||
|
n = sendData(file_des, myMod->eV, sizeof(myMod->eV), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("eV sent %d bytes. eV: %d\n", n, myMod->eV[0]));
|
||||||
|
// dacs
|
||||||
|
n = sendData(file_des, myMod->dacs, sizeof(int) * (myMod->ndac), INT32);
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("dacs sent %d bytes.\n", n));
|
||||||
|
// channels
|
||||||
|
n = sendData(file_des, myMod->chanregs, sizeof(int) * (myMod->nchan),
|
||||||
|
INT32);
|
||||||
|
LOG(level, ("chanregs sent %d bytes.\n", n));
|
||||||
|
if (!n) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ts += n;
|
||||||
|
LOG(level, ("received module of size %d register %x\n", ts, myMod->reg));
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
int receiveModule(int file_des, sls_detector_module *myMod) {
|
int receiveModule(int file_des, sls_detector_module *myMod) {
|
||||||
enum TLogLevel level = logDEBUG1;
|
enum TLogLevel level = logDEBUG1;
|
||||||
LOG(level, ("Receiving Module\n"));
|
LOG(level, ("Receiving Module\n"));
|
||||||
int ts = 0, n = 0;
|
int ts = 0, n = 0;
|
||||||
int nDacs = myMod->ndac;
|
int nDacs = myMod->ndac;
|
||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
|
||||||
int nChans = myMod->nchan; // can be zero for no trimbits
|
int nChans = myMod->nchan; // can be zero for no trimbits
|
||||||
LOG(level, ("nChans: %d\n", nChans));
|
LOG(level, ("nChans: %d\n", nChans));
|
||||||
#endif
|
|
||||||
n = receiveData(file_des, &(myMod->serialnumber),
|
n = receiveData(file_des, &(myMod->serialnumber),
|
||||||
sizeof(myMod->serialnumber), INT32);
|
sizeof(myMod->serialnumber), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("serialno received. %d bytes. serialno: %d\n", n,
|
LOG(level, ("serialno received %d bytes. serialno: %d\n", n,
|
||||||
myMod->serialnumber));
|
myMod->serialnumber));
|
||||||
n = receiveData(file_des, &(myMod->nchan), sizeof(myMod->nchan), INT32);
|
n = receiveData(file_des, &(myMod->nchan), sizeof(myMod->nchan), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("nchan received. %d bytes. nchan: %d\n", n, myMod->nchan));
|
LOG(level, ("nchan received %d bytes. nchan: %d\n", n, myMod->nchan));
|
||||||
n = receiveData(file_des, &(myMod->nchip), sizeof(myMod->nchip), INT32);
|
n = receiveData(file_des, &(myMod->nchip), sizeof(myMod->nchip), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("nchip received. %d bytes. nchip: %d\n", n, myMod->nchip));
|
LOG(level, ("nchip received %d bytes. nchip: %d\n", n, myMod->nchip));
|
||||||
n = receiveData(file_des, &(myMod->ndac), sizeof(myMod->ndac), INT32);
|
n = receiveData(file_des, &(myMod->ndac), sizeof(myMod->ndac), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("ndac received. %d bytes. ndac: %d\n", n, myMod->ndac));
|
LOG(level, ("ndac received %d bytes. ndac: %d\n", n, myMod->ndac));
|
||||||
n = receiveData(file_des, &(myMod->reg), sizeof(myMod->reg), INT32);
|
n = receiveData(file_des, &(myMod->reg), sizeof(myMod->reg), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("reg received. %d bytes. reg: %d\n", n, myMod->reg));
|
LOG(level, ("reg received %d bytes. reg: %d\n", n, myMod->reg));
|
||||||
n = receiveData(file_des, &(myMod->iodelay), sizeof(myMod->iodelay), INT32);
|
n = receiveData(file_des, &(myMod->iodelay), sizeof(myMod->iodelay), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level,
|
LOG(level,
|
||||||
("iodelay received. %d bytes. iodelay: %d\n", n, myMod->iodelay));
|
("iodelay received %d bytes. iodelay: %d\n", n, myMod->iodelay));
|
||||||
n = receiveData(file_des, &(myMod->tau), sizeof(myMod->tau), INT32);
|
n = receiveData(file_des, &(myMod->tau), sizeof(myMod->tau), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("tau received. %d bytes. tau: %d\n", n, myMod->tau));
|
LOG(level, ("tau received %d bytes. tau: %d\n", n, myMod->tau));
|
||||||
n = receiveData(file_des, myMod->eV, sizeof(myMod->eV), INT32);
|
n = receiveData(file_des, myMod->eV, sizeof(myMod->eV), INT32);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("eV received. %d bytes. eV: %d\n", n, myMod->eV[0]));
|
LOG(level, ("eV received %d bytes. eV: %d\n", n, myMod->eV[0]));
|
||||||
// dacs
|
// dacs
|
||||||
if (nDacs != (myMod->ndac)) {
|
if (nDacs != (myMod->ndac)) {
|
||||||
LOG(logERROR, ("received wrong number of dacs. "
|
LOG(logERROR, ("received wrong number of dacs. "
|
||||||
@ -478,24 +551,22 @@ int receiveModule(int file_des, sls_detector_module *myMod) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
LOG(level, ("dacs received. %d bytes.\n", n));
|
LOG(level, ("dacs received %d bytes.\n", n));
|
||||||
// channels
|
// channels
|
||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
|
||||||
if (((myMod->nchan) != 0) && // no trimbits
|
if (((myMod->nchan) != 0) && // no trimbits
|
||||||
(nChans != (myMod->nchan))) { // with trimbits
|
(nChans != (myMod->nchan))) { // with trimbits
|
||||||
LOG(logERROR, ("received wrong number of channels. "
|
LOG(logERROR, ("received wrong number of channels. "
|
||||||
"Expected %d, got %d\n",
|
"Expected %d, got %d\n",
|
||||||
nChans, (myMod->nchan)));
|
nChans, (myMod->nchan)));
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
n = receiveData(file_des, myMod->chanregs, sizeof(int) * (myMod->nchan),
|
n = receiveData(file_des, myMod->chanregs, sizeof(int) * (myMod->nchan),
|
||||||
INT32);
|
INT32);
|
||||||
LOG(level, ("chanregs received. %d bytes.\n", n));
|
LOG(level, ("chanregs received %d bytes.\n", n));
|
||||||
if (!n && myMod->nchan != 0) {
|
if (!n && myMod->nchan != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts += n;
|
ts += n;
|
||||||
#endif
|
|
||||||
LOG(level, ("received module of size %d register %x\n", ts, myMod->reg));
|
LOG(level, ("received module of size %d register %x\n", ts, myMod->reg));
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "slsDetectorServer_defs.h"
|
#include "slsDetectorServer_defs.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
|
|
||||||
@ -18,8 +19,11 @@
|
|||||||
#define CMD_GPIO9_DEFINE "echo 9 > /sys/class/gpio/export"
|
#define CMD_GPIO9_DEFINE "echo 9 > /sys/class/gpio/export"
|
||||||
#define CMD_GPIO3_DEFINE "echo 3 > /sys/class/gpio/export"
|
#define CMD_GPIO3_DEFINE "echo 3 > /sys/class/gpio/export"
|
||||||
|
|
||||||
|
// N config done
|
||||||
#define CMD_GPIO7_EXIST "/sys/class/gpio/gpio7"
|
#define CMD_GPIO7_EXIST "/sys/class/gpio/gpio7"
|
||||||
|
// N Config
|
||||||
#define CMD_GPIO9_EXIST "/sys/class/gpio/gpio9"
|
#define CMD_GPIO9_EXIST "/sys/class/gpio/gpio9"
|
||||||
|
// N CE (access to AS interface)
|
||||||
#define CMD_GPIO3_EXIST "/sys/class/gpio/gpio3"
|
#define CMD_GPIO3_EXIST "/sys/class/gpio/gpio3"
|
||||||
|
|
||||||
#define CMD_GPIO9_DEFINE_OUT "echo out > /sys/class/gpio/gpio9/direction"
|
#define CMD_GPIO9_DEFINE_OUT "echo out > /sys/class/gpio/gpio9/direction"
|
||||||
@ -28,8 +32,11 @@
|
|||||||
#define CMD_GPIO9_DEFINE_IN "echo in > /sys/class/gpio/gpio9/direction"
|
#define CMD_GPIO9_DEFINE_IN "echo in > /sys/class/gpio/gpio9/direction"
|
||||||
#define CMD_GPIO3_DEFINE_IN "echo in > /sys/class/gpio/gpio3/direction"
|
#define CMD_GPIO3_DEFINE_IN "echo in > /sys/class/gpio/gpio3/direction"
|
||||||
|
|
||||||
|
// nConfig
|
||||||
#define CMD_GPIO9_DONT_TOUCH_FLASH "echo 0 > /sys/class/gpio/gpio9/value"
|
#define CMD_GPIO9_DONT_TOUCH_FLASH "echo 0 > /sys/class/gpio/gpio9/value"
|
||||||
#define CMD_GPIO3_DONT_TOUCH_FLASH "echo 0 > /sys/class/gpio/gpio3/value"
|
// nCE
|
||||||
|
#define CMD_GPIO3_DONT_TOUCH_FLASH "echo 1 > /sys/class/gpio/gpio3/value"
|
||||||
|
// CD
|
||||||
#define CMD_FPGA_PICKED_STATUS "cat /sys/class/gpio/gpio7/value"
|
#define CMD_FPGA_PICKED_STATUS "cat /sys/class/gpio/gpio7/value"
|
||||||
|
|
||||||
#define CMD_GET_FPGA_FLASH_DRIVE "awk \'$4== \"\\\"bitfile(spi)\\\"\" {print $1}\' /proc/mtd"
|
#define CMD_GET_FPGA_FLASH_DRIVE "awk \'$4== \"\\\"bitfile(spi)\\\"\" {print $1}\' /proc/mtd"
|
||||||
@ -38,6 +45,9 @@
|
|||||||
|
|
||||||
#define CMD_GET_AMD_FLASH "dmesg | grep Amd"
|
#define CMD_GET_AMD_FLASH "dmesg | grep Amd"
|
||||||
|
|
||||||
|
#define CMD_CREATE_DEVICE_FILE_PART1 "mknod"
|
||||||
|
#define CMD_CREATE_DEVICE_FILE_PART2 "c 90 6"
|
||||||
|
|
||||||
#define FLASH_BUFFER_MEMORY_SIZE (128 * 1024) // 500 KB
|
#define FLASH_BUFFER_MEMORY_SIZE (128 * 1024) // 500 KB
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
@ -65,7 +75,7 @@ int defineGPIOpins(char *mess) {
|
|||||||
if (FAIL == validateKernelVersion(KERNEL_DATE_VRSN_3GPIO)) {
|
if (FAIL == validateKernelVersion(KERNEL_DATE_VRSN_3GPIO)) {
|
||||||
latestKernelVerified = 0;
|
latestKernelVerified = 0;
|
||||||
LOG(logWARNING,
|
LOG(logWARNING,
|
||||||
("Kernel too old to use gpio 3 pins. Update kernel to "
|
("Kernel too old to use gpio3 (nCE). Update kernel to "
|
||||||
"guarantee error-free fpga programming. \n\tNot the end "
|
"guarantee error-free fpga programming. \n\tNot the end "
|
||||||
"of the world. Continuing with current kernel...\n"));
|
"of the world. Continuing with current kernel...\n"));
|
||||||
} else {
|
} else {
|
||||||
@ -78,35 +88,35 @@ int defineGPIOpins(char *mess) {
|
|||||||
if (access(CMD_GPIO7_EXIST, F_OK) != 0) {
|
if (access(CMD_GPIO7_EXIST, F_OK) != 0) {
|
||||||
if (executeCommand(CMD_GPIO7_DEFINE, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO7_DEFINE, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not define gpio7 pins for fpga (%s)\n", retvals);
|
"Could not define gpio7 (CD) for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio7: defined\n"));
|
LOG(logINFO, ("\tgpio7 (CD): defined\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("\tgpio7: already defined\n"));
|
LOG(logINFO, ("\tgpio7 (CD): already defined\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// define gpio7 direction
|
// define gpio7 direction
|
||||||
if (executeCommand(CMD_GPIO7_DEFINE_IN, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO7_DEFINE_IN, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not set gpio7 as input for fpga (%s)\n", retvals);
|
"Could not set gpio7 (CD) as input for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio7: setting intput\n"));
|
LOG(logINFO, ("\tgpio7 (CD): setting intput\n"));
|
||||||
|
|
||||||
// define gpio9
|
// define gpio9
|
||||||
if (access(CMD_GPIO9_EXIST, F_OK) != 0) {
|
if (access(CMD_GPIO9_EXIST, F_OK) != 0) {
|
||||||
if (executeCommand(CMD_GPIO9_DEFINE, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO9_DEFINE, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not define gpio9 pins for fpga (%s)\n", retvals);
|
"Could not define gpio9 (nConfig) for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9: defined\n"));
|
LOG(logINFO, ("\tgpio9 (nConfig): defined\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("\tgpio9: already defined\n"));
|
LOG(logINFO, ("\tgpio9 (nConfig): already defined\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// define gpio3 (not chip enable)
|
// define gpio3 (not chip enable)
|
||||||
@ -114,21 +124,21 @@ int defineGPIOpins(char *mess) {
|
|||||||
if (access(CMD_GPIO3_EXIST, F_OK) != 0) {
|
if (access(CMD_GPIO3_EXIST, F_OK) != 0) {
|
||||||
if (executeCommand(CMD_GPIO3_DEFINE, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO3_DEFINE, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not define gpio3 pins for fpga (%s)\n",
|
"Could not define gpio3 (nCE) for fpga (%s)\n",
|
||||||
retvals);
|
retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3: defined\n"));
|
LOG(logINFO, ("\tgpio3 (nCE): defined\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("\tgpio3: already defined\n"));
|
LOG(logINFO, ("\tgpio3 (nCE): already defined\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FPGAdontTouchFlash(char *mess) {
|
int FPGAdontTouchFlash(char *mess, int programming) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
@ -136,51 +146,51 @@ int FPGAdontTouchFlash(char *mess) {
|
|||||||
// define gpio9 as output
|
// define gpio9 as output
|
||||||
if (executeCommand(CMD_GPIO9_DEFINE_OUT, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO9_DEFINE_OUT, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not set gpio9 as output for fpga (%s)\n", retvals);
|
"Could not set gpio9 (nConfig) as output for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9: setting output\n"));
|
LOG(logINFO, ("\tgpio9 (nConfig): setting output\n"));
|
||||||
|
|
||||||
// define gpio3 as output
|
// define gpio3 as output
|
||||||
if (latestKernelVerified == 1) {
|
if (programming && latestKernelVerified == 1) {
|
||||||
if (executeCommand(CMD_GPIO3_DEFINE_OUT, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO3_DEFINE_OUT, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not set gpio3 as output for fpga (%s)\n", retvals);
|
"Could not set gpio3 (nCE) as output for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3: setting output\n"));
|
LOG(logINFO, ("\tgpio3 (nCE): setting output\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// tell FPGA to not: gpio9
|
// tell FPGA to not: gpio9
|
||||||
if (executeCommand(CMD_GPIO9_DONT_TOUCH_FLASH, retvals, logDEBUG1) ==
|
if (executeCommand(CMD_GPIO9_DONT_TOUCH_FLASH, retvals, logDEBUG1) ==
|
||||||
FAIL) {
|
FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not set gpio9 to not touch flash for fpga (%s)\n",
|
"Could not set gpio9 (nConfig) to not touch flash for fpga (%s)\n",
|
||||||
retvals);
|
retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9: fpga dont touch flash\n"));
|
LOG(logINFO, ("\tgpio9 (nConfig): fpga dont touch flash (Low)\n"));
|
||||||
|
|
||||||
// tell FPGA to not: gpio3
|
// tell FPGA to not: gpio3
|
||||||
if (latestKernelVerified == 1) {
|
if (programming && latestKernelVerified == 1) {
|
||||||
if (executeCommand(CMD_GPIO3_DONT_TOUCH_FLASH, retvals, logDEBUG1) ==
|
if (executeCommand(CMD_GPIO3_DONT_TOUCH_FLASH, retvals, logDEBUG1) ==
|
||||||
FAIL) {
|
FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not set gpio3 to not touch flash for fpga (%s)\n",
|
"Could not set gpio3 (nCE) to not touch flash for fpga (%s)\n",
|
||||||
retvals);
|
retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3: fpga dont touch flash\n"));
|
LOG(logINFO, ("\tgpio3 (nCE): fpga dont touch flash (High)\n"));
|
||||||
}
|
}
|
||||||
// usleep(100*1000);
|
// usleep(100*1000);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FPGATouchFlash(char *mess) {
|
int FPGATouchFlash(char *mess, int programming) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
@ -188,20 +198,20 @@ int FPGATouchFlash(char *mess) {
|
|||||||
// tell FPGA to touch flash to program itself
|
// tell FPGA to touch flash to program itself
|
||||||
if (executeCommand(CMD_GPIO9_DEFINE_IN, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO9_DEFINE_IN, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not set gpio9 as input for fpga (%s)\n", retvals);
|
"Could not set gpio9 (nConfig) as input for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9: setting input\n"));
|
LOG(logINFO, ("\tgpio9 (nConfig): setting input\n"));
|
||||||
|
|
||||||
if (latestKernelVerified == 1) {
|
if (programming && latestKernelVerified == 1) {
|
||||||
if (executeCommand(CMD_GPIO3_DEFINE_IN, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(CMD_GPIO3_DEFINE_IN, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not set gpio3 as input for fpga (%s)\n", retvals);
|
"Could not set gpio3 (nCE) as input for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3: setting input\n"));
|
LOG(logINFO, ("\tgpio3 (nCE): setting input\n"));
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -211,10 +221,10 @@ int resetFPGA(char *mess) {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
if (FPGAdontTouchFlash(mess) == FAIL) {
|
if (FPGAdontTouchFlash(mess, 0) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (FPGATouchFlash(mess) == FAIL) {
|
if (FPGATouchFlash(mess, 0) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
@ -274,7 +284,8 @@ int allowUpdate(char *mess, char *functionType) {
|
|||||||
getKernelVersion(retvals);
|
getKernelVersion(retvals);
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not update %s. Kernel version %s is too old to "
|
"Could not update %s. Kernel version %s is too old to "
|
||||||
"update the Amd flash/ root directory. Most likely, blackfin needs rescue or replacement. Please contact us.\n",
|
"update the Amd flash/ root directory. Most likely, blackfin "
|
||||||
|
"needs rescue or replacement. Please contact us.\n",
|
||||||
functionType, retvals);
|
functionType, retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -319,7 +330,7 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd,
|
|||||||
|
|
||||||
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
||||||
char *functionType, char *clientChecksum,
|
char *functionType, char *clientChecksum,
|
||||||
ssize_t fsize) {
|
ssize_t fsize, int forceDeleteNormalFile) {
|
||||||
|
|
||||||
memset(messageType, 0, sizeof(messageType));
|
memset(messageType, 0, sizeof(messageType));
|
||||||
strcpy(messageType, functionType);
|
strcpy(messageType, functionType);
|
||||||
@ -330,12 +341,13 @@ int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
|||||||
|
|
||||||
FILE *flashfd = NULL;
|
FILE *flashfd = NULL;
|
||||||
FILE *srcfd = NULL;
|
FILE *srcfd = NULL;
|
||||||
if (openFileForFlash(mess, &flashfd, &srcfd) == FAIL) {
|
if (openFileForFlash(mess, index, &flashfd, &srcfd, forceDeleteNormalFile) ==
|
||||||
|
FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == PROGRAM_FPGA) {
|
if (index == PROGRAM_FPGA) {
|
||||||
if (FPGAdontTouchFlash(mess) == FAIL) {
|
if (FPGAdontTouchFlash(mess, 1) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,7 +446,8 @@ int getDrive(char *mess, enum PROGRAM_INDEX index) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
|
int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
|
||||||
|
int forceDeleteNormalFile) {
|
||||||
// open src file
|
// open src file
|
||||||
*srcfd = fopen(TEMP_PROG_FILE_NAME, "r");
|
*srcfd = fopen(TEMP_PROG_FILE_NAME, "r");
|
||||||
if (*srcfd == NULL) {
|
if (*srcfd == NULL) {
|
||||||
@ -447,6 +460,11 @@ int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
|
|||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("Temp file ready for reading\n"));
|
LOG(logDEBUG1, ("Temp file ready for reading\n"));
|
||||||
|
|
||||||
|
if (checkNormalFile(mess, index, forceDeleteNormalFile) == FAIL) {
|
||||||
|
fclose(*srcfd);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
// open flash drive for writing
|
// open flash drive for writing
|
||||||
*flashfd = fopen(flashDriveName, "w");
|
*flashfd = fopen(flashDriveName, "w");
|
||||||
if (*flashfd == NULL) {
|
if (*flashfd == NULL) {
|
||||||
@ -462,6 +480,95 @@ int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int checkNormalFile(char *mess, enum PROGRAM_INDEX index, int forceDeleteNormalFile) {
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
// check if its a normal file or special file
|
||||||
|
struct stat buf;
|
||||||
|
if (stat(flashDriveName, &buf) == -1) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. Unable to find the flash drive %s\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
// zero = normal file (not char special drive file)
|
||||||
|
if (!S_ISCHR(buf.st_mode)) {
|
||||||
|
// kernel memory is not permanent
|
||||||
|
if (index != PROGRAM_FPGA) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. The flash drive found is a normal file. "
|
||||||
|
"Reboot board using 'rebootcontroller' command to load "
|
||||||
|
"proper device tree\n",
|
||||||
|
messageType);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// user does not allow to fix it (default)
|
||||||
|
if (forceDeleteNormalFile == 0) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. The flash drive %s found for fpga programming is a normal file. To "
|
||||||
|
"fix this (by deleting this file, creating the flash drive and proceeding with "
|
||||||
|
"programming), re-run the programming command 'programfpga' with parameter "
|
||||||
|
"'--force-delete-normal-file'\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fpga memory stays after a reboot, user allowed to fix it
|
||||||
|
LOG(logWARNING, ("Flash drive invalidated (normal file). Fixing it...\n"));
|
||||||
|
|
||||||
|
// user allows to fix it, so force delete normal file
|
||||||
|
char cmd[MAX_STR_LENGTH] = {0};
|
||||||
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
|
|
||||||
|
if (snprintf(cmd, MAX_STR_LENGTH, "rm %s", flashDriveName) >=
|
||||||
|
MAX_STR_LENGTH) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not update %s. Command to delete normal file %s is "
|
||||||
|
"too long\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
||||||
|
snprintf(
|
||||||
|
mess, MAX_STR_LENGTH,
|
||||||
|
"Could not update %s. (could not delete normal file %s: %s)\n",
|
||||||
|
messageType, flashDriveName, retvals);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("\tDeleted Normal File (%s)\n", flashDriveName));
|
||||||
|
|
||||||
|
// create special drive
|
||||||
|
if (snprintf(cmd, MAX_STR_LENGTH, "%s %s %s",
|
||||||
|
CMD_CREATE_DEVICE_FILE_PART1, flashDriveName,
|
||||||
|
CMD_CREATE_DEVICE_FILE_PART2) >= MAX_STR_LENGTH) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not update %s. Command to create special file %s is "
|
||||||
|
"too long\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
||||||
|
snprintf(
|
||||||
|
mess, MAX_STR_LENGTH,
|
||||||
|
"Could not update %s. (could not create special file %s: %s)\n",
|
||||||
|
messageType, flashDriveName, retvals);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("\tSpecial File created (%s)\n", flashDriveName));
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("\tValidated flash drive (not a normal file)\n"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int eraseFlash(char *mess) {
|
int eraseFlash(char *mess) {
|
||||||
LOG(logINFO, ("\tErasing Flash...\n"));
|
LOG(logINFO, ("\tErasing Flash...\n"));
|
||||||
|
|
||||||
@ -564,14 +671,14 @@ int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd) {
|
|||||||
|
|
||||||
int waitForFPGAtoTouchFlash(char *mess) {
|
int waitForFPGAtoTouchFlash(char *mess) {
|
||||||
// touch and program
|
// touch and program
|
||||||
if (FPGATouchFlash(mess) == FAIL) {
|
if (FPGATouchFlash(mess, 1) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
LOG(logINFO, ("\tWaiting for FPGA to program from flash\n"));
|
LOG(logINFO, ("\tWaiting for FPGA to program from flash... \n\t[gpio7 (CD) should be High when done]\n"));
|
||||||
int timeSpent = 0;
|
int timeSpent = 0;
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@ -609,8 +716,8 @@ int waitForFPGAtoTouchFlash(char *mess) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("gpi07 returned %d\n", result));
|
LOG(logDEBUG1, ("gpi07 (CD)returned %d\n", result));
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tFPGA has picked up the program from flash\n"));
|
LOG(logINFO, ("\tFPGA has picked up the program from flash. gpio7 (CD) is High\n"));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
|
|
||||||
@ -146,6 +147,30 @@ int getDrive(char *mess, enum PROGRAM_INDEX index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int openFileForFlash(char *mess, FILE **flashfd) {
|
int openFileForFlash(char *mess, FILE **flashfd) {
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
// check if its a normal file or special file
|
||||||
|
struct stat buf;
|
||||||
|
if (stat(flashDriveName, &buf) == -1) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. Unable to find the flash drive %s\n",
|
||||||
|
messageType, flashDriveName);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
// zero = normal file (not char drive special file)
|
||||||
|
if (!S_ISCHR(buf.st_mode)) {
|
||||||
|
// memory is not permanent
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not %s. The flash drive found is a normal file. "
|
||||||
|
"Reboot board using 'rebootcontroller' command to load "
|
||||||
|
"proper device tree\n",
|
||||||
|
messageType);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("\tValidated flash drive (not a normal file)\n"));
|
||||||
|
#endif
|
||||||
|
|
||||||
*flashfd = fopen(flashDriveName, "w");
|
*flashfd = fopen(flashDriveName, "w");
|
||||||
if (*flashfd == NULL) {
|
if (*flashfd == NULL) {
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
|
@ -26,11 +26,20 @@ extern int sockfd;
|
|||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
extern int updateFlag;
|
extern int updateFlag;
|
||||||
extern int checkModuleFlag;
|
extern int checkModuleFlag;
|
||||||
|
extern int ignoreConfigFileFlag;
|
||||||
|
|
||||||
// Global variables from slsDetectorFunctionList
|
// Global variables from slsDetectorFunctionList
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
extern int phaseShift;
|
extern int phaseShift;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||||
|
defined(MYTHEN3D)
|
||||||
|
extern int masterCommandLine;
|
||||||
|
#endif
|
||||||
|
#ifdef EIGERD
|
||||||
|
extern int topCommandLine;
|
||||||
|
#endif
|
||||||
|
int portno = DEFAULT_PORTNO;
|
||||||
|
|
||||||
void error(char *msg) { perror(msg); }
|
void error(char *msg) { perror(msg); }
|
||||||
|
|
||||||
@ -42,32 +51,62 @@ void sigInterruptHandler(int p) {
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// options
|
// options
|
||||||
int portno = DEFAULT_PORTNO;
|
|
||||||
isControlServer = 1;
|
isControlServer = 1;
|
||||||
debugflag = 0;
|
debugflag = 0;
|
||||||
updateFlag = 0;
|
updateFlag = 0;
|
||||||
checkModuleFlag = 1;
|
checkModuleFlag = 1;
|
||||||
int version = 0;
|
int version = 0;
|
||||||
|
ignoreConfigFileFlag = 0;
|
||||||
|
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||||
|
defined(MYTHEN3D)
|
||||||
|
masterCommandLine = -1;
|
||||||
|
#endif
|
||||||
|
#ifdef EIGERD
|
||||||
|
topCommandLine = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// help message
|
// help message
|
||||||
char helpMessage[MAX_STR_LENGTH];
|
const size_t helpMessageSize = 1200;
|
||||||
memset(helpMessage, 0, MAX_STR_LENGTH);
|
char helpMessage[helpMessageSize];
|
||||||
sprintf(
|
{
|
||||||
helpMessage,
|
memset(helpMessage, 0, helpMessageSize);
|
||||||
"Usage: %s [arguments]\n"
|
int len = snprintf(
|
||||||
"Possible arguments are:\n"
|
helpMessage, helpMessageSize,
|
||||||
"\t-v, --version : Software version\n"
|
"Usage: %s [arguments]\n"
|
||||||
"\t-p, --port <port> : TCP communication port with client. \n"
|
"Possible arguments are:\n"
|
||||||
"\t-g, --nomodule : [Mythen3][Gotthard2] Generic or No "
|
"\t-v, --version : Software version\n"
|
||||||
"Module mode. Skips detector type checks. \n"
|
"\t-p, --port <port> : TCP communication port with client. "
|
||||||
"\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n"
|
"\n"
|
||||||
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
|
"\t-g, --nomodule : [Mythen3][Gotthard2] \n"
|
||||||
"\t-u, --update : Update mode. Skips firmware checks and "
|
"\t Generic or No Module mode. Skips "
|
||||||
"initial detector setup. \n"
|
"detector type checks. \n"
|
||||||
"\t-s, --stopserver : Stop server. Do not use as it is created "
|
"\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n"
|
||||||
"by "
|
"\t-d, --devel : Developer mode. Skips firmware "
|
||||||
"control server \n\n",
|
"checks. \n"
|
||||||
argv[0]);
|
"\t-u, --update : Update mode. Skips firmware checks "
|
||||||
|
"and "
|
||||||
|
"initial detector setup. \n"
|
||||||
|
"\t-i, --ignore-config : "
|
||||||
|
"[Eiger][Jungfrau][Gotthard][Gotthard2] \n"
|
||||||
|
"\t Ignore config file. \n"
|
||||||
|
"\t-m, --master <master> : "
|
||||||
|
"[Eiger][Mythen3][Gotthard][Gotthard2] \n"
|
||||||
|
"\t Set Master to 0 or 1. Precedence "
|
||||||
|
"over "
|
||||||
|
"config file. Only for virtual servers except Eiger. \n"
|
||||||
|
"\t-t, --top <top> : [Eiger] Set Top to 0 or 1. "
|
||||||
|
"Precedence "
|
||||||
|
"over config file. \n"
|
||||||
|
"\t-s, --stopserver : Stop server. Do not use as it is "
|
||||||
|
"created "
|
||||||
|
"by control server \n\n",
|
||||||
|
argv[0]);
|
||||||
|
if (len >= (int)helpMessageSize) {
|
||||||
|
LOG(logERROR, ("Help for Server command line arguments size %d "
|
||||||
|
"exceed capacity of %d characters\n",
|
||||||
|
len, helpMessageSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// parse command line for config
|
// parse command line for config
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
@ -80,6 +119,9 @@ int main(int argc, char *argv[]) {
|
|||||||
{"nomodule", no_argument, NULL, 'g'}, // generic
|
{"nomodule", no_argument, NULL, 'g'}, // generic
|
||||||
{"devel", no_argument, NULL, 'd'},
|
{"devel", no_argument, NULL, 'd'},
|
||||||
{"update", no_argument, NULL, 'u'},
|
{"update", no_argument, NULL, 'u'},
|
||||||
|
{"ignore-config", no_argument, NULL, 'i'},
|
||||||
|
{"master", required_argument, NULL, 'm'},
|
||||||
|
{"top", required_argument, NULL, 't'},
|
||||||
{"stopserver", no_argument, NULL, 's'},
|
{"stopserver", no_argument, NULL, 's'},
|
||||||
{NULL, 0, NULL, 0}};
|
{NULL, 0, NULL, 0}};
|
||||||
|
|
||||||
@ -89,7 +131,8 @@ int main(int argc, char *argv[]) {
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (c != -1) {
|
while (c != -1) {
|
||||||
c = getopt_long(argc, argv, "hvp:f:gdus", long_options, &option_index);
|
c = getopt_long(argc, argv, "hvp:f:gduim:t:s", long_options,
|
||||||
|
&option_index);
|
||||||
|
|
||||||
// Detect the end of the options
|
// Detect the end of the options
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
@ -160,6 +203,57 @@ int main(int argc, char *argv[]) {
|
|||||||
isControlServer = 0;
|
isControlServer = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
#if defined(EIGERD) || defined(GOTTHARDD) || defined(GOTTHARD2D) || \
|
||||||
|
defined(JUNGFRAUD)
|
||||||
|
LOG(logINFO, ("Ignoring config file\n"));
|
||||||
|
ignoreConfigFileFlag = 1;
|
||||||
|
#else
|
||||||
|
LOG(logERROR, ("No server config files for this detector\n"));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
#if (defined(MYTHEN3D) || defined(GOTTHARDD) || defined(GOTTHARD2D)) && \
|
||||||
|
!defined(VIRTUAL)
|
||||||
|
LOG(logERROR, ("Cannot set master via the detector server for this "
|
||||||
|
"detector\n"));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
#elif defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||||
|
defined(MYTHEN3D)
|
||||||
|
if (sscanf(optarg, "%d", &masterCommandLine) != 1) {
|
||||||
|
LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (masterCommandLine == 1) {
|
||||||
|
LOG(logINFO, ("Detector Master mode\n"));
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("Detector Slave mode\n"));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
LOG(logERROR, ("No master implemented for this detector server\n"));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
#ifdef EIGERD
|
||||||
|
if (sscanf(optarg, "%d", &topCommandLine) != 1) {
|
||||||
|
LOG(logERROR, ("Cannot scan top argument\n%s", helpMessage));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (topCommandLine == 1) {
|
||||||
|
LOG(logINFO, ("Detector Top mode\n"));
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("Detector Bottom mode\n"));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
LOG(logERROR, ("No top implemented for this detector server\n"));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
printf("%s", helpMessage);
|
printf("%s", helpMessage);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,7 @@ set(SOURCES
|
|||||||
src/CmdProxy.cpp
|
src/CmdProxy.cpp
|
||||||
src/CmdParser.cpp
|
src/CmdParser.cpp
|
||||||
src/Pattern.cpp
|
src/Pattern.cpp
|
||||||
|
src/CtbConfig.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(slsDetectorObject OBJECT
|
add_library(slsDetectorObject OBJECT
|
||||||
@ -16,6 +17,8 @@ add_library(slsDetectorObject OBJECT
|
|||||||
target_include_directories(slsDetectorObject PUBLIC
|
target_include_directories(slsDetectorObject PUBLIC
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||||
|
PRIVATE
|
||||||
|
${SLS_INTERNAL_RAPIDJSON_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(slsDetectorObject
|
target_link_libraries(slsDetectorObject
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user