mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 16:48:01 +02:00
Compare commits
19 Commits
2022.07.06
...
rr_rxr
Author | SHA1 | Date | |
---|---|---|---|
d81587646e | |||
5508f0135d | |||
f2b8aa9dbd | |||
e554099bd9 | |||
001fcf03d9 | |||
1c6369a5a8 | |||
4012f139ec | |||
630b7cd539 | |||
3ebb3e7508 | |||
a1c4eb6d05 | |||
b9b5c623ec | |||
41dc8329ab | |||
c3499c0b93 | |||
578528eb59 | |||
0658d1c843 | |||
ce6dc589c8 | |||
0b45fdfed8 | |||
9217d9f22c | |||
7d4e2470a3 |
@ -19,7 +19,6 @@ 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
|
||||||
|
129
CMakeLists.txt
129
CMakeLists.txt
@ -8,8 +8,11 @@ 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'
|
||||||
@ -23,7 +26,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 "sls::")
|
#set(namespace "${PROJECT_NAME}::")
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
@ -34,8 +37,6 @@ 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)
|
||||||
@ -68,20 +69,6 @@ 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/"
|
||||||
@ -92,6 +79,9 @@ 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)
|
||||||
@ -110,22 +100,10 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(SLS_EXT_BUILD)
|
#Add two fake libraries to manage options
|
||||||
# Find ourself in case of external build
|
|
||||||
find_package(slsDetectorPackage ${PROJECT_VERSION} REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# slsProjectOptions and slsProjectWarnings are used
|
|
||||||
# to control options for the libraries
|
|
||||||
if(NOT TARGET slsProjectOptions)
|
|
||||||
add_library(slsProjectOptions INTERFACE)
|
add_library(slsProjectOptions INTERFACE)
|
||||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT TARGET slsProjectWarnings)
|
|
||||||
add_library(slsProjectWarnings INTERFACE)
|
add_library(slsProjectWarnings INTERFACE)
|
||||||
|
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||||
target_compile_options(slsProjectWarnings INTERFACE
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
@ -141,22 +119,7 @@ if (NOT TARGET slsProjectWarnings)
|
|||||||
-Wdouble-promotion
|
-Wdouble-promotion
|
||||||
-Werror=return-type
|
-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
|
#Settings for C code
|
||||||
add_library(slsProjectCSettings INTERFACE)
|
add_library(slsProjectCSettings INTERFACE)
|
||||||
target_compile_options(slsProjectCSettings INTERFACE
|
target_compile_options(slsProjectCSettings INTERFACE
|
||||||
@ -170,8 +133,29 @@ if (NOT TARGET slsProjectCSettings)
|
|||||||
-Wdouble-promotion
|
-Wdouble-promotion
|
||||||
-Werror=return-type
|
-Werror=return-type
|
||||||
)
|
)
|
||||||
sls_disable_c_warning("-Wstringop-truncation")
|
|
||||||
|
|
||||||
|
#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()
|
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()
|
||||||
|
|
||||||
|
# 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")
|
||||||
|
sls_disable_c_warning("-Wstringop-truncation")
|
||||||
|
|
||||||
|
|
||||||
if(SLS_USE_SANITIZER)
|
if(SLS_USE_SANITIZER)
|
||||||
@ -186,22 +170,58 @@ if(SLS_TUNE_LOCAL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(SLS_MASTER_PROJECT)
|
#rapidjson
|
||||||
install(TARGETS slsProjectOptions slsProjectWarnings
|
add_library(rapidjson INTERFACE)
|
||||||
|
target_include_directories(rapidjson INTERFACE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libs/rapidjson>
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install fake the libraries
|
||||||
|
install(TARGETS slsProjectOptions slsProjectWarnings 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)
|
||||||
|
|
||||||
|
|
||||||
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_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()
|
||||||
@ -209,9 +229,8 @@ if (SLS_USE_TESTS)
|
|||||||
endif(SLS_USE_TESTS)
|
endif(SLS_USE_TESTS)
|
||||||
|
|
||||||
|
|
||||||
if(NOT SLS_EXT_BUILD)
|
# Common functionallity to detector and receiver
|
||||||
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)
|
||||||
@ -235,7 +254,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 ${CMAKE_BINARY_DIR}/bin/)
|
add_subdirectory(libs/pybind11)
|
||||||
add_subdirectory(python)
|
add_subdirectory(python)
|
||||||
endif(SLS_USE_PYTHON)
|
endif(SLS_USE_PYTHON)
|
||||||
|
|
||||||
|
34
RELEASE.txt
34
RELEASE.txt
@ -47,42 +47,10 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- stop servers also check for errors at startup( in case it was running with an older version)
|
- 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
|
- added geometry to metadata
|
||||||
- 10g eiger nextframenumber get fixed.
|
- 10g eiger nextframenumber get fixed.
|
||||||
- stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench)
|
- 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
|
|
||||||
- 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
|
||||||
==================
|
==================
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
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()
|
|
@ -1,36 +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_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}/cmake/libzmq-pkg-config/FindZeroMQ.cmake"
|
"${CMAKE_SOURCE_DIR}/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 -rv build/install/share $PREFIX
|
cp -r build/install/share/ $PREFIX/share
|
||||||
|
@ -828,14 +828,14 @@ void ctbAcquisition::setCanvas(TCanvas* c) {
|
|||||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
|
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
|
||||||
// myCanvas->AddExec("ex","canvasClicked()");
|
// myCanvas->AddExec("ex","canvasClicked()");
|
||||||
}
|
}
|
||||||
void ctbAcquisition::dataCallback(sls::detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
||||||
|
|
||||||
// return
|
// return
|
||||||
((ctbAcquisition*)pArgs)->plotData(data,index);
|
((ctbAcquisition*)pArgs)->plotData(data,index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ctbAcquisition::plotData(sls::detectorData *data, int index) {
|
int ctbAcquisition::plotData(detectorData *data, int index) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
******************************************************************
|
******************************************************************
|
||||||
|
@ -28,8 +28,8 @@ class TGTextButton;
|
|||||||
namespace sls
|
namespace sls
|
||||||
{
|
{
|
||||||
class Detector;
|
class Detector;
|
||||||
class detectorData;
|
|
||||||
};
|
};
|
||||||
|
class detectorData;
|
||||||
|
|
||||||
template <class dataType> class slsDetectorData;
|
template <class dataType> class slsDetectorData;
|
||||||
|
|
||||||
@ -201,10 +201,10 @@ class ctbAcquisition : public TGGroupFrame {
|
|||||||
void setBitGraph (int i ,int en, Pixel_t col);
|
void setBitGraph (int i ,int en, Pixel_t col);
|
||||||
void startAcquisition();
|
void startAcquisition();
|
||||||
static void progressCallback(double,void*);
|
static void progressCallback(double,void*);
|
||||||
static void dataCallback(sls::detectorData*, long unsigned int, unsigned int, void*);
|
static void dataCallback(detectorData*, long unsigned int, unsigned int, void*);
|
||||||
int StopFlag;
|
int StopFlag;
|
||||||
|
|
||||||
int plotData(sls::detectorData*, int);
|
int plotData(detectorData*, int);
|
||||||
|
|
||||||
void setPatternFile(const char* t);
|
void setPatternFile(const char* t);
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ 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',
|
'clearBit', 'clearROI', 'client_version', 'config', 'copyDetectorServer',
|
||||||
'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,42 +5,17 @@ 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
|
||||||
|
|
||||||
# the following command copies new server from pc tftp folder, creates a soft link to xxxDetectorServerxxx
|
# 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
|
||||||
@ -52,15 +27,18 @@ From 6.1.1 and above (no tftp required)
|
|||||||
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
||||||
|
|
||||||
|
|
||||||
Troubleshooting with tftp
|
.. 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.
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
|
12
examples/jungfrau_rr.config
Normal file
12
examples/jungfrau_rr.config
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
hostname bchip258+
|
||||||
|
0:rx_hostname pc13784:1954+pc13784:1955+
|
||||||
|
|
||||||
|
udp_srcip 10.0.2.184
|
||||||
|
udp_dstip 10.0.2.1
|
||||||
|
|
||||||
|
0:0 udp_dstport 50000
|
||||||
|
0:1 udp_dstport 50001
|
||||||
|
|
||||||
|
|
||||||
|
#0:0 udp_dstlist port=50001
|
||||||
|
#0:1 udp_dstlist port=50002
|
@ -6,8 +6,6 @@
|
|||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
class MultiDetectorFixture {
|
class MultiDetectorFixture {
|
||||||
protected:
|
protected:
|
||||||
DetectorImpl d;
|
DetectorImpl d;
|
||||||
@ -138,7 +136,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 = split(hn, '+');
|
auto hostnames = sls::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) ==
|
||||||
@ -200,5 +198,3 @@ TEST_CASE_METHOD(MultiDetectorFixture, "rate correction",
|
|||||||
d.setRateCorrection(200);
|
d.setRateCorrection(200);
|
||||||
CHECK(d.getRateCorrection() == 200);
|
CHECK(d.getRateCorrection() == 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
// 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);
|
||||||
@ -285,14 +283,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), RuntimeError);
|
CHECK_THROWS_AS(m.setDynamicRange(8), sls::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), RuntimeError);
|
CHECK_THROWS_AS(m.setDynamicRange(4), sls::RuntimeError);
|
||||||
CHECK(m.getRateCorrection() == 0);
|
CHECK(m.getRateCorrection() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,11 +329,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), RuntimeError);
|
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::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), RuntimeError);
|
CHECK_THROWS_AS(m.setPatternWord(addr, word), sls::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"));
|
||||||
|
|
||||||
@ -410,7 +408,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), RuntimeError);
|
CHECK_THROWS_AS(m.setReceiverDbitList(list), sls::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"));
|
||||||
|
|
||||||
@ -478,7 +476,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), RuntimeError);
|
CHECK_THROWS_AS(m.setNextFrameNumber(0), sls::RuntimeError);
|
||||||
|
|
||||||
if (m.getDetectorTypeAsString() == "Eiger") {
|
if (m.getDetectorTypeAsString() == "Eiger") {
|
||||||
val = 281474976710655;
|
val = 281474976710655;
|
||||||
@ -513,10 +511,8 @@ 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), RuntimeError);
|
CHECK_THROWS_AS(m.setPartialReadout(1), sls::RuntimeError);
|
||||||
CHECK(m.getPartialReadout() == 256);
|
CHECK(m.getPartialReadout() == 256);
|
||||||
CHECK_THROWS_AS(m.setPartialReadout(0), RuntimeError);
|
CHECK_THROWS_AS(m.setPartialReadout(0), sls::RuntimeError);
|
||||||
m.setPartialReadout(256);
|
m.setPartialReadout(256);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -6,12 +6,10 @@
|
|||||||
#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 = split(test::hostname, '+');
|
auto hostnames = sls::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());
|
||||||
@ -104,6 +102,3 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
|||||||
|
|
||||||
d.freeSharedMemory();
|
d.freeSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
|
||||||
|
Submodule libs/pybind11 updated: 914c06fb25...8de7772cc7
27
libzmq-pkg-config/FindZeroMQ.cmake
Executable file
27
libzmq-pkg-config/FindZeroMQ.cmake
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#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})
|
@ -1,45 +1,43 @@
|
|||||||
# 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, freeze
|
from .detector import Detector
|
||||||
from .utils import element_if_equal
|
from .utils import element_if_equal
|
||||||
from .dacs import DetectorDacs, NamedDacs
|
from .dacs import DetectorDacs
|
||||||
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,79 +36,6 @@ 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 = []
|
||||||
@ -123,7 +50,7 @@ class DetectorDacs:
|
|||||||
# Index to support iteration
|
# Index to support iteration
|
||||||
self._current = 0
|
self._current = 0
|
||||||
|
|
||||||
# Name the attributes?
|
# Populate the dacs
|
||||||
for _d in self._dacs:
|
for _d in self._dacs:
|
||||||
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
||||||
|
|
||||||
@ -132,9 +59,6 @@ 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:
|
||||||
|
@ -599,7 +599,7 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def rx_framescaught(self):
|
def rx_framescaught(self):
|
||||||
"""Number of frames caught by each port in receiver."""
|
"""Number of frames caught by receiver."""
|
||||||
return self.getFramesCaught()
|
return self.getFramesCaught()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1442,21 +1442,20 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
def trimbits(self):
|
def trimbits(self):
|
||||||
"""
|
"""
|
||||||
[Eiger][Mythen3] Loads/Saves custom trimbit file to detector.
|
[Eiger][Mythen3] Loads 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.
|
||||||
|
|
||||||
:setter: Loads the trimbit file to detector
|
:getter: Not implemented
|
||||||
: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
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError('trimbits is set only. Use saveTrimbits()')
|
return NotImplementedError("trimbits are set only")
|
||||||
|
|
||||||
@trimbits.setter
|
@trimbits.setter
|
||||||
def trimbits(self, fname):
|
def trimbits(self, fname):
|
||||||
@ -1572,16 +1571,8 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def daclist(self):
|
def daclist(self):
|
||||||
"""
|
"""Gets the list of enums for every dac for this detector."""
|
||||||
List of enums for every dac for this detector.
|
return self.getDacList()
|
||||||
: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):
|
||||||
@ -1834,13 +1825,13 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def threshold(self):
|
def threshold(self):
|
||||||
"""[Eiger][Mythen3] Threshold in eV
|
"""[Eiger] 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.\n [Mythen3] An energy of -1 will pick up values from detector.
|
:setter: It loads trim files from settingspath.
|
||||||
"""
|
"""
|
||||||
if self.type == detectorType.MYTHEN3:
|
if self.type == detectorType.MYTHEN3:
|
||||||
return self.getAllThresholdEnergy()
|
return self.getAllThresholdEnergy()
|
||||||
@ -1927,7 +1918,7 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def rx_frameindex(self):
|
def rx_frameindex(self):
|
||||||
"""Current frame index received for each port in receiver during acquisition."""
|
"""Current frame index received in receiver during acquisition."""
|
||||||
return self.getRxCurrentFrameIndex()
|
return self.getRxCurrentFrameIndex()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -2618,7 +2609,7 @@ class Detector(CppDetectorApi):
|
|||||||
-------
|
-------
|
||||||
>>> d.vetophoton = (2, 24, 2560, '/tmp/bla.txt')
|
>>> d.vetophoton = (2, 24, 2560, '/tmp/bla.txt')
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError('vetophoton is set only')
|
raise NotImplementedError('vetofile is set only')
|
||||||
|
|
||||||
@vetophoton.setter
|
@vetophoton.setter
|
||||||
def vetophoton(self, args):
|
def vetophoton(self, args):
|
||||||
@ -3499,60 +3490,10 @@ 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>>>---------------------------
|
||||||
|
@ -144,10 +144,6 @@ 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,
|
||||||
@ -191,10 +187,10 @@ 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("registerDataCallback",
|
.def(
|
||||||
|
"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",
|
||||||
@ -497,17 +493,13 @@ void init_det(py::module &m) {
|
|||||||
Detector::getReceiverStatus,
|
Detector::getReceiverStatus,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getFramesCaught",
|
.def("getFramesCaught",
|
||||||
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
(Result<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,
|
||||||
@ -790,15 +782,6 @@ 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,
|
||||||
@ -1303,46 +1286,6 @@ 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,
|
||||||
@ -1480,19 +1423,6 @@ 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,
|
||||||
@ -1597,13 +1527,17 @@ 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 &, const bool,
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
sls::Positions)) &
|
|
||||||
Detector::programFPGA,
|
Detector::programFPGA,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
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,
|
||||||
@ -1615,6 +1549,11 @@ 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)) &
|
||||||
@ -1717,5 +1656,9 @@ 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,9 +315,4 @@ 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();
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
|||||||
../interpolations
|
../interpolations
|
||||||
../../slsReceiverSoftware/include/
|
../../slsReceiverSoftware/include/
|
||||||
../../slsSupportLib/include/
|
../../slsSupportLib/include/
|
||||||
${SLS_INTERNAL_RAPIDJSON_DIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${exe}
|
target_link_libraries(${exe}
|
||||||
|
@ -429,15 +429,10 @@ 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) >= 0 && (iy + ir) < ny &&
|
if ((iy + ir) >= iy && (iy + ir) < ny &&
|
||||||
(ix + ic) >= 0 && (ix + ic) < nx) {
|
(ix + ic) >= ix && (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]);
|
v = &(val[(iy + ir) * nx + ix + ic]);
|
||||||
tot += *v;
|
tot += *v;
|
||||||
if (ir <= 0 && ic <= 0)
|
if (ir <= 0 && ic <= 0)
|
||||||
@ -448,9 +443,9 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
|||||||
tl += *v;
|
tl += *v;
|
||||||
if (ir >= 0 && ic >= 0)
|
if (ir >= 0 && ic >= 0)
|
||||||
tr += *v;
|
tr += *v;
|
||||||
if (*v > max) //{
|
if (*v > max) {
|
||||||
max = *v;
|
max = *v;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -518,19 +513,12 @@ 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,18 +216,14 @@ 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,7 +235,6 @@
|
|||||||
</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">
|
||||||
@ -420,11 +419,6 @@ 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,105 +20,7 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="1" column="5">
|
<item row="2" column="0" colspan="4">
|
||||||
<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">
|
||||||
@ -310,69 +212,37 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="0" colspan="4">
|
||||||
<widget class="QLabel" name="lblCompleteImage">
|
<widget class="QGroupBox" name="boxPlot">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="font">
|
||||||
<size>
|
<font>
|
||||||
<width>120</width>
|
<family>Sans Serif</family>
|
||||||
<height>0</height>
|
<pointsize>10</pointsize>
|
||||||
</size>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="title">
|
||||||
<size>
|
<string>Sample Plot</string>
|
||||||
<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>150</green>
|
|
||||||
<blue>110</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</colorrole>
|
|
||||||
</active>
|
|
||||||
<inactive>
|
|
||||||
<colorrole role="WindowText">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>0</red>
|
|
||||||
<green>150</green>
|
|
||||||
<blue>110</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>Complete Image</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
@ -385,7 +255,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>40</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -440,6 +310,71 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="lblCompleteImage">
|
||||||
|
<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>0</red>
|
||||||
|
<green>150</green>
|
||||||
|
<blue>110</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>0</red>
|
||||||
|
<green>150</green>
|
||||||
|
<blue>110</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>Complete Image</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -32,29 +32,17 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QLabel" name="lblReadout">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
<horstretch>5</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="text">
|
||||||
<number>1</number>
|
<string>Readout: </string>
|
||||||
</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">
|
||||||
@ -89,17 +77,143 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lblReadout">
|
<widget class="QLabel" name="lblComboHV">
|
||||||
<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="text">
|
<property name="toolTip">
|
||||||
<string>Readout: </string>
|
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>High Voltage: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>775</width>
|
<width>775</width>
|
||||||
<height>400</height>
|
<height>380</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -32,99 +32,26 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="2" colspan="5">
|
<item row="4" column="3">
|
||||||
<widget class="QComboBox" name="comboHV">
|
<widget class="QCheckBox" name="chkCounter2">
|
||||||
<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</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="0" column="0">
|
|
||||||
<widget class="QLabel" name="lblComboHV">
|
|
||||||
<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</p><p> #highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>High Voltage: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="lblThreshold">
|
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>110</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>50</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Threshold:</string>
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="4">
|
<item row="4" column="4">
|
||||||
<widget class="QCheckBox" name="chkCounter3">
|
<widget class="QCheckBox" name="chkCounter3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -143,23 +70,238 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="14">
|
<item row="3" column="2" colspan="3">
|
||||||
<spacer name="horizontalSpacer_2">
|
<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>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="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">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>190</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="8">
|
||||||
|
<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="0" column="0">
|
||||||
<widget class="QLabel" name="lblSettings">
|
<widget class="QLabel" name="lblSettings">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -181,7 +323,120 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="0" 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="2" column="0">
|
||||||
|
<widget class="QLabel" name="lblThreshold">
|
||||||
|
<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>Threshold:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="5">
|
||||||
|
<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="2" column="9">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" 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="4" column="2">
|
||||||
<widget class="QCheckBox" name="chkCounter1">
|
<widget class="QCheckBox" name="chkCounter1">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -200,7 +455,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" colspan="9">
|
<item row="0" column="2" colspan="3">
|
||||||
<widget class="QComboBox" name="comboSettings">
|
<widget class="QComboBox" name="comboSettings">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -214,7 +469,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>28</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -339,269 +594,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="11">
|
<item row="1" column="0">
|
||||||
<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>
|
||||||
@ -623,70 +616,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="2" colspan="9">
|
<item row="1" column="2">
|
||||||
<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>
|
||||||
@ -700,7 +630,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>28</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -744,50 +674,6 @@
|
|||||||
</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,8 +5,6 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
class SlsQtH1D;
|
class SlsQtH1D;
|
||||||
class SlsQt1DPlot;
|
class SlsQt1DPlot;
|
||||||
class SlsQt2DPlot;
|
class SlsQt2DPlot;
|
||||||
@ -45,5 +43,3 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
|||||||
|
|
||||||
static int NumClones;
|
static int NumClones;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -6,13 +6,11 @@
|
|||||||
#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, Detector *detector, bool d, std::string n,
|
qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n,
|
||||||
slsDetectorDefs::dacIndex i);
|
slsDetectorDefs::dacIndex i);
|
||||||
~qDacWidget();
|
~qDacWidget();
|
||||||
void SetDetectorIndex(int id);
|
void SetDetectorIndex(int id);
|
||||||
@ -27,10 +25,8 @@ class qDacWidget : public QWidget, private Ui::WidgetDacObject {
|
|||||||
void GetAdc();
|
void GetAdc();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
Detector *det;
|
sls::Detector *det;
|
||||||
bool isDac{true};
|
bool isDac{true};
|
||||||
slsDetectorDefs::dacIndex index;
|
slsDetectorDefs::dacIndex index;
|
||||||
int detectorIndex{-1};
|
int detectorIndex{-1};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
#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;
|
||||||
@ -49,9 +47,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 SocketError &e) {
|
} catch (const sls::SocketError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const SharedMemoryError &e) {
|
} catch (const sls::SharedMemoryError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
ExceptionMessage(emsg, e.what(), src);
|
ExceptionMessage(emsg, e.what(), src);
|
||||||
@ -65,9 +63,9 @@ class qDefs : public QWidget {
|
|||||||
typename NonDeduced<CT>::type... Args) {
|
typename NonDeduced<CT>::type... Args) {
|
||||||
try {
|
try {
|
||||||
throw;
|
throw;
|
||||||
} catch (const SocketError &e) {
|
} catch (const sls::SocketError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const SharedMemoryError &e) {
|
} catch (const sls::SharedMemoryError &e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
ExceptionMessage(emsg, e.what(), src);
|
ExceptionMessage(emsg, e.what(), src);
|
||||||
@ -331,5 +329,3 @@ class qDefs : public QWidget {
|
|||||||
source);
|
source);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -6,11 +6,6 @@
|
|||||||
#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;
|
||||||
@ -20,6 +15,8 @@ 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 */
|
||||||
@ -73,7 +70,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
|||||||
NumberOfTabs
|
NumberOfTabs
|
||||||
};
|
};
|
||||||
slsDetectorDefs::detectorType detType;
|
slsDetectorDefs::detectorType detType;
|
||||||
std::unique_ptr<Detector> det;
|
std::unique_ptr<sls::Detector> det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
MyTabWidget *tabs;
|
MyTabWidget *tabs;
|
||||||
QScrollArea *scroll[NumberOfTabs];
|
QScrollArea *scroll[NumberOfTabs];
|
||||||
@ -91,5 +88,3 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
|||||||
QString zoomToolTip;
|
QString zoomToolTip;
|
||||||
QColor defaultTabColor;
|
QColor defaultTabColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -6,21 +6,18 @@
|
|||||||
#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, Detector *detector);
|
qDrawPlot(QWidget *parent, sls::Detector *detector);
|
||||||
~qDrawPlot();
|
~qDrawPlot();
|
||||||
bool GetIsRunning();
|
bool GetIsRunning();
|
||||||
void SetRunning(bool enable);
|
void SetRunning(bool enable);
|
||||||
@ -58,7 +55,6 @@ 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);
|
||||||
@ -95,11 +91,9 @@ 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;
|
||||||
static const int NUM_GOTTHARD25_CHANS = 1280;
|
sls::Detector *det;
|
||||||
Detector *det;
|
|
||||||
slsDetectorDefs::detectorType detType;
|
slsDetectorDefs::detectorType detType;
|
||||||
|
|
||||||
SlsQt1DPlot *plot1d{nullptr};
|
SlsQt1DPlot *plot1d{nullptr};
|
||||||
@ -164,16 +158,10 @@ 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,15 +4,13 @@
|
|||||||
#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, Detector *detector, qDrawPlot *p);
|
qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||||
~qTabAdvanced();
|
~qTabAdvanced();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -76,8 +74,6 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
|||||||
void GetExposureTime();
|
void GetExposureTime();
|
||||||
void GetGateDelay();
|
void GetGateDelay();
|
||||||
|
|
||||||
Detector *det;
|
sls::Detector *det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -4,13 +4,11 @@
|
|||||||
#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, Detector *detector);
|
qTabDataOutput(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabDataOutput();
|
~qTabDataOutput();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
@ -41,9 +39,7 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
|||||||
void GetSpeed();
|
void GetSpeed();
|
||||||
void GetParallel();
|
void GetParallel();
|
||||||
|
|
||||||
Detector *det;
|
sls::Detector *det;
|
||||||
// Button group for radiobuttons for rate
|
// Button group for radiobuttons for rate
|
||||||
QButtonGroup *btnGroupRate;
|
QButtonGroup *btnGroupRate;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -7,13 +7,11 @@
|
|||||||
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, Detector *detector);
|
qTabDebugging(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabDebugging();
|
~qTabDebugging();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
@ -28,12 +26,10 @@ class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
|
|||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
|
|
||||||
Detector *det;
|
sls::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,30 +6,35 @@
|
|||||||
#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, Detector *detector);
|
qTabDeveloper(QWidget *parent, sls::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);
|
||||||
|
|
||||||
Detector *det;
|
sls::Detector *det;
|
||||||
std::vector<qDacWidget *> dacWidgets;
|
std::vector<qDacWidget *> dacWidgets;
|
||||||
std::vector<qDacWidget *> adcWidgets;
|
std::vector<qDacWidget *> adcWidgets;
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sls
|
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;
|
||||||
|
};
|
||||||
|
@ -4,17 +4,14 @@
|
|||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "ui_form_tab_measurement.h"
|
#include "ui_form_tab_measurement.h"
|
||||||
|
|
||||||
class QStandardItemModel;
|
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
class qDrawPlot;
|
class qDrawPlot;
|
||||||
|
class QStandardItemModel;
|
||||||
|
|
||||||
class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabMeasurement(QWidget *parent, Detector *detector, qDrawPlot *p);
|
qTabMeasurement(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||||
~qTabMeasurement();
|
~qTabMeasurement();
|
||||||
|
|
||||||
void Refresh();
|
void Refresh();
|
||||||
@ -84,7 +81,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
|||||||
void FileNameChangedSignal(QString);
|
void FileNameChangedSignal(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Detector *det;
|
sls::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 };
|
||||||
@ -101,5 +98,3 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
|||||||
int numMeasurements{1};
|
int numMeasurements{1};
|
||||||
int currentMeasurement{0};
|
int currentMeasurement{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
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
|
||||||
|
|
||||||
@ -36,5 +34,3 @@ class qTabMessages : public QWidget, private Ui::TabMessagesObject {
|
|||||||
QProcess *process;
|
QProcess *process;
|
||||||
QStringList lastCommand;
|
QStringList lastCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -4,15 +4,13 @@
|
|||||||
#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, Detector *detector, qDrawPlot *p);
|
qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||||
~qTabPlot();
|
~qTabPlot();
|
||||||
void SetScanArgument();
|
void SetScanArgument();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
@ -55,7 +53,7 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
|||||||
void SetXYRange();
|
void SetXYRange();
|
||||||
void MaintainAspectRatio(int dimension);
|
void MaintainAspectRatio(int dimension);
|
||||||
|
|
||||||
Detector *det;
|
sls::Detector *det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
bool is1d;
|
bool is1d;
|
||||||
|
|
||||||
@ -67,5 +65,3 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
|||||||
static QString defaultImageYAxisTitle;
|
static QString defaultImageYAxisTitle;
|
||||||
static QString defaultImageZAxisTitle;
|
static QString defaultImageZAxisTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -5,20 +5,17 @@
|
|||||||
#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, Detector *detector);
|
qTabSettings(QWidget *parent, sls::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);
|
||||||
@ -33,7 +30,6 @@ 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();
|
||||||
@ -41,15 +37,9 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
void GetThresholdEnergies();
|
void GetThresholdEnergies();
|
||||||
void GetCounterMask();
|
void GetCounterMask();
|
||||||
|
|
||||||
Detector *det;
|
sls::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,
|
||||||
@ -87,5 +77,3 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
DYNAMICRANGE_4
|
DYNAMICRANGE_4
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -9,14 +9,10 @@
|
|||||||
#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 QwtSymbol;
|
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
class SlsQt1DPlot;
|
class SlsQt1DPlot;
|
||||||
|
class QwtSymbol;
|
||||||
|
|
||||||
class SlsQtH1D : public QwtPlotCurve {
|
class SlsQtH1D : public QwtPlotCurve {
|
||||||
|
|
||||||
@ -140,9 +136,6 @@ 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};
|
||||||
@ -166,15 +159,9 @@ 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,8 +8,6 @@
|
|||||||
#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 {
|
||||||
@ -53,6 +51,4 @@ class SlsQt1DZoomer : public QwtPlotZoomer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
#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:
|
||||||
@ -127,6 +125,4 @@ class SlsQt2DHist : public QwtRasterData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,14 +6,11 @@
|
|||||||
#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
|
||||||
|
|
||||||
@ -70,8 +67,6 @@ 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);
|
||||||
@ -91,7 +86,4 @@ 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,8 +7,6 @@
|
|||||||
#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;
|
||||||
@ -42,6 +40,4 @@ class SlsQt2DZoomer : public QwtPlotZoomer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
#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)
|
||||||
@ -444,28 +442,6 @@ 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());
|
||||||
@ -604,5 +580,3 @@ void SlsQt1DPlot::DisableZoom(bool disable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#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
|
||||||
@ -95,5 +93,3 @@ void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D *h) {
|
|||||||
|
|
||||||
ResetZoomBase();
|
ResetZoomBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
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)
|
||||||
@ -145,5 +143,3 @@ double SlsQt2DHist::SetMinimumToFirstGreaterThanZero() {
|
|||||||
|
|
||||||
return z_min;
|
return z_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
#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);
|
||||||
@ -292,26 +290,3 @@ 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,8 +11,6 @@
|
|||||||
#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,
|
||||||
@ -46,7 +44,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(" - ") + Logger::Timestamp();
|
std::string(" - ") + sls::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));
|
||||||
@ -149,5 +147,3 @@ void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
|||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -3,9 +3,7 @@
|
|||||||
#include "qDacWidget.h"
|
#include "qDacWidget.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
namespace sls {
|
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d,
|
||||||
|
|
||||||
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);
|
||||||
@ -96,5 +94,3 @@ 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(sls::logDEBUG) << long_options[option_index].name << " " << optarg;
|
LOG(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(sls::logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
LOG(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(sls::logERROR) << help_message;
|
LOG(logERROR) << help_message;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,18 +96,16 @@ 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 {
|
||||||
sls::qDetectorMain det(multiId, fname, isDeveloper);
|
qDetectorMain det(multiId, fname, isDeveloper);
|
||||||
det.show();
|
det.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
sls::qDefs::Message(sls::qDefs::CRITICAL,
|
qDefs::Message(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),
|
||||||
@ -197,7 +195,6 @@ 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);
|
||||||
@ -215,7 +212,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 = make_unique<Detector>(multiID);
|
det = sls::make_unique<sls::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);
|
||||||
@ -228,12 +225,10 @@ 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:
|
||||||
@ -243,15 +238,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 "
|
||||||
<< ToString(det->getDetectorType().squash())
|
<< sls::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 RuntimeError(errorMess.c_str());
|
throw sls::RuntimeError(errorMess.c_str());
|
||||||
}
|
}
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "SLS Detector GUI : "
|
os << "SLS Detector GUI : "
|
||||||
<< ToString(det->getDetectorType().squash()) << " - "
|
<< sls::ToString(det->getDetectorType().squash()) << " - "
|
||||||
<< det->getHostname();
|
<< det->getHostname();
|
||||||
std::string title = os.str();
|
std::string title = os.str();
|
||||||
LOG(logINFO) << title;
|
LOG(logINFO) << title;
|
||||||
@ -344,9 +339,9 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
enable = actionExpert->isChecked();
|
enable = actionExpert->isChecked();
|
||||||
|
|
||||||
tabs->setTabEnabled(ADVANCED, enable);
|
tabs->setTabEnabled(ADVANCED, enable);
|
||||||
bool visible = enable && (detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::MYTHEN3);
|
actionLoadTrimbits->setVisible(enable &&
|
||||||
actionLoadTrimbits->setVisible(visible);
|
(detType == slsDetectorDefs::EIGER ||
|
||||||
actionSaveTrimbits->setVisible(visible);
|
detType == slsDetectorDefs::MYTHEN3));
|
||||||
tabSettings->SetExportMode(enable);
|
tabSettings->SetExportMode(enable);
|
||||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||||
}
|
}
|
||||||
@ -422,22 +417,6 @@ 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")
|
||||||
@ -462,10 +441,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 = ToStringHex(APIGUI);
|
std::string guiVersion = sls::ToStringHex(APIGUI);
|
||||||
std::string clientVersion = "unknown";
|
std::string clientVersion = "unknown";
|
||||||
try {
|
try {
|
||||||
clientVersion = ToStringHex(det->getClientVersion());
|
clientVersion = sls::ToStringHex(det->getClientVersion());
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get client version.",
|
CATCH_DISPLAY("Could not get client version.",
|
||||||
"qDetectorMain::ExecuteHelp")
|
"qDetectorMain::ExecuteHelp")
|
||||||
@ -598,8 +577,6 @@ 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
|
||||||
@ -632,5 +609,3 @@ void qDetectorMain::SetZoomToolTip(bool disable) {
|
|||||||
else
|
else
|
||||||
dockWidgetPlot->setToolTip(zoomToolTip);
|
dockWidgetPlot->setToolTip(zoomToolTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -14,9 +14,7 @@
|
|||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
namespace sls {
|
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector)
|
||||||
|
|
||||||
qDrawPlot::qDrawPlot(QWidget *parent, Detector *detector)
|
|
||||||
: QWidget(parent), det(detector) {
|
: QWidget(parent), det(detector) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -82,10 +80,6 @@ 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),
|
||||||
@ -280,13 +274,11 @@ 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;
|
||||||
@ -296,7 +288,6 @@ 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;
|
||||||
@ -306,7 +297,6 @@ 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;
|
||||||
}
|
}
|
||||||
@ -324,7 +314,6 @@ 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);
|
||||||
}
|
}
|
||||||
@ -358,7 +347,6 @@ 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 {
|
||||||
@ -377,7 +365,6 @@ 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;
|
||||||
@ -386,7 +373,6 @@ 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;
|
||||||
}
|
}
|
||||||
@ -468,20 +454,17 @@ 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;
|
||||||
}
|
}
|
||||||
@ -622,13 +605,6 @@ 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;
|
||||||
@ -662,7 +638,6 @@ 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) {
|
||||||
@ -730,7 +705,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress,
|
|||||||
int detectorStatus) {
|
int detectorStatus) {
|
||||||
progress = currentProgress;
|
progress = currentProgress;
|
||||||
std::string status =
|
std::string status =
|
||||||
ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
sls::ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
||||||
|
|
||||||
if (detectorStatus == slsDetectorDefs::ERROR) {
|
if (detectorStatus == slsDetectorDefs::ERROR) {
|
||||||
qDefs::Message(qDefs::WARNING,
|
qDefs::Message(qDefs::WARNING,
|
||||||
@ -763,7 +738,6 @@ 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;
|
||||||
@ -771,22 +745,6 @@ 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) {
|
||||||
@ -849,11 +807,6 @@ 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);
|
||||||
@ -1025,26 +978,6 @@ 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() {
|
||||||
@ -1073,22 +1006,6 @@ 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() {
|
||||||
@ -1228,18 +1145,6 @@ 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";
|
||||||
@ -1274,5 +1179,3 @@ void qDrawPlot::UpdatePlot() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "End of Update Plot";
|
LOG(logDEBUG) << "End of Update Plot";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -5,9 +5,7 @@
|
|||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
#include "sls/network_utils.h"
|
#include "sls/network_utils.h"
|
||||||
|
|
||||||
namespace sls {
|
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector,
|
||||||
|
|
||||||
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);
|
||||||
@ -445,7 +443,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(IpAddr{s},
|
det->setSourceUDPIP(sls::IpAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Detector UDP IP.",
|
CATCH_HANDLE("Could not set Detector UDP IP.",
|
||||||
@ -463,7 +461,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(MacAddr{s},
|
det->setSourceUDPMAC(sls::MacAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
||||||
@ -491,7 +489,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(IpAddr{s},
|
det->setClientZmqIp(sls::IpAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Client ZMQ IP.",
|
CATCH_HANDLE("Could not set Client ZMQ IP.",
|
||||||
@ -549,7 +547,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(IpAddr{s},
|
det->setDestinationUDPIP(sls::IpAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver UDP IP.",
|
CATCH_HANDLE("Could not set Receiver UDP IP.",
|
||||||
@ -567,7 +565,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(MacAddr{s},
|
det->setDestinationUDPMAC(sls::MacAddr{s},
|
||||||
{comboDetector->currentIndex()});
|
{comboDetector->currentIndex()});
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
||||||
@ -595,7 +593,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(IpAddr{s}, {comboDetector->currentIndex()});
|
det->setRxZmqIP(sls::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,
|
||||||
@ -893,5 +891,3 @@ void qTabAdvanced::Refresh() {
|
|||||||
}
|
}
|
||||||
LOG(logDEBUG) << "**Updated Advanced Tab";
|
LOG(logDEBUG) << "**Updated Advanced Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace sls {
|
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector)
|
||||||
|
|
||||||
qTabDataOutput::qTabDataOutput(QWidget *parent, Detector *detector)
|
|
||||||
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -234,7 +232,7 @@ void qTabDataOutput::GetFileFormat() {
|
|||||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown file format: ") +
|
throw sls::RuntimeError(std::string("Unknown file format: ") +
|
||||||
std::to_string(static_cast<int>(retval)));
|
std::to_string(static_cast<int>(retval)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,7 +339,7 @@ void qTabDataOutput::EnableRateCorrection() {
|
|||||||
LOG(logINFO) << "Disabling Rate correction";
|
LOG(logINFO) << "Disabling Rate correction";
|
||||||
// disable
|
// disable
|
||||||
try {
|
try {
|
||||||
det->setRateCorrection(ns(0));
|
det->setRateCorrection(sls::ns(0));
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not switch off rate correction.",
|
CATCH_HANDLE("Could not switch off rate correction.",
|
||||||
"qTabDataOutput::EnableRateCorrection", this,
|
"qTabDataOutput::EnableRateCorrection", this,
|
||||||
@ -359,7 +357,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(ns(deadtime));
|
det->setRateCorrection(sls::ns(deadtime));
|
||||||
}
|
}
|
||||||
// default dead time
|
// default dead time
|
||||||
else {
|
else {
|
||||||
@ -444,5 +442,3 @@ void qTabDataOutput::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated DataOutput Tab";
|
LOG(logDEBUG) << "**Updated DataOutput Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -7,9 +7,7 @@
|
|||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
|
|
||||||
namespace sls {
|
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector)
|
||||||
|
|
||||||
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) {
|
||||||
@ -64,7 +62,7 @@ void qTabDebugging::GetDetectorStatus() {
|
|||||||
LOG(logDEBUG) << "Getting Status";
|
LOG(logDEBUG) << "Getting Status";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::string status = ToString(
|
std::string status = sls::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());
|
||||||
}
|
}
|
||||||
@ -90,7 +88,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(ToString(det->getDetectorType().squash()).c_str());
|
QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
||||||
|
|
||||||
switch (det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
|
|
||||||
@ -243,5 +241,3 @@ void qTabDebugging::Refresh() {
|
|||||||
GetDetectorStatus();
|
GetDetectorStatus();
|
||||||
LOG(logDEBUG) << "**Updated Debugging Tab";
|
LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
#include "qDacWidget.h"
|
#include "qDacWidget.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
namespace sls {
|
qTabDeveloper::qTabDeveloper(QWidget *parent, sls::Detector *detector)
|
||||||
|
|
||||||
qTabDeveloper::qTabDeveloper(QWidget *parent, Detector *detector)
|
|
||||||
: QWidget(parent), det(detector) {
|
: QWidget(parent), det(detector) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -18,6 +16,12 @@ 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) {
|
||||||
@ -78,6 +82,8 @@ 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++)));
|
||||||
@ -111,6 +117,8 @@ 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++)));
|
||||||
@ -140,6 +148,8 @@ 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++)));
|
||||||
@ -163,6 +173,9 @@ 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(
|
||||||
@ -203,6 +216,9 @@ 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++)));
|
||||||
@ -274,6 +290,9 @@ 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() {
|
||||||
@ -290,6 +309,75 @@ 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) {
|
||||||
@ -343,7 +431,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 22:
|
case 22:
|
||||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dac/adc index") +
|
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -370,7 +458,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 9:
|
case 9:
|
||||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dac/adc index") +
|
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -396,7 +484,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 8:
|
case 8:
|
||||||
return slsDetectorDefs::TEMPERATURE_ADC;
|
return slsDetectorDefs::TEMPERATURE_ADC;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dac/adc index") +
|
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -420,7 +508,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 7:
|
case 7:
|
||||||
return slsDetectorDefs::IBIAS_SFP;
|
return slsDetectorDefs::IBIAS_SFP;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dac/adc index") +
|
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -462,7 +550,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 16:
|
case 16:
|
||||||
return slsDetectorDefs::VTHRESHOLD;
|
return slsDetectorDefs::VTHRESHOLD;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dac/adc index") +
|
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -498,13 +586,13 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
|||||||
case 13:
|
case 13:
|
||||||
return slsDetectorDefs::VCOM_ADC2;
|
return slsDetectorDefs::VCOM_ADC2;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dac/adc index") +
|
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown detector type"));
|
throw sls::RuntimeError(std::string("Unknown detector type"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +604,6 @@ 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,9 +7,7 @@
|
|||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
namespace sls {
|
qTabMeasurement::qTabMeasurement(QWidget *parent, sls::Detector *detector,
|
||||||
|
|
||||||
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);
|
||||||
@ -339,26 +337,9 @@ 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:
|
||||||
@ -372,7 +353,7 @@ void qTabMeasurement::GetTimingMode() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown timing mode: ") +
|
throw sls::RuntimeError(std::string("Unknown timing mode: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,7 +390,7 @@ void qTabMeasurement::GetBurstMode() {
|
|||||||
ShowTriggerDelay();
|
ShowTriggerDelay();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown burst mode: ") +
|
throw sls::RuntimeError(std::string("Unknown burst mode: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1019,5 +1000,3 @@ void qTabMeasurement::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated Measurement Tab";
|
LOG(logDEBUG) << "**Updated Measurement Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
#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();
|
||||||
@ -144,5 +142,3 @@ void qTabMessages::Refresh() {
|
|||||||
dispCommand->clear();
|
dispCommand->clear();
|
||||||
dispCommand->setFocus();
|
dispCommand->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#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");
|
||||||
@ -15,7 +13,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, Detector *detector, qDrawPlot *p)
|
qTabPlot::qTabPlot(QWidget *parent, sls::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();
|
||||||
@ -76,10 +74,6 @@ 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() {
|
||||||
@ -333,7 +327,6 @@ 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)
|
||||||
@ -799,5 +792,3 @@ void qTabPlot::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated Plot Tab";
|
LOG(logDEBUG) << "**Updated Plot Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -6,9 +6,7 @@
|
|||||||
#include "sls/bit_utils.h"
|
#include "sls/bit_utils.h"
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
namespace sls {
|
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector)
|
||||||
|
|
||||||
qTabSettings::qTabSettings(QWidget *parent, Detector *detector)
|
|
||||||
: QWidget(parent), det(detector) {
|
: QWidget(parent), det(detector) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -19,12 +17,6 @@ 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();
|
||||||
@ -43,9 +35,6 @@ 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);
|
||||||
|
|
||||||
@ -86,28 +75,13 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} 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
|
||||||
@ -189,11 +163,6 @@ 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,
|
||||||
@ -230,91 +199,6 @@ 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,
|
||||||
@ -331,7 +215,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 RuntimeError(std::string("Unknown settings: ") +
|
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
comboSettings->setCurrentIndex(retval);
|
comboSettings->setCurrentIndex(retval);
|
||||||
@ -347,7 +231,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 " << ToString(val);
|
LOG(logINFO) << "Setting Settings to " << sls::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,
|
||||||
@ -366,7 +250,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 RuntimeError(std::string("Unknown gain mode: ") +
|
throw sls::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
|
||||||
@ -437,7 +321,7 @@ void qTabSettings::GetDynamicRange() {
|
|||||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dynamic range: ") +
|
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,7 +352,7 @@ void qTabSettings::SetDynamicRange(int index) {
|
|||||||
det->setDynamicRange(4);
|
det->setDynamicRange(4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(std::string("Unknown dynamic range: ") +
|
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
||||||
std::to_string(index));
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -515,7 +399,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 " << ToString(eV)
|
LOG(logINFO) << "Setting Threshold Energies to " << sls::ToString(eV)
|
||||||
<< " (eV)";
|
<< " (eV)";
|
||||||
try {
|
try {
|
||||||
det->setThresholdEnergy(eV, sett);
|
det->setThresholdEnergy(eV, sett);
|
||||||
@ -546,7 +430,7 @@ void qTabSettings::GetCounterMask() {
|
|||||||
disconnect(chkCounter3, SIGNAL(toggled(bool)), this,
|
disconnect(chkCounter3, SIGNAL(toggled(bool)), this,
|
||||||
SLOT(SetCounterMask()));
|
SLOT(SetCounterMask()));
|
||||||
try {
|
try {
|
||||||
auto retval = getSetBits(det->getCounterMask().tsquash(
|
auto retval = sls::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) {
|
||||||
@ -555,7 +439,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 RuntimeError(
|
throw sls::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)));
|
||||||
}
|
}
|
||||||
@ -586,8 +470,6 @@ 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();
|
||||||
}
|
}
|
||||||
@ -614,5 +496,3 @@ void qTabSettings::Refresh() {
|
|||||||
|
|
||||||
LOG(logDEBUG) << "**Updated Settings Tab";
|
LOG(logDEBUG) << "**Updated Settings Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
Binary file not shown.
@ -2060,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[Y];
|
header->row = detPos[X];
|
||||||
header->column = detPos[X];
|
header->column = detPos[Y];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
|
@ -1095,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, ("Setting Position: (%d, %d)\n", pos[X], pos[Y]));
|
LOG(logINFO, ("Got Position values %d %d...\n", pos[0], pos[1]));
|
||||||
|
|
||||||
// save positions
|
// save positions
|
||||||
Beb_positions[Y] = pos[Y];
|
Beb_positions[0] = pos[0];
|
||||||
Beb_positions[X] = pos[X];
|
Beb_positions[1] = pos[1];
|
||||||
|
|
||||||
// get left and right
|
// get left and right
|
||||||
int posLeft[2] = {Beb_top ? pos[X] : pos[X] + 1, pos[Y]};
|
int posLeft[2] = {pos[0], Beb_top ? pos[1] : pos[1] + 1};
|
||||||
int posRight[2] = {Beb_top ? pos[X] + 1 : pos[X], pos[Y]};
|
int posRight[2] = {pos[0], Beb_top ? pos[1] + 1 : pos[1]};
|
||||||
|
|
||||||
if (Beb_quadEnable) {
|
if (Beb_quadEnable) {
|
||||||
posRight[Y] = 1; // right is next row
|
posRight[0] = 1; // right is next row
|
||||||
posRight[X] = 0; // right same first column
|
posRight[1] = 0; // right same first column
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
@ -1122,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[Y]);
|
int posval = Beb_swap_uint16(posLeft[0]);
|
||||||
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,
|
||||||
@ -1134,7 +1134,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
// x right
|
// x right
|
||||||
posval = Beb_swap_uint16(posRight[Y]);
|
posval = Beb_swap_uint16(posRight[0]);
|
||||||
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,
|
||||||
@ -1147,7 +1147,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// y left (column)
|
// y left (column)
|
||||||
posval = Beb_swap_uint16(posLeft[X]);
|
posval = Beb_swap_uint16(posLeft[1]);
|
||||||
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,
|
||||||
@ -1160,7 +1160,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// y right
|
// y right
|
||||||
posval = Beb_swap_uint16(posRight[X]);
|
posval = Beb_swap_uint16(posRight[1]);
|
||||||
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,
|
||||||
@ -1176,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 (col, row):\n"
|
LOG(logINFO, ("Position set to...\n"
|
||||||
"\tLeft: [%d, %d]\n"
|
"\tLeft: [%d, %d]\n"
|
||||||
"\tRight:[%d, %d]\n",
|
"\tRight:[%d, %d]\n",
|
||||||
posLeft[X], posLeft[Y], posRight[X], posRight[Y]));
|
posLeft[0], posLeft[1], posRight[0], posRight[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Binary file not shown.
@ -19,7 +19,7 @@
|
|||||||
#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;
|
||||||
@ -57,6 +57,7 @@ int normal = 0;
|
|||||||
int eiger_highvoltage = 0;
|
int eiger_highvoltage = 0;
|
||||||
int eiger_theo_highvoltage = 0;
|
int eiger_theo_highvoltage = 0;
|
||||||
int eiger_iodelay = 0;
|
int eiger_iodelay = 0;
|
||||||
|
int eiger_photonenergy = 0;
|
||||||
int eiger_dynamicrange = 0;
|
int eiger_dynamicrange = 0;
|
||||||
int eiger_parallelmode = 0;
|
int eiger_parallelmode = 0;
|
||||||
int eiger_overflow32 = 0;
|
int eiger_overflow32 = 0;
|
||||||
@ -681,17 +682,17 @@ void allocateDetectorStructureMemory() {
|
|||||||
("modules from 0x%x to 0x%x\n", detectorModules, detectorModules));
|
("modules from 0x%x to 0x%x\n", detectorModules, detectorModules));
|
||||||
LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n", detectorChans, detectorChans));
|
LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n", detectorChans, detectorChans));
|
||||||
LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n", detectorDacs, detectorDacs));
|
LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n", detectorDacs, detectorDacs));
|
||||||
detectorModules->dacs = detectorDacs;
|
(detectorModules)->dacs = detectorDacs;
|
||||||
detectorModules->chanregs = detectorChans;
|
(detectorModules)->chanregs = detectorChans;
|
||||||
detectorModules->ndac = NDAC;
|
(detectorModules)->ndac = NDAC;
|
||||||
detectorModules->nchip = NCHIP;
|
(detectorModules)->nchip = NCHIP;
|
||||||
detectorModules->nchan = NCHIP * NCHAN;
|
(detectorModules)->nchan = NCHIP * NCHAN;
|
||||||
detectorModules->reg = 0;
|
(detectorModules)->reg = 0;
|
||||||
detectorModules->iodelay = 0;
|
(detectorModules)->iodelay = 0;
|
||||||
detectorModules->tau = 0;
|
(detectorModules)->tau = 0;
|
||||||
detectorModules->eV[0] = -1;
|
(detectorModules)->eV[0] = 0;
|
||||||
detectorModules->eV[1] = -1;
|
(detectorModules)->eV[1] = 0;
|
||||||
detectorModules->eV[2] = -1;
|
(detectorModules)->eV[2] = 0;
|
||||||
thisSettings = UNINITIALIZED;
|
thisSettings = UNINITIALIZED;
|
||||||
|
|
||||||
// if trimval requested, should return -1 to acknowledge unknown
|
// if trimval requested, should return -1 to acknowledge unknown
|
||||||
@ -731,8 +732,9 @@ void setupDetector() {
|
|||||||
getSubExpTime(DEFAULT_SUBFRAME_DEADTIME);
|
getSubExpTime(DEFAULT_SUBFRAME_DEADTIME);
|
||||||
setPeriod(DEFAULT_PERIOD);
|
setPeriod(DEFAULT_PERIOD);
|
||||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||||
|
eiger_dynamicrange = DEFAULT_DYNAMIC_RANGE;
|
||||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||||
detectorModules->eV[0] = DEFAULT_PHOTON_ENERGY;
|
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
|
||||||
setParallelMode(DEFAULT_PARALLEL_MODE);
|
setParallelMode(DEFAULT_PARALLEL_MODE);
|
||||||
setOverFlowMode(DEFAULT_READOUT_OVERFLOW32_MODE);
|
setOverFlowMode(DEFAULT_READOUT_OVERFLOW32_MODE);
|
||||||
setReadoutSpeed(DEFAULT_CLK_SPEED);
|
setReadoutSpeed(DEFAULT_CLK_SPEED);
|
||||||
@ -1125,43 +1127,25 @@ int64_t getMeasuredSubPeriod() {
|
|||||||
|
|
||||||
/* parameters - channel, module, settings */
|
/* parameters - channel, module, settings */
|
||||||
|
|
||||||
void getModule(sls_detector_module* myMod) {
|
|
||||||
// serial number
|
|
||||||
myMod->serialnumber = detectorModules->serialnumber;
|
|
||||||
// reg (settings)
|
|
||||||
myMod->reg = detectorModules->reg;
|
|
||||||
// iodelay
|
|
||||||
myMod->iodelay = setIODelay(-1);
|
|
||||||
// tau
|
|
||||||
myMod->tau = (int) getCurrentTau();
|
|
||||||
// eV
|
|
||||||
myMod->eV[0] = detectorModules->eV[0];
|
|
||||||
// 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 with settings %d\n", myMod.reg));
|
LOG(logINFO, ("Setting module with settings %d\n", myMod.reg));
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
setSettings((enum detectorSettings)myMod.reg);
|
setSettings((enum detectorSettings)myMod.reg);
|
||||||
|
|
||||||
|
// copy module locally (module number, serial number
|
||||||
|
// dacs (pointless), trimbit values(if needed)
|
||||||
|
if (detectorModules) {
|
||||||
|
if (copyModule(detectorModules, &myMod) == FAIL) {
|
||||||
|
sprintf(mess, "Could not copy module\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
setSettings(UNDEFINED);
|
||||||
|
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// iodelay
|
// iodelay
|
||||||
if (setIODelay(myMod.iodelay) != myMod.iodelay) {
|
if (setIODelay(myMod.iodelay) != myMod.iodelay) {
|
||||||
sprintf(mess, "Could not set module. Could not set iodelay %d\n",
|
sprintf(mess, "Could not set module. Could not set iodelay %d\n",
|
||||||
@ -1194,15 +1178,60 @@ int setModule(sls_detector_module myMod, char *mess) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// trimbits
|
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
|
// trimbits
|
||||||
if (myMod.nchan == 0) {
|
if (myMod.nchan == 0) {
|
||||||
LOG(logINFO, ("Setting module without trimbits\n"));
|
LOG(logINFO, ("Setting module without trimbits\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("Setting module with trimbits\n"));
|
LOG(logINFO, ("Setting module with trimbits\n"));
|
||||||
if (setTrimbits(myMod.chanregs, mess) == FAIL) {
|
// includ gap pixels
|
||||||
|
unsigned int tt[263680];
|
||||||
|
int ip = 0, ich = 0;
|
||||||
|
for (int iy = 0; iy < 256; ++iy) {
|
||||||
|
for (int ichip = 0; ichip < 4; ++ichip) {
|
||||||
|
for (int ix = 0; ix < 256; ++ix) {
|
||||||
|
tt[ip++] = myMod.chanregs[ich++];
|
||||||
|
}
|
||||||
|
if (ichip < 3) {
|
||||||
|
tt[ip++] = 0;
|
||||||
|
tt[ip++] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set trimbits
|
||||||
|
sharedMemory_lockLocalLink();
|
||||||
|
|
||||||
|
// if quad, set M8 and PROGRAM manually
|
||||||
|
if (!Feb_Control_SetChipSignalsToTrimQuad(1)) {
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Feb_Control_SetTrimbits(tt, top)) {
|
||||||
|
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
setSettings(UNDEFINED);
|
||||||
|
LOG(logERROR, ("Settings has been changed to undefined (random "
|
||||||
|
"trim file)\n"));
|
||||||
|
|
||||||
|
// if quad, reset M8 and PROGRAM manually
|
||||||
|
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if quad, reset M8 and PROGRAM manually
|
||||||
|
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sharedMemory_unlockLocalLink();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1255,7 +1284,6 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
thisSettings = sett;
|
thisSettings = sett;
|
||||||
detectorModules->reg = sett;
|
|
||||||
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
@ -1266,14 +1294,13 @@ enum detectorSettings getSettings() { return thisSettings; }
|
|||||||
|
|
||||||
int getThresholdEnergy() {
|
int getThresholdEnergy() {
|
||||||
LOG(logDEBUG1, ("Getting Threshold energy\n"));
|
LOG(logDEBUG1, ("Getting Threshold energy\n"));
|
||||||
return detectorModules->eV[0];
|
return eiger_photonenergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setThresholdEnergy(int ev) {
|
int setThresholdEnergy(int ev) {
|
||||||
LOG(logINFO, ("Setting threshold energy:%d\n", ev));
|
LOG(logINFO, ("Setting threshold energy:%d\n", ev));
|
||||||
if (ev >= 0) {
|
if (ev >= 0)
|
||||||
detectorModules->eV[0] = ev;
|
eiger_photonenergy = ev;
|
||||||
}
|
|
||||||
return getThresholdEnergy();
|
return getThresholdEnergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1883,7 +1910,6 @@ int setIODelay(int val) {
|
|||||||
#else
|
#else
|
||||||
eiger_iodelay = val;
|
eiger_iodelay = val;
|
||||||
#endif
|
#endif
|
||||||
detectorModules->iodelay = val;
|
|
||||||
}
|
}
|
||||||
return eiger_iodelay;
|
return eiger_iodelay;
|
||||||
}
|
}
|
||||||
@ -2127,6 +2153,7 @@ void setDefaultSettingsTau_in_nsec(int t) {
|
|||||||
int64_t getCurrentTau() {
|
int64_t getCurrentTau() {
|
||||||
if (!getRateCorrectionEnable()) {
|
if (!getRateCorrectionEnable()) {
|
||||||
eiger_tau_ns = 0;
|
eiger_tau_ns = 0;
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
@ -2135,10 +2162,9 @@ int64_t getCurrentTau() {
|
|||||||
#else
|
#else
|
||||||
eiger_tau_ns = eiger_virtual_ratetable_tau_in_ns;
|
eiger_tau_ns = eiger_virtual_ratetable_tau_in_ns;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
detectorModules->tau = eiger_tau_ns;
|
|
||||||
return eiger_tau_ns;
|
return eiger_tau_ns;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setExternalGating(int enable[]) {
|
void setExternalGating(int enable[]) {
|
||||||
// not configured from client
|
// not configured from client
|
||||||
@ -2158,68 +2184,6 @@ void setExternalGating(int enable[]) {
|
|||||||
enable[1] = eiger_extgatingpolarity;
|
enable[1] = eiger_extgatingpolarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setTrimbits(int* chanregs, char* mess) {
|
|
||||||
LOG(logINFO, ("Setting module with trimbits\n"));
|
|
||||||
#ifndef VIRTUAL
|
|
||||||
// include gap pixels
|
|
||||||
unsigned int tt[263680];
|
|
||||||
int ip = 0, ich = 0;
|
|
||||||
for (int iy = 0; iy < 256; ++iy) {
|
|
||||||
for (int ichip = 0; ichip < 4; ++ichip) {
|
|
||||||
for (int ix = 0; ix < 256; ++ix) {
|
|
||||||
tt[ip++] = chanregs[ich++];
|
|
||||||
}
|
|
||||||
if (ichip < 3) {
|
|
||||||
tt[ip++] = 0;
|
|
||||||
tt[ip++] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set trimbits
|
|
||||||
sharedMemory_lockLocalLink();
|
|
||||||
|
|
||||||
// if quad, set M8 and PROGRAM manually
|
|
||||||
if (!Feb_Control_SetChipSignalsToTrimQuad(1)) {
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Feb_Control_SetTrimbits(tt, top)) {
|
|
||||||
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
setSettings(UNDEFINED);
|
|
||||||
LOG(logERROR, ("Settings has been changed to undefined (random "
|
|
||||||
"trim file)\n"));
|
|
||||||
|
|
||||||
// if quad, reset M8 and PROGRAM manually
|
|
||||||
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if quad, reset M8 and PROGRAM manually
|
|
||||||
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
sharedMemory_unlockLocalLink();
|
|
||||||
|
|
||||||
// copying trimbits locally (if tirmbit value > -1)
|
|
||||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
|
||||||
if (*(chanregs + ichan) >= 0)
|
|
||||||
*((detectorModules->chanregs) + ichan) = *(chanregs + ichan);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int setAllTrimbits(int val) {
|
int setAllTrimbits(int val) {
|
||||||
LOG(logINFO, ("Setting all trimbits to %d\n", val));
|
LOG(logINFO, ("Setting all trimbits to %d\n", val));
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
@ -2231,8 +2195,6 @@ int setAllTrimbits(int val) {
|
|||||||
}
|
}
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// copying trimbits locally
|
|
||||||
if (detectorModules) {
|
if (detectorModules) {
|
||||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||||
*((detectorModules->chanregs) + ichan) = val;
|
*((detectorModules->chanregs) + ichan) = val;
|
||||||
@ -2486,17 +2448,15 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int skipData = 0;
|
int skipData = 0;
|
||||||
int tgEnable = send_to_ten_gig;
|
|
||||||
if (!eiger_virtual_activate ||
|
if (!eiger_virtual_activate ||
|
||||||
(tgEnable &&
|
(!eiger_virtual_left_datastream && !eiger_virtual_right_datastream)) {
|
||||||
(!eiger_virtual_left_datastream && !eiger_virtual_right_datastream))) {
|
|
||||||
skipData = 1;
|
skipData = 1;
|
||||||
LOG(logWARNING, ("Not sending Left and Right datastream\n"));
|
LOG(logWARNING, ("Not sending Left and Right datastream\n"));
|
||||||
}
|
}
|
||||||
if (tgEnable && !eiger_virtual_left_datastream) {
|
if (!eiger_virtual_left_datastream) {
|
||||||
LOG(logWARNING, ("Not sending Left datastream\n"));
|
LOG(logWARNING, ("Not sending Left datastream\n"));
|
||||||
}
|
}
|
||||||
if (tgEnable && !eiger_virtual_right_datastream) {
|
if (!eiger_virtual_right_datastream) {
|
||||||
LOG(logWARNING, ("Not sending Right datastream\n"));
|
LOG(logWARNING, ("Not sending Right datastream\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2506,14 +2466,15 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
int dr = eiger_dynamicrange;
|
int dr = eiger_dynamicrange;
|
||||||
double bytesPerPixel = (double)dr / 8.00;
|
double bytesPerPixel = (double)dr / 8.00;
|
||||||
|
int tgEnable = send_to_ten_gig;
|
||||||
int datasize = (tgEnable ? 4096 : 1024);
|
int datasize = (tgEnable ? 4096 : 1024);
|
||||||
int packetsize = datasize + sizeof(sls_detector_header);
|
int packetsize = datasize + sizeof(sls_detector_header);
|
||||||
int maxPacketsPerFrame = (tgEnable ? 4 : 16) * dr;
|
int maxPacketsPerFrame = (tgEnable ? 4 : 16) * dr;
|
||||||
int npixelsx = 256 * 2 * bytesPerPixel;
|
int npixelsx = 256 * 2 * bytesPerPixel;
|
||||||
int databytes = 256 * 256 * 2 * bytesPerPixel;
|
int databytes = 256 * 256 * 2 * bytesPerPixel;
|
||||||
int row = eiger_virtual_detPos[Y];
|
int row = eiger_virtual_detPos[0];
|
||||||
int colLeft = top ? eiger_virtual_detPos[X] : eiger_virtual_detPos[X] + 1;
|
int colLeft = top ? eiger_virtual_detPos[1] : eiger_virtual_detPos[1] + 1;
|
||||||
int colRight = top ? eiger_virtual_detPos[X] + 1 : eiger_virtual_detPos[X];
|
int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
|
||||||
|
|
||||||
int readNRows = getReadNRows();
|
int readNRows = getReadNRows();
|
||||||
if (readNRows == -1) {
|
if (readNRows == -1) {
|
||||||
@ -2586,20 +2547,8 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
// to debug multi module geometry (row, column) in virtual servers (all pixels
|
|
||||||
// in a module set to particular value)
|
|
||||||
#ifdef TEST_MOD_GEOMETRY
|
|
||||||
if ((i % 1024) < 512) {
|
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
|
||||||
top ? (portno % 1900) : ((portno % 1900) + 1);
|
|
||||||
} else {
|
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
|
||||||
top ? ((portno % 1900) + 1) : (portno % 1900);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||||
eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
|
eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||||
@ -2723,16 +2672,14 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((!tgEnable ||
|
if (eiger_virtual_left_datastream && i >= startval &&
|
||||||
(tgEnable && eiger_virtual_left_datastream)) &&
|
i <= endval) {
|
||||||
i >= startval && i <= endval) {
|
|
||||||
usleep(eiger_virtual_transmission_delay_left);
|
usleep(eiger_virtual_transmission_delay_left);
|
||||||
sendUDPPacket(iRxEntry, 0, packetData, packetsize);
|
sendUDPPacket(iRxEntry, 0, packetData, packetsize);
|
||||||
LOG(logDEBUG1, ("Sent left packet: %d\n", i));
|
LOG(logDEBUG1, ("Sent left packet: %d\n", i));
|
||||||
}
|
}
|
||||||
if ((!tgEnable ||
|
if (eiger_virtual_right_datastream && i >= startval &&
|
||||||
(tgEnable && eiger_virtual_right_datastream)) &&
|
i <= endval) {
|
||||||
i >= startval && i <= endval) {
|
|
||||||
usleep(eiger_virtual_transmission_delay_right);
|
usleep(eiger_virtual_transmission_delay_right);
|
||||||
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
|
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
|
||||||
LOG(logDEBUG1, ("Sent right packet: %d\n", i));
|
LOG(logDEBUG1, ("Sent right packet: %d\n", i));
|
||||||
@ -2944,6 +2891,53 @@ void readFrame(int *ret, char *mess) {
|
|||||||
|
|
||||||
/* 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;
|
||||||
|
if (srcMod->eV[0] >= 0)
|
||||||
|
destMod->eV[0] = srcMod->eV[0];
|
||||||
|
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++) {
|
||||||
|
if (*((srcMod->chanregs) + ichan) >= 0)
|
||||||
|
*((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() {
|
||||||
if (send_to_ten_gig)
|
if (send_to_ten_gig)
|
||||||
return eiger_dynamicrange * ONE_GIGA_CONSTANT * TEN_GIGA_BUFFER_SIZE;
|
return eiger_dynamicrange * ONE_GIGA_CONSTANT * TEN_GIGA_BUFFER_SIZE;
|
||||||
|
Binary file not shown.
@ -1917,7 +1917,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
// row
|
// row
|
||||||
value = detPos[Y];
|
value = detPos[X];
|
||||||
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);
|
||||||
@ -1928,7 +1928,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// col
|
// col
|
||||||
value = detPos[X];
|
value = detPos[Y];
|
||||||
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);
|
||||||
@ -1939,8 +1939,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
LOG(logINFO,
|
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||||
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -2297,24 +2296,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2816,10 +2797,13 @@ 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));
|
||||||
@ -3111,8 +3095,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[Y];
|
header->row = detPos[X];
|
||||||
header->column = detPos[X];
|
header->column = detPos[Y];
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
||||||
datasize);
|
datasize);
|
||||||
|
Binary file not shown.
@ -432,8 +432,6 @@ 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();
|
||||||
|
|
||||||
@ -859,10 +857,8 @@ 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, %d, %d)\n", arg.xmin, arg.xmax, arg.ymin, arg.ymax));
|
LOG(logINFO, ("Setting ROI:(%d, %d)\n", arg.xmin, arg.xmax));
|
||||||
// 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) ||
|
||||||
@ -896,7 +892,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,%d,%d)\n", rois.xmin, rois.xmax, rois.ymin, rois.ymax));
|
LOG(logINFO, ("ROI: (%d,%d)\n", rois.xmin, rois.xmax));
|
||||||
}
|
}
|
||||||
return rois;
|
return rois;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ target_include_directories(jungfrauDetectorServer_virtual
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(jungfrauDetectorServer_virtual
|
target_compile_definitions(jungfrauDetectorServer_virtual
|
||||||
PUBLIC JUNGFRAUD VIRTUAL STOP_SERVER #TEST_MOD_GEOMETRY
|
PUBLIC JUNGFRAUD VIRTUAL STOP_SERVER
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(jungfrauDetectorServer_virtual
|
target_link_libraries(jungfrauDetectorServer_virtual
|
||||||
|
Binary file not shown.
@ -21,7 +21,7 @@
|
|||||||
#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;
|
||||||
@ -1621,7 +1621,6 @@ 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();
|
||||||
@ -1631,16 +1630,15 @@ 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 {
|
||||||
// top has row incremented by 1
|
++outerPos[X];
|
||||||
++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[X];
|
detPos[0] = innerPos[0];
|
||||||
detPos[1] = innerPos[Y];
|
detPos[1] = innerPos[1];
|
||||||
detPos[2] = outerPos[X];
|
detPos[2] = outerPos[0];
|
||||||
detPos[3] = outerPos[Y];
|
detPos[3] = outerPos[1];
|
||||||
|
|
||||||
// row
|
// row
|
||||||
// outer
|
// outer
|
||||||
@ -1678,8 +1676,8 @@ int setDetectorPosition(int pos[]) {
|
|||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
if (getNumberofUDPInterfaces() == 1) {
|
if (getNumberofUDPInterfaces() == 1) {
|
||||||
LOG(logINFOBLUE, ("Position set to [%d, %d] #(col, row)\n",
|
LOG(logINFOBLUE,
|
||||||
innerPos[X], innerPos[Y]));
|
("Position set to [%d, %d]\n", 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]));
|
||||||
@ -2533,16 +2531,8 @@ 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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2567,10 +2557,6 @@ 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) {
|
||||||
|
|
||||||
@ -2590,8 +2576,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 = row0;
|
header->row = detPos[0];
|
||||||
header->column = col0;
|
header->column = detPos[1];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
@ -2617,8 +2603,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 = row1;
|
header->row = detPos[2];
|
||||||
header->column = col1;
|
header->column = detPos[3];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||||
|
Binary file not shown.
@ -1731,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[Y];
|
header->row = detPos[X];
|
||||||
header->column = detPos[X];
|
header->column = detPos[Y];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
|
Binary file not shown.
@ -10,6 +10,20 @@
|
|||||||
|
|
||||||
#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); }
|
||||||
@ -18,6 +32,44 @@ 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;
|
||||||
@ -97,116 +149,54 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
|
|||||||
return pat;
|
return pat;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getGainCaps() {
|
patternParameters *setInterpolation(int mask) {
|
||||||
int csr = chipStatusRegister;
|
int csr;
|
||||||
// Translates bit representation
|
if (mask)
|
||||||
int caps = 0;
|
csr = chipStatusRegister | (1 << CSR_interp);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
int M3SetGainCaps(int caps) {
|
|
||||||
int csr = chipStatusRegister & ~GAIN_MASK;
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getInterpolation() {
|
|
||||||
return ((chipStatusRegister & CSR_interp_MSK) >> CSR_interp);
|
|
||||||
}
|
|
||||||
|
|
||||||
int M3SetInterpolation(int enable) {
|
|
||||||
int csr = 0;
|
|
||||||
if (enable)
|
|
||||||
csr = chipStatusRegister | CSR_interp_MSK;
|
|
||||||
else
|
else
|
||||||
csr = chipStatusRegister & ~CSR_interp_MSK;
|
csr = chipStatusRegister & ~(1 << CSR_interp);
|
||||||
return csr;
|
|
||||||
|
return setChipStatusRegisterPattern(csr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getPumpProbe() {
|
patternParameters *setPumpProbe(int mask) {
|
||||||
return ((chipStatusRegister & CSR_pumprobe_MSK) >> CSR_pumprobe);
|
int csr;
|
||||||
}
|
if (mask)
|
||||||
|
csr = chipStatusRegister | (1 << CSR_pumprobe);
|
||||||
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 & ~CSR_pumprobe_MSK;
|
csr = chipStatusRegister & ~(1 << CSR_pumprobe);
|
||||||
return csr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getDigitalPulsing() {
|
return setChipStatusRegisterPattern(csr);
|
||||||
return ((chipStatusRegister & CSR_dpulse_MSK) >> CSR_dpulse);
|
|
||||||
}
|
}
|
||||||
|
patternParameters *setDigitalPulsing(int mask) {
|
||||||
|
|
||||||
int M3SetDigitalPulsing(int enable) {
|
int csr;
|
||||||
LOG(logINFO,
|
if (mask)
|
||||||
("%s Digital Pulsing\n", enable == 0 ? "Disabling" : "Enabling"));
|
csr = chipStatusRegister | (1 << CSR_dpulse);
|
||||||
int csr = 0;
|
|
||||||
if (enable)
|
|
||||||
csr = chipStatusRegister | CSR_dpulse_MSK;
|
|
||||||
else
|
else
|
||||||
csr = chipStatusRegister & ~CSR_dpulse_MSK;
|
csr = chipStatusRegister & ~(1 << CSR_dpulse);
|
||||||
return csr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getAnalogPulsing() {
|
return setChipStatusRegisterPattern(csr);
|
||||||
return ((chipStatusRegister & CSR_apulse_MSK) >> CSR_apulse);
|
|
||||||
}
|
}
|
||||||
|
patternParameters *setAnalogPulsing(int mask) {
|
||||||
|
|
||||||
int M3SetAnalogPulsing(int enable) {
|
int csr;
|
||||||
LOG(logINFO,
|
if (mask)
|
||||||
("%s Analog Pulsing\n", enable == 0 ? "Disabling" : "Enabling"));
|
csr = chipStatusRegister | (1 << CSR_apulse);
|
||||||
int csr = 0;
|
|
||||||
if (enable)
|
|
||||||
csr = chipStatusRegister | CSR_apulse_MSK;
|
|
||||||
else
|
else
|
||||||
csr = chipStatusRegister & ~CSR_apulse_MSK;
|
csr = chipStatusRegister & ~(1 << CSR_apulse);
|
||||||
return csr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getNegativePolarity() {
|
return setChipStatusRegisterPattern(csr);
|
||||||
return ((chipStatusRegister & CSR_invpol_MSK) >> CSR_invpol);
|
|
||||||
}
|
}
|
||||||
|
patternParameters *setNegativePolarity(int mask) {
|
||||||
|
|
||||||
int M3SetNegativePolarity(int enable) {
|
int csr;
|
||||||
LOG(logINFO,
|
if (mask)
|
||||||
("%s Negative Polarity\n", enable == 0 ? "Disabling" : "Enabling"));
|
csr = chipStatusRegister | (1 << CSR_invpol);
|
||||||
int csr = 0;
|
|
||||||
if (enable)
|
|
||||||
csr = chipStatusRegister | CSR_invpol_MSK;
|
|
||||||
else
|
else
|
||||||
csr = chipStatusRegister & ~CSR_invpol_MSK;
|
csr = chipStatusRegister & ~(1 << CSR_invpol);
|
||||||
return csr;
|
|
||||||
|
return setChipStatusRegisterPattern(csr);
|
||||||
}
|
}
|
||||||
|
|
||||||
patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits) {
|
patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits) {
|
||||||
|
@ -49,12 +49,6 @@
|
|||||||
// 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 \
|
||||||
@ -64,20 +58,15 @@
|
|||||||
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);
|
||||||
int getGainCaps();
|
patternParameters *setInterpolation(int mask);
|
||||||
int M3SetGainCaps(int caps);
|
patternParameters *setPumpProbe(int mask);
|
||||||
int getInterpolation();
|
patternParameters *setDigitalPulsing(int mask);
|
||||||
int M3SetInterpolation(int enable);
|
patternParameters *setAnalogPulsing(int mask);
|
||||||
int getPumpProbe();
|
patternParameters *setNegativePolarity(int mask);
|
||||||
int M3SetPumpProbe(int enable);
|
|
||||||
int getDigitalPulsing();
|
|
||||||
int M3SetDigitalPulsing(int enable);
|
|
||||||
int getAnalogPulsing();
|
|
||||||
int M3SetAnalogPulsing(int enable);
|
|
||||||
int getNegativePolarity();
|
|
||||||
int M3SetNegativePolarity(int enable);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,7 +68,6 @@ 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; }
|
||||||
|
|
||||||
@ -422,7 +421,7 @@ void allocateDetectorStructureMemory() {
|
|||||||
detectorDacs[idac] = 0;
|
detectorDacs[idac] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// trimbits start at 0
|
// trimbits start at 0 //TODO: restart server will not have 0 always
|
||||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||||
*((detectorModules->chanregs) + ichan) = 0;
|
*((detectorModules->chanregs) + ichan) = 0;
|
||||||
}
|
}
|
||||||
@ -475,19 +474,17 @@ void setupDetector() {
|
|||||||
|
|
||||||
// defaults
|
// defaults
|
||||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||||
|
resetToDefaultDacs(0);
|
||||||
setASICDefaults();
|
setASICDefaults();
|
||||||
setADIFDefaults();
|
setADIFDefaults();
|
||||||
|
|
||||||
// enable all counters before setting dacs (vthx)
|
|
||||||
setCounterMask(MAX_COUNTER_MSK);
|
|
||||||
resetToDefaultDacs(0);
|
|
||||||
|
|
||||||
// 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);
|
||||||
@ -599,8 +596,8 @@ int resetToDefaultDacs(int hardReset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set to default (last arg to ensure counter check)
|
// set to defualt
|
||||||
setDAC((enum DACINDEX)i, value, 0, 1);
|
setDAC((enum DACINDEX)i, value, 0);
|
||||||
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]));
|
||||||
@ -1090,44 +1087,12 @@ 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;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSetting counter mask to 0x%x\n", arg));
|
uint32_t oldmask = getCounterMask();
|
||||||
|
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) &
|
||||||
@ -1143,8 +1108,19 @@ void setCounterMaskWithUpdateFlag(uint32_t arg, int updateMaskFlag) {
|
|||||||
setGateDelay(i, ns);
|
setGateDelay(i, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateMaskFlag) {
|
LOG(logINFO, ("\tUpdating Vth dacs\n"));
|
||||||
counterMask = arg;
|
enum DACINDEX vthdacs[] = {M_VTH1, M_VTH2, M_VTH3};
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1265,8 +1241,7 @@ 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) {
|
||||||
// set to default (last arg to ensure counter check)
|
setDAC((enum DACINDEX)i, dacs[i], 0);
|
||||||
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) &&
|
||||||
@ -1280,55 +1255,21 @@ 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]);
|
||||||
@ -1359,7 +1300,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 (setClockDividerWithTimeUpdateOption(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV, 0) == FAIL) {
|
if (setClockDivider(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV) == 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;
|
||||||
@ -1392,17 +1333,11 @@ int setTrimbits(int *trimbits) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set back to previous clock
|
// set back to previous clock
|
||||||
if (setClockDividerWithTimeUpdateOption(SYSTEM_C0, prevRunClk, 0) == FAIL) {
|
if (setClockDivider(SYSTEM_C0, prevRunClk) == 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1468,8 +1403,7 @@ 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) {
|
||||||
// set to default (last arg to ensure counter check)
|
setDAC(specialDacs[i], dacVals[i], 0);
|
||||||
setDAC(specialDacs[i], dacVals[i], 0, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||||
@ -1477,9 +1411,6 @@ 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,
|
||||||
@ -1529,8 +1460,7 @@ void setThresholdEnergy(int counterIndex, int eV) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parameters - dac, hv */
|
/* parameters - dac, hv */
|
||||||
// counterEnableCheck false only if setDAC called directly
|
void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||||
void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck) {
|
|
||||||
// invalid value
|
// invalid value
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
return;
|
return;
|
||||||
@ -1541,10 +1471,7 @@ void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// threshold dacs
|
// threshold dacs (remember value, vthreshold: skip disabled)
|
||||||
// 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};
|
||||||
@ -1555,6 +1482,7 @@ void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck) {
|
|||||||
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;
|
||||||
@ -1564,17 +1492,10 @@ void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck) {
|
|||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Remembering %s [%d]\n", dac_names[ind], dacval));
|
("Remembering %s [%d]\n", dac_names[ind], dacval));
|
||||||
}
|
}
|
||||||
// disabled counter
|
// if vthreshold,skip for disabled counters
|
||||||
if (!(counters & (1 << i))) {
|
if ((ind == M_VTHRESHOLD) && (!(counters & (1 << i)))) {
|
||||||
// skip setting vthx dac (value remembered anyway)
|
|
||||||
if (ind == M_VTHRESHOLD) {
|
|
||||||
continue;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1614,19 +1535,6 @@ 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;
|
||||||
@ -1695,7 +1603,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
|
|
||||||
int master = 0;
|
int master = 0;
|
||||||
isMaster(&master);
|
isMaster(&master);
|
||||||
if (!master && arg == AUTO_TIMING)
|
if (master && arg == AUTO_TIMING)
|
||||||
arg = TRIGGER_EXPOSURE;
|
arg = TRIGGER_EXPOSURE;
|
||||||
|
|
||||||
uint32_t addr = CONFIG_REG;
|
uint32_t addr = CONFIG_REG;
|
||||||
@ -1781,56 +1689,6 @@ 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));
|
||||||
|
|
||||||
@ -2034,7 +1892,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
// row
|
// row
|
||||||
value = detPos[Y];
|
value = detPos[X];
|
||||||
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);
|
||||||
@ -2045,7 +1903,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// col
|
// col
|
||||||
value = detPos[X];
|
value = detPos[Y];
|
||||||
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);
|
||||||
@ -2056,8 +1914,7 @@ int setDetectorPosition(int pos[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
LOG(logINFO,
|
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||||
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -2268,10 +2125,6 @@ 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;
|
||||||
@ -2296,32 +2149,6 @@ int setClockDividerWithTimeUpdateOption(enum CLKINDEX ind, int val, int timeUpda
|
|||||||
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]));
|
||||||
@ -2437,7 +2264,6 @@ 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 {
|
||||||
@ -2459,24 +2285,29 @@ void *start_timer(void *arg) {
|
|||||||
{
|
{
|
||||||
const int nchannels = NCHAN_1_COUNTER * NCHIP * ncounters;
|
const int nchannels = NCHAN_1_COUNTER * NCHIP * ncounters;
|
||||||
|
|
||||||
for (int i = 0; i < nchannels; ++i) {
|
|
||||||
switch (dr) {
|
switch (dr) {
|
||||||
//case 1: // TODO: Not implemented in firmware yet
|
/*case 1: // TODO: Not implemented in firmware yet
|
||||||
// break;
|
break;*/
|
||||||
case 8:
|
case 8:
|
||||||
|
for (int i = 0; i < nchannels; ++i) {
|
||||||
*((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;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) = ((uint32_t)i & 0xFFFFFF); // 24 bit
|
for (int i = 0; i < nchannels; ++i) {
|
||||||
|
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||||
|
((uint32_t)i & 0xFFFFFF); // 24 bit
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Send data
|
// Send data
|
||||||
// loop over number of frames
|
// loop over number of frames
|
||||||
@ -2492,7 +2323,6 @@ 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) {
|
||||||
@ -2506,13 +2336,14 @@ 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[Y];
|
header->row = detPos[X];
|
||||||
header->column = detPos[X];
|
header->column = detPos[Y];
|
||||||
|
|
||||||
// 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,
|
||||||
@ -2692,6 +2523,56 @@ 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 = 0;
|
int dr = 0;
|
||||||
@ -2712,7 +2593,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 (setClockDividerWithTimeUpdateOption(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV, 0) == FAIL) {
|
if (setClockDivider(SYSTEM_C0, DEFAULT_TRIMMING_RUN_CLKDIV) == 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;
|
||||||
@ -2734,12 +2615,29 @@ int setChipStatusRegister(int csr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set back to previous clock
|
// set back to previous clock
|
||||||
if (setClockDividerWithTimeUpdateOption(SYSTEM_C0, prevRunClk, 0) == FAIL) {
|
if (setClockDivider(SYSTEM_C0, prevRunClk) == 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 */ \
|
||||||
800, /* vIcin */ \
|
1708, /* vIcin */ \
|
||||||
1800, /* cas */ \
|
1800, /* cas */ \
|
||||||
1100, /* Vrpreamp */ \
|
1100, /* Vrpreamp */ \
|
||||||
1100, /* Vcal_n */ \
|
1100, /* Vcal_n */ \
|
||||||
|
@ -66,5 +66,3 @@ 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,7 +26,6 @@ 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 programming);
|
int FPGAdontTouchFlash(char *mess);
|
||||||
int FPGATouchFlash(char *mess, int programming);
|
int FPGATouchFlash(char *mess);
|
||||||
int resetFPGA(char *mess);
|
int resetFPGA(char *mess);
|
||||||
|
|
||||||
int emptyTempFolder(char *mess);
|
int emptyTempFolder(char *mess);
|
||||||
@ -26,12 +26,10 @@ 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, int forceDeleteNormalFile);
|
ssize_t fsize);
|
||||||
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, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
|
int openFileForFlash(char *mess, 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);
|
||||||
|
@ -281,7 +281,6 @@ 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
|
||||||
@ -309,16 +308,9 @@ 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);
|
||||||
@ -348,12 +340,9 @@ 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
|
||||||
#ifdef MYTHEN3D
|
|
||||||
void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck);
|
|
||||||
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);
|
void setDAC(enum DACINDEX ind, int val, int mV);
|
||||||
|
#ifdef MYTHEN3D
|
||||||
|
void setGeneralDAC(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();
|
||||||
@ -402,13 +391,9 @@ void setTiming(enum timingMode arg);
|
|||||||
enum timingMode getTiming();
|
enum timingMode getTiming();
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
void setInitialExtSignals();
|
void setInitialExtSignals();
|
||||||
int setChipStatusRegister(int csr);
|
|
||||||
int setGainCaps(int caps);
|
int setGainCaps(int caps);
|
||||||
int setInterpolation(int enable);
|
int getGainCaps();
|
||||||
int setPumpProbe(int enable);
|
int setChipStatusRegister(int csr);
|
||||||
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)
|
||||||
@ -569,7 +554,6 @@ 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
|
||||||
@ -674,6 +658,9 @@ 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,6 +132,7 @@ 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);
|
||||||
@ -284,8 +285,7 @@ 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);
|
||||||
@ -293,14 +293,3 @@ int get_update_mode(int);
|
|||||||
int set_update_mode(int);
|
int set_update_mode(int);
|
||||||
int get_top(int);
|
int get_top(int);
|
||||||
int set_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,10 +50,6 @@ 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);
|
||||||
@ -64,14 +60,10 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
|||||||
}
|
}
|
||||||
path[len] = '\0';
|
path[len] = '\0';
|
||||||
|
|
||||||
// get dir path and attach file name
|
// get dir path and attach config file name
|
||||||
char *dir = dirname(path);
|
char *dir = dirname(path);
|
||||||
memset(buf, 0, bufSize);
|
memset(buf, 0, bufSize);
|
||||||
if (!strcmp(dir, "/")) {
|
|
||||||
sprintf(buf, "/%s", fname);
|
|
||||||
} else {
|
|
||||||
sprintf(buf, "%s/%s", dir, fname);
|
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;
|
||||||
}
|
}
|
||||||
@ -474,7 +466,7 @@ int setupDetectorServer(char *mess, char *sname) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSymbolic link created %s -> %s\n", linkname, sname));
|
LOG(logINFO, ("\tSymbolic link created\n"));
|
||||||
|
|
||||||
// blackfin boards (respawn) (only kept for backwards compatibility)
|
// blackfin boards (respawn) (only kept for backwards compatibility)
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
@ -493,7 +485,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");
|
||||||
@ -678,26 +670,3 @@ 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,139 +406,66 @@ 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. "
|
||||||
@ -551,22 +478,24 @@ 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 -1;
|
return 0;
|
||||||
}
|
}
|
||||||
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,7 +7,6 @@
|
|||||||
#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
|
||||||
|
|
||||||
@ -19,11 +18,8 @@
|
|||||||
#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"
|
||||||
@ -32,11 +28,8 @@
|
|||||||
#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"
|
||||||
// nCE
|
#define CMD_GPIO3_DONT_TOUCH_FLASH "echo 0 > /sys/class/gpio/gpio3/value"
|
||||||
#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"
|
||||||
@ -45,9 +38,6 @@
|
|||||||
|
|
||||||
#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
|
||||||
|
|
||||||
@ -75,7 +65,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 gpio3 (nCE). Update kernel to "
|
("Kernel too old to use gpio 3 pins. 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 {
|
||||||
@ -88,35 +78,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 (CD) for fpga (%s)\n", retvals);
|
"Could not define gpio7 pins for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio7 (CD): defined\n"));
|
LOG(logINFO, ("\tgpio7: defined\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("\tgpio7 (CD): already defined\n"));
|
LOG(logINFO, ("\tgpio7: 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 (CD) as input for fpga (%s)\n", retvals);
|
"Could not set gpio7 as input for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio7 (CD): setting intput\n"));
|
LOG(logINFO, ("\tgpio7: 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 (nConfig) for fpga (%s)\n", retvals);
|
"Could not define gpio9 pins for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9 (nConfig): defined\n"));
|
LOG(logINFO, ("\tgpio9: defined\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("\tgpio9 (nConfig): already defined\n"));
|
LOG(logINFO, ("\tgpio9: already defined\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// define gpio3 (not chip enable)
|
// define gpio3 (not chip enable)
|
||||||
@ -124,21 +114,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 (nCE) for fpga (%s)\n",
|
"Could not define gpio3 pins for fpga (%s)\n",
|
||||||
retvals);
|
retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3 (nCE): defined\n"));
|
LOG(logINFO, ("\tgpio3: defined\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("\tgpio3 (nCE): already defined\n"));
|
LOG(logINFO, ("\tgpio3: already defined\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FPGAdontTouchFlash(char *mess, int programming) {
|
int FPGAdontTouchFlash(char *mess) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
@ -146,51 +136,51 @@ int FPGAdontTouchFlash(char *mess, int programming) {
|
|||||||
// 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 (nConfig) as output for fpga (%s)\n", retvals);
|
"Could not set gpio9 as output for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9 (nConfig): setting output\n"));
|
LOG(logINFO, ("\tgpio9: setting output\n"));
|
||||||
|
|
||||||
// define gpio3 as output
|
// define gpio3 as output
|
||||||
if (programming && latestKernelVerified == 1) {
|
if (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 (nCE) as output for fpga (%s)\n", retvals);
|
"Could not set gpio3 as output for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3 (nCE): setting output\n"));
|
LOG(logINFO, ("\tgpio3: 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 (nConfig) to not touch flash for fpga (%s)\n",
|
"Could not set gpio9 to not touch flash for fpga (%s)\n",
|
||||||
retvals);
|
retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9 (nConfig): fpga dont touch flash (Low)\n"));
|
LOG(logINFO, ("\tgpio9: fpga dont touch flash\n"));
|
||||||
|
|
||||||
// tell FPGA to not: gpio3
|
// tell FPGA to not: gpio3
|
||||||
if (programming && latestKernelVerified == 1) {
|
if (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 (nCE) to not touch flash for fpga (%s)\n",
|
"Could not set gpio3 to not touch flash for fpga (%s)\n",
|
||||||
retvals);
|
retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3 (nCE): fpga dont touch flash (High)\n"));
|
LOG(logINFO, ("\tgpio3: fpga dont touch flash\n"));
|
||||||
}
|
}
|
||||||
// usleep(100*1000);
|
// usleep(100*1000);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FPGATouchFlash(char *mess, int programming) {
|
int FPGATouchFlash(char *mess) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
@ -198,20 +188,20 @@ int FPGATouchFlash(char *mess, int programming) {
|
|||||||
// 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 (nConfig) as input for fpga (%s)\n", retvals);
|
"Could not set gpio9 as input for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio9 (nConfig): setting input\n"));
|
LOG(logINFO, ("\tgpio9: setting input\n"));
|
||||||
|
|
||||||
if (programming && latestKernelVerified == 1) {
|
if (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 (nCE) as input for fpga (%s)\n", retvals);
|
"Could not set gpio3 as input for fpga (%s)\n", retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tgpio3 (nCE): setting input\n"));
|
LOG(logINFO, ("\tgpio3: setting input\n"));
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -221,10 +211,10 @@ int resetFPGA(char *mess) {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
if (FPGAdontTouchFlash(mess, 0) == FAIL) {
|
if (FPGAdontTouchFlash(mess) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (FPGATouchFlash(mess, 0) == FAIL) {
|
if (FPGATouchFlash(mess) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||||
@ -284,8 +274,7 @@ 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 "
|
"update the Amd flash/ root directory. Most likely, blackfin needs rescue or replacement. Please contact us.\n",
|
||||||
"needs rescue or replacement. Please contact us.\n",
|
|
||||||
functionType, retvals);
|
functionType, retvals);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -330,7 +319,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, int forceDeleteNormalFile) {
|
ssize_t fsize) {
|
||||||
|
|
||||||
memset(messageType, 0, sizeof(messageType));
|
memset(messageType, 0, sizeof(messageType));
|
||||||
strcpy(messageType, functionType);
|
strcpy(messageType, functionType);
|
||||||
@ -341,13 +330,12 @@ int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
|
|||||||
|
|
||||||
FILE *flashfd = NULL;
|
FILE *flashfd = NULL;
|
||||||
FILE *srcfd = NULL;
|
FILE *srcfd = NULL;
|
||||||
if (openFileForFlash(mess, index, &flashfd, &srcfd, forceDeleteNormalFile) ==
|
if (openFileForFlash(mess, &flashfd, &srcfd) == FAIL) {
|
||||||
FAIL) {
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == PROGRAM_FPGA) {
|
if (index == PROGRAM_FPGA) {
|
||||||
if (FPGAdontTouchFlash(mess, 1) == FAIL) {
|
if (FPGAdontTouchFlash(mess) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -446,8 +434,7 @@ int getDrive(char *mess, enum PROGRAM_INDEX index) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
|
int openFileForFlash(char *mess, 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) {
|
||||||
@ -460,11 +447,6 @@ int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE
|
|||||||
}
|
}
|
||||||
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) {
|
||||||
@ -480,95 +462,6 @@ int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE
|
|||||||
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"));
|
||||||
|
|
||||||
@ -671,14 +564,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, 1) == FAIL) {
|
if (FPGATouchFlash(mess) == 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\t[gpio7 (CD) should be High when done]\n"));
|
LOG(logINFO, ("\tWaiting for FPGA to program from flash\n"));
|
||||||
int timeSpent = 0;
|
int timeSpent = 0;
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@ -716,8 +609,8 @@ int waitForFPGAtoTouchFlash(char *mess) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("gpi07 (CD)returned %d\n", result));
|
LOG(logDEBUG1, ("gpi07 returned %d\n", result));
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tFPGA has picked up the program from flash. gpio7 (CD) is High\n"));
|
LOG(logINFO, ("\tFPGA has picked up the program from flash\n"));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
|
|
||||||
@ -147,30 +146,6 @@ 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,
|
||||||
|
@ -39,7 +39,6 @@ extern int masterCommandLine;
|
|||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
extern int topCommandLine;
|
extern int topCommandLine;
|
||||||
#endif
|
#endif
|
||||||
int portno = DEFAULT_PORTNO;
|
|
||||||
|
|
||||||
void error(char *msg) { perror(msg); }
|
void error(char *msg) { perror(msg); }
|
||||||
|
|
||||||
@ -51,6 +50,7 @@ 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;
|
||||||
|
@ -62,8 +62,8 @@ int firstUDPDestination = 0;
|
|||||||
|
|
||||||
int configured = FAIL;
|
int configured = FAIL;
|
||||||
char configureMessage[MAX_STR_LENGTH] = "udp parameters not configured yet";
|
char configureMessage[MAX_STR_LENGTH] = "udp parameters not configured yet";
|
||||||
int maxYMods = -1;
|
int maxydet = -1;
|
||||||
int moduleIndex = -1;
|
int detectorId = -1;
|
||||||
|
|
||||||
// Local variables
|
// Local variables
|
||||||
int (*flist[NUM_DET_FUNCTIONS])(int);
|
int (*flist[NUM_DET_FUNCTIONS])(int);
|
||||||
@ -81,14 +81,28 @@ char scanErrMessage[MAX_STR_LENGTH] = "";
|
|||||||
/* initialization functions */
|
/* initialization functions */
|
||||||
|
|
||||||
int updateModeAllowedFunction(int file_des) {
|
int updateModeAllowedFunction(int file_des) {
|
||||||
enum detFuncs allowedFuncs[] = {
|
enum detFuncs allowedFuncs[] = {F_EXEC_COMMAND,
|
||||||
F_EXEC_COMMAND, F_GET_DETECTOR_TYPE, F_GET_FIRMWARE_VERSION,
|
F_GET_DETECTOR_TYPE,
|
||||||
F_GET_SERVER_VERSION, F_GET_SERIAL_NUMBER, F_WRITE_REGISTER,
|
F_GET_FIRMWARE_VERSION,
|
||||||
F_READ_REGISTER, F_LOCK_SERVER, F_GET_LAST_CLIENT_IP,
|
F_GET_SERVER_VERSION,
|
||||||
F_PROGRAM_FPGA, F_RESET_FPGA, F_CHECK_VERSION,
|
F_GET_SERIAL_NUMBER,
|
||||||
F_REBOOT_CONTROLLER, F_GET_KERNEL_VERSION, F_UPDATE_KERNEL,
|
F_WRITE_REGISTER,
|
||||||
F_UPDATE_DETECTOR_SERVER, F_GET_UPDATE_MODE, F_SET_UPDATE_MODE,
|
F_READ_REGISTER,
|
||||||
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE};
|
F_LOCK_SERVER,
|
||||||
|
F_GET_LAST_CLIENT_IP,
|
||||||
|
F_PROGRAM_FPGA,
|
||||||
|
F_RESET_FPGA,
|
||||||
|
F_CHECK_VERSION,
|
||||||
|
F_COPY_DET_SERVER,
|
||||||
|
F_REBOOT_CONTROLLER,
|
||||||
|
F_GET_KERNEL_VERSION,
|
||||||
|
F_UPDATE_KERNEL,
|
||||||
|
F_UPDATE_DETECTOR_SERVER,
|
||||||
|
F_GET_UPDATE_MODE,
|
||||||
|
F_SET_UPDATE_MODE,
|
||||||
|
F_GET_NUM_CHANNELS,
|
||||||
|
F_GET_NUM_INTERFACES,
|
||||||
|
F_ACTIVATE};
|
||||||
size_t allowedFuncsSize = sizeof(allowedFuncs) / sizeof(enum detFuncs);
|
size_t allowedFuncsSize = sizeof(allowedFuncs) / sizeof(enum detFuncs);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < allowedFuncsSize; ++i) {
|
for (unsigned int i = 0; i < allowedFuncsSize; ++i) {
|
||||||
@ -116,7 +130,6 @@ void init_detector() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
LOG(logINFO, ("This is a VIRTUAL detector\n"));
|
LOG(logINFO, ("This is a VIRTUAL detector\n"));
|
||||||
udpDetails[0].srcip = LOCALHOSTIP_INT;
|
udpDetails[0].srcip = LOCALHOSTIP_INT;
|
||||||
udpDetails[0].srcip2 = LOCALHOSTIP_INT;
|
|
||||||
#endif
|
#endif
|
||||||
udpDetails[0].srcport = DEFAULT_UDP_SRC_PORTNO;
|
udpDetails[0].srcport = DEFAULT_UDP_SRC_PORTNO;
|
||||||
udpDetails[0].dstport = DEFAULT_UDP_DST_PORTNO;
|
udpDetails[0].dstport = DEFAULT_UDP_DST_PORTNO;
|
||||||
@ -309,6 +322,7 @@ void function_table() {
|
|||||||
flist[F_SOFTWARE_TRIGGER] = &software_trigger;
|
flist[F_SOFTWARE_TRIGGER] = &software_trigger;
|
||||||
flist[F_LED] = &led;
|
flist[F_LED] = &led;
|
||||||
flist[F_DIGITAL_IO_DELAY] = &digital_io_delay;
|
flist[F_DIGITAL_IO_DELAY] = &digital_io_delay;
|
||||||
|
flist[F_COPY_DET_SERVER] = ©_detector_server;
|
||||||
flist[F_REBOOT_CONTROLLER] = &reboot_controller;
|
flist[F_REBOOT_CONTROLLER] = &reboot_controller;
|
||||||
flist[F_SET_ADC_ENABLE_MASK] = &set_adc_enable_mask;
|
flist[F_SET_ADC_ENABLE_MASK] = &set_adc_enable_mask;
|
||||||
flist[F_GET_ADC_ENABLE_MASK] = &get_adc_enable_mask;
|
flist[F_GET_ADC_ENABLE_MASK] = &get_adc_enable_mask;
|
||||||
@ -458,17 +472,6 @@ void function_table() {
|
|||||||
flist[F_SET_MASTER] = &set_master;
|
flist[F_SET_MASTER] = &set_master;
|
||||||
flist[F_GET_TOP] = &get_top;
|
flist[F_GET_TOP] = &get_top;
|
||||||
flist[F_SET_TOP] = &set_top;
|
flist[F_SET_TOP] = &set_top;
|
||||||
flist[F_GET_POLARITY] = &get_polarity;
|
|
||||||
flist[F_SET_POLARITY] = &set_polarity;
|
|
||||||
flist[F_GET_INTERPOLATION] = &get_interpolation;
|
|
||||||
flist[F_SET_INTERPOLATION] = &set_interpolation;
|
|
||||||
flist[F_GET_PUMP_PROBE] = &get_pump_probe;
|
|
||||||
flist[F_SET_PUMP_PROBE] = &set_pump_probe;
|
|
||||||
flist[F_GET_ANALOG_PULSING] = &get_analog_pulsing;
|
|
||||||
flist[F_SET_ANALOG_PULSING] = &set_analog_pulsing;
|
|
||||||
flist[F_GET_DIGITAL_PULSING] = &get_digital_pulsing;
|
|
||||||
flist[F_SET_DIGITAL_PULSING] = &set_digital_pulsing;
|
|
||||||
flist[F_GET_MODULE] = &get_module;
|
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -1288,12 +1291,7 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
|
||||||
// ignore counter enable to force vth dac values
|
|
||||||
setDAC(serverDacIndex, val, mV, 0);
|
|
||||||
#else
|
|
||||||
setDAC(serverDacIndex, val, mV);
|
setDAC(serverDacIndex, val, mV);
|
||||||
#endif
|
|
||||||
retval = getDAC(serverDacIndex, mV);
|
retval = getDAC(serverDacIndex, mV);
|
||||||
}
|
}
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -1561,71 +1559,6 @@ int read_register(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_module(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
|
|
||||||
sls_detector_module module;
|
|
||||||
int *myDac = NULL;
|
|
||||||
int *myChan = NULL;
|
|
||||||
module.dacs = NULL;
|
|
||||||
module.chanregs = NULL;
|
|
||||||
|
|
||||||
#if !defined(MYTHEN3D) && !defined(EIGERD)
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
|
|
||||||
// allocate to receive module structure
|
|
||||||
// allocate dacs
|
|
||||||
myDac = malloc(getNumberOfDACs() * sizeof(int));
|
|
||||||
// error
|
|
||||||
if (getNumberOfDACs() > 0 && myDac == NULL) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not allocate dacs\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else
|
|
||||||
module.dacs = myDac;
|
|
||||||
|
|
||||||
// allocate chans
|
|
||||||
if (ret == OK) {
|
|
||||||
myChan = malloc(getTotalNumberOfChannels() * sizeof(int));
|
|
||||||
if (getTotalNumberOfChannels() > 0 && myChan == NULL) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not allocate chans\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else
|
|
||||||
module.chanregs = myChan;
|
|
||||||
}
|
|
||||||
|
|
||||||
// receive module structure
|
|
||||||
if (ret == OK) {
|
|
||||||
module.nchip = getNumberOfChips();
|
|
||||||
module.nchan = getTotalNumberOfChannels();
|
|
||||||
module.ndac = getNumberOfDACs();
|
|
||||||
|
|
||||||
// ensure nchan is not 0, else trimbits not copied
|
|
||||||
if (module.nchan == 0) {
|
|
||||||
strcpy(mess, "Could not get module as the number of channels to copy is 0\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
getModule(&module);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
if (ret != FAIL) {
|
|
||||||
if (sendModule(file_des, &module) < 0) {
|
|
||||||
ret = FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (myChan != NULL)
|
|
||||||
free(myChan);
|
|
||||||
if (myDac != NULL)
|
|
||||||
free(myDac);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int set_module(int file_des) {
|
int set_module(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
@ -1702,9 +1635,7 @@ int set_module(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
LOG(logDEBUG1, ("Settings: %d\n", retval));
|
LOG(logDEBUG1, ("Settings: %d\n", retval));
|
||||||
}
|
}
|
||||||
if (myChan != NULL)
|
|
||||||
free(myChan);
|
free(myChan);
|
||||||
if (myDac != NULL)
|
|
||||||
free(myDac);
|
free(myDac);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2118,7 +2049,7 @@ int set_num_frames(int file_des) {
|
|||||||
arg > MAX_FRAMES_IN_BURST_MODE) {
|
arg > MAX_FRAMES_IN_BURST_MODE) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set number of frames %lld. Must be less than equal to %d in "
|
"Could not set number of frames %lld. Must be <= %d in "
|
||||||
"burst mode.\n",
|
"burst mode.\n",
|
||||||
(long long unsigned int)arg, MAX_FRAMES_IN_BURST_MODE);
|
(long long unsigned int)arg, MAX_FRAMES_IN_BURST_MODE);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
@ -2936,12 +2867,7 @@ int set_roi(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
if (receiveData(file_des, &arg.xmax, sizeof(int), INT32) < 0)
|
if (receiveData(file_des, &arg.xmax, sizeof(int), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
if (receiveData(file_des, &arg.ymin, sizeof(int), INT32) < 0)
|
LOG(logDEBUG1, ("Set ROI: [%d, %d]\n", arg.xmin, arg.xmax));
|
||||||
return printSocketReadError();
|
|
||||||
if (receiveData(file_des, &arg.ymax, sizeof(int), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logDEBUG1, ("Set ROI: [%d, %d, %d, %d]\n", arg.xmin, arg.xmax, arg.ymin,
|
|
||||||
arg.ymax));
|
|
||||||
|
|
||||||
#ifndef GOTTHARDD
|
#ifndef GOTTHARDD
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
@ -2973,16 +2899,13 @@ int get_roi(int file_des) {
|
|||||||
#else
|
#else
|
||||||
// only get
|
// only get
|
||||||
retval = getROI();
|
retval = getROI();
|
||||||
LOG(logDEBUG1, ("nRois: (%d, %d, %d, %d)\n", retval.xmin, retval.xmax,
|
LOG(logDEBUG1, ("nRois: (%d, %d)\n", retval.xmin, retval.xmax));
|
||||||
retval.ymin, retval.ymax));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Server_SendResult(file_des, INT32, NULL, 0);
|
Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
if (ret != FAIL) {
|
if (ret != FAIL) {
|
||||||
sendData(file_des, &retval.xmin, sizeof(int), INT32);
|
sendData(file_des, &retval.xmin, sizeof(int), INT32);
|
||||||
sendData(file_des, &retval.xmax, sizeof(int), INT32);
|
sendData(file_des, &retval.xmax, sizeof(int), INT32);
|
||||||
sendData(file_des, &retval.ymin, sizeof(int), INT32);
|
|
||||||
sendData(file_des, &retval.ymax, sizeof(int), INT32);
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -4080,8 +4003,7 @@ int check_version(int file_des) {
|
|||||||
usleep(3 * 1000 * 1000);
|
usleep(3 * 1000 * 1000);
|
||||||
if (!isInitCheckDone()) {
|
if (!isInitCheckDone()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Server Initialization still not done done in server. "
|
strcpy(mess, "Server Initialization still not done done in server. Unexpected.\n");
|
||||||
"Unexpected.\n");
|
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4220,15 +4142,65 @@ int digital_io_delay(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int copy_detector_server(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
char args[2][MAX_STR_LENGTH];
|
||||||
|
char retvals[MAX_STR_LENGTH] = {0};
|
||||||
|
|
||||||
|
memset(args, 0, sizeof(args));
|
||||||
|
memset(retvals, 0, sizeof(retvals));
|
||||||
|
|
||||||
|
if (receiveData(file_des, args, sizeof(args), OTHER) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
char *sname = args[0];
|
||||||
|
char *hostname = args[1];
|
||||||
|
LOG(logINFOBLUE, ("Copying server %s from host %s\n", sname, hostname));
|
||||||
|
char cmd[MAX_STR_LENGTH] = {0};
|
||||||
|
|
||||||
|
#ifdef BLACKFIN_DEFINED
|
||||||
|
// check update is allowed (Non Amd OR AMD + current kernel)
|
||||||
|
ret = allowUpdate(mess, "copy detector server");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// tftp server
|
||||||
|
if (ret == OK) {
|
||||||
|
if (snprintf(cmd, MAX_STR_LENGTH, "tftp %s -r %s -g", hostname,
|
||||||
|
sname) >= MAX_STR_LENGTH) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not copy detector server. Command to copy "
|
||||||
|
"server too long\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
|
"Could not copy detector server (tftp). %s\n",
|
||||||
|
retvals);
|
||||||
|
// LOG(logERROR, (mess)); already printed in executecommand
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("\tServer copied\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == OK) {
|
||||||
|
ret = setupDetectorServer(mess, sname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, OTHER, retvals, sizeof(retvals));
|
||||||
|
}
|
||||||
|
|
||||||
int reboot_controller(int file_des) {
|
int reboot_controller(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
#ifdef EIGERD
|
|
||||||
functionNotImplemented();
|
|
||||||
#elif VIRTUAL
|
|
||||||
ret = GOODBYE;
|
|
||||||
#elif defined(MYTHEN3D) || defined(GOTTHARD2D)
|
|
||||||
if (getHardwareVersionNumber() == 0) {
|
if (getHardwareVersionNumber() == 0) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Old board version, reboot by yourself please!\n");
|
strcpy(mess, "Old board version, reboot by yourself please!\n");
|
||||||
@ -4236,11 +4208,20 @@ int reboot_controller(int file_des) {
|
|||||||
Server_SendResult(file_des, INT32, NULL, 0);
|
Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
return GOODBYE;
|
return GOODBYE;
|
||||||
}
|
}
|
||||||
ret = REBOOT;
|
#ifdef VIRTUAL
|
||||||
|
ret = GOODBYE;
|
||||||
#else
|
#else
|
||||||
ret = REBOOT;
|
ret = REBOOT;
|
||||||
#endif
|
#endif
|
||||||
|
#elif EIGERD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
ret = GOODBYE;
|
||||||
|
#else
|
||||||
|
ret = REBOOT;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Server_SendResult(file_des, INT32, NULL, 0);
|
Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -4769,7 +4750,7 @@ int get_read_n_rows(int file_des) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void calculate_and_set_position() {
|
void calculate_and_set_position() {
|
||||||
if (maxYMods == -1 || moduleIndex == -1) {
|
if (maxydet == -1 || detectorId == -1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set detector position (did not get multi size).\n");
|
"Could not set detector position (did not get multi size).\n");
|
||||||
@ -4778,20 +4759,21 @@ void calculate_and_set_position() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculating new position
|
// calculating new position
|
||||||
int pos[2] = {0, 0};
|
int modulePorts[2] = {1, 1};
|
||||||
|
|
||||||
int portGeometry[2] = {1, 1};
|
|
||||||
// position does change for eiger and jungfrau (2 interfaces)
|
// position does change for eiger and jungfrau (2 interfaces)
|
||||||
#if defined(EIGERD)
|
#if defined(EIGERD)
|
||||||
portGeometry[X] = getNumberofUDPInterfaces(); // horz
|
modulePorts[1] = getNumberofUDPInterfaces(); // horz
|
||||||
#elif defined(JUNGFRAUD)
|
#elif defined(JUNGFRAUD)
|
||||||
portGeometry[Y] = getNumberofUDPInterfaces(); // vert
|
modulePorts[0] = getNumberofUDPInterfaces(); // vert
|
||||||
#endif
|
#endif
|
||||||
LOG(logDEBUG1, ("moduleIndex:%d maxymods:%d portGeo.x:%d portgeo.y:%d\n",
|
int maxy = maxydet * modulePorts[0];
|
||||||
moduleIndex, maxYMods, portGeometry[X], portGeometry[Y]));
|
int pos[2] = {0, 0};
|
||||||
pos[Y] = (moduleIndex % maxYMods) * portGeometry[Y];
|
// row
|
||||||
pos[X] = (moduleIndex / maxYMods) * portGeometry[X];
|
pos[0] = (detectorId % maxy);
|
||||||
LOG(logINFO, ("Setting Positions (%d,%d) #(col, row)\n", pos[X], pos[Y]));
|
// col for horiz. udp ports
|
||||||
|
pos[1] = (detectorId / maxy) * modulePorts[1];
|
||||||
|
|
||||||
|
LOG(logDEBUG, ("Setting Positions (%d,%d)\n", pos[0], pos[1]));
|
||||||
if (setDetectorPosition(pos) == FAIL) {
|
if (setDetectorPosition(pos) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set detector position.\n");
|
sprintf(mess, "Could not set detector position.\n");
|
||||||
@ -4803,8 +4785,8 @@ void calculate_and_set_position() {
|
|||||||
if (udpDetails[0].srcmac == 0) {
|
if (udpDetails[0].srcmac == 0) {
|
||||||
char dmac[MAC_ADDRESS_SIZE];
|
char dmac[MAC_ADDRESS_SIZE];
|
||||||
memset(dmac, 0, MAC_ADDRESS_SIZE);
|
memset(dmac, 0, MAC_ADDRESS_SIZE);
|
||||||
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[X] & 0xFF,
|
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[0] & 0xFF,
|
||||||
pos[Y] & 0xFF);
|
pos[1] & 0xFF);
|
||||||
LOG(logINFO, ("Udp source mac address created: %s\n", dmac));
|
LOG(logINFO, ("Udp source mac address created: %s\n", dmac));
|
||||||
unsigned char a[6];
|
unsigned char a[6];
|
||||||
sscanf(dmac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2],
|
sscanf(dmac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2],
|
||||||
@ -4823,8 +4805,8 @@ void calculate_and_set_position() {
|
|||||||
if (udpDetails[0].srcmac2 == 0) {
|
if (udpDetails[0].srcmac2 == 0) {
|
||||||
char dmac2[MAC_ADDRESS_SIZE];
|
char dmac2[MAC_ADDRESS_SIZE];
|
||||||
memset(dmac2, 0, MAC_ADDRESS_SIZE);
|
memset(dmac2, 0, MAC_ADDRESS_SIZE);
|
||||||
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[X] + 1) & 0xFF,
|
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[0] + 1) & 0xFF,
|
||||||
pos[Y] & 0xFF);
|
pos[1] & 0xFF);
|
||||||
LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2));
|
LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2));
|
||||||
unsigned char a[6];
|
unsigned char a[6];
|
||||||
sscanf(dmac2, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1],
|
sscanf(dmac2, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1],
|
||||||
@ -4852,16 +4834,15 @@ int set_detector_position(int file_des) {
|
|||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logDEBUG, ("Setting detector positions: [maxy:%u, modIndex:%u]\n",
|
LOG(logINFO, ("Setting detector positions: [%u, %u]\n", args[0], args[1]));
|
||||||
args[0], args[1]));
|
|
||||||
|
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
// if in update mode, there is no need to do this (also detector not set
|
// if in update mode, there is no need to do this (also detector not set
|
||||||
// up)
|
// up)
|
||||||
if (!updateFlag && check_detector_idle("configure mac") == OK) {
|
if (!updateFlag && check_detector_idle("configure mac") == OK) {
|
||||||
maxYMods = args[0];
|
maxydet = args[0];
|
||||||
moduleIndex = args[1];
|
detectorId = args[1];
|
||||||
calculate_and_set_position();
|
calculate_and_set_position();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7215,8 +7196,6 @@ int get_receiver_parameters(int file_des) {
|
|||||||
#else
|
#else
|
||||||
roi.xmin = -1;
|
roi.xmin = -1;
|
||||||
roi.xmax = -1;
|
roi.xmax = -1;
|
||||||
roi.ymin = -1;
|
|
||||||
roi.ymax = -1;
|
|
||||||
#endif
|
#endif
|
||||||
n += sendData(file_des, &roi.xmin, sizeof(int), INT32);
|
n += sendData(file_des, &roi.xmin, sizeof(int), INT32);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
@ -7224,12 +7203,6 @@ int get_receiver_parameters(int file_des) {
|
|||||||
n += sendData(file_des, &roi.xmax, sizeof(int), INT32);
|
n += sendData(file_des, &roi.xmax, sizeof(int), INT32);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
n += sendData(file_des, &roi.ymin, sizeof(int), INT32);
|
|
||||||
if (n < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
n += sendData(file_des, &roi.ymax, sizeof(int), INT32);
|
|
||||||
if (n < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// counter mask
|
// counter mask
|
||||||
@ -8323,35 +8296,33 @@ int set_gain_caps(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logDEBUG1, ("Setting gain caps to: %u\n", arg));
|
LOG(logDEBUG1, ("Setting gain caps to: %u\n", arg));
|
||||||
|
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
#ifndef MYTHEN3D
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
ret = setGainCaps(arg);
|
setGainCaps(arg);
|
||||||
if (ret == FAIL) {
|
retval = getChipStatusRegister(); // TODO! fix
|
||||||
strcpy(mess, "Could not set gain caps.\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
int retval = getGainCaps();
|
|
||||||
validate(&ret, mess, (int)arg, (int)retval, "set gain caps", DEC);
|
|
||||||
LOG(logDEBUG1, ("gain caps retval: %u\n", retval));
|
LOG(logDEBUG1, ("gain caps retval: %u\n", retval));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_gain_caps(int file_des) {
|
int get_gain_caps(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
LOG(logDEBUG1, ("Getting gain caps\n"));
|
LOG(logINFO, ("Getting gain caps\n"));
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
#ifndef MYTHEN3D
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
retval = getGainCaps();
|
retval = getGainCaps();
|
||||||
LOG(logDEBUG1, ("Gain caps: %u\n", retval));
|
LOG(logDEBUG1, ("Gain caps: %u\n", retval));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
@ -9489,23 +9460,6 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
|
|||||||
LOG(logINFO, ("\tServer Name: %s\n", serverName));
|
LOG(logINFO, ("\tServer Name: %s\n", serverName));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(GOTTHARD2D) && !defined(MYTHEN3D) && !defined(EIGERD)
|
|
||||||
int forceDeleteNormalFile = 0;
|
|
||||||
if (receiveData(file_des, &forceDeleteNormalFile,
|
|
||||||
sizeof(forceDeleteNormalFile), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logINFO, ("\tForce Delete Normal File flag? %s\n",
|
|
||||||
(forceDeleteNormalFile ? "Y" : "N")));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ensure the name is not the same as the linked name
|
|
||||||
if (!strcmp(serverName, LINKED_SERVER_NAME)) {
|
|
||||||
ret = FAIL;
|
|
||||||
strcpy(mess, "Server name is the same as the symbolic link. Please "
|
|
||||||
"use a different server name\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
|
|
||||||
// in same folder as current process (will also work for virtual then
|
// in same folder as current process (will also work for virtual then
|
||||||
// with write permissions)
|
// with write permissions)
|
||||||
{
|
{
|
||||||
@ -9530,8 +9484,7 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
|
|||||||
checksum, serverName);
|
checksum, serverName);
|
||||||
#else
|
#else
|
||||||
receive_program_via_blackfin(file_des, index, functionType,
|
receive_program_via_blackfin(file_des, index, functionType,
|
||||||
filesize, checksum, serverName,
|
filesize, checksum, serverName);
|
||||||
forceDeleteNormalFile);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9547,8 +9500,7 @@ 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) {
|
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && \
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && \
|
||||||
!defined(GOTTHARDD)
|
!defined(GOTTHARDD)
|
||||||
@ -9647,11 +9599,9 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
|
|||||||
case PROGRAM_FPGA:
|
case PROGRAM_FPGA:
|
||||||
case PROGRAM_KERNEL:
|
case PROGRAM_KERNEL:
|
||||||
ret = eraseAndWriteToFlash(mess, index, functionType, checksum,
|
ret = eraseAndWriteToFlash(mess, index, functionType, checksum,
|
||||||
totalsize, forceDeleteNormalFile);
|
totalsize);
|
||||||
break;
|
break;
|
||||||
case PROGRAM_SERVER:
|
case PROGRAM_SERVER:
|
||||||
// a fail here is not a show stopper (just for memory)
|
|
||||||
deleteOldServers(mess, serverName, "update detector server");
|
|
||||||
ret = moveBinaryFile(mess, serverName, TEMP_PROG_FILE_NAME,
|
ret = moveBinaryFile(mess, serverName, TEMP_PROG_FILE_NAME,
|
||||||
"update detector server");
|
"update detector server");
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
@ -9852,16 +9802,12 @@ int set_top(int file_des) {
|
|||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
if (arg != 0 && arg != 1) {
|
if (arg != 0 && arg != 1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(
|
sprintf(mess, "Could not set top mode. Invalid value: %d. Must be 0 or 1\n", arg);
|
||||||
mess,
|
|
||||||
"Could not set top mode. Invalid value: %d. Must be 0 or 1\n",
|
|
||||||
arg);
|
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
ret = setTop(arg == 1 ? OW_TOP : OW_BOTTOM);
|
ret = setTop(arg == 1 ? OW_TOP : OW_BOTTOM);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
sprintf(mess, "Could not set %s\n",
|
sprintf(mess, "Could not set %s\n", (arg == 1 ? "Top" : "Bottom"));
|
||||||
(arg == 1 ? "Top" : "Bottom"));
|
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
@ -9879,257 +9825,3 @@ int set_top(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_polarity(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
enum polarity retval = POSITIVE;
|
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting negativepolarity\n"));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// get only
|
|
||||||
retval = getNegativePolarity() ? NEGATIVE : POSITIVE;
|
|
||||||
LOG(logDEBUG1, ("negative polarity retval: %u\n", retval));
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
|
||||||
}
|
|
||||||
|
|
||||||
int set_polarity(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
enum polarity arg = POSITIVE;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logDEBUG1, ("Setting negative polarity: %u\n", (int)arg));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
switch (arg) {
|
|
||||||
case POSITIVE:
|
|
||||||
ret = setNegativePolarity(0);
|
|
||||||
break;
|
|
||||||
case NEGATIVE:
|
|
||||||
ret = setNegativePolarity(1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
modeNotImplemented("Polarity index", (int)arg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (ret == FAIL) {
|
|
||||||
sprintf(mess, "Could not set polarity\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
enum polarity retval = getNegativePolarity() ? NEGATIVE : POSITIVE;
|
|
||||||
validate(&ret, mess, (int)arg, (int)retval, "set polarity", DEC);
|
|
||||||
LOG(logDEBUG1, ("negative polarity retval: %u\n", retval));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_interpolation(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int retval = -1;
|
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting interpolation\n"));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// get only
|
|
||||||
retval = getInterpolation();
|
|
||||||
LOG(logDEBUG1, ("interpolation retval: %u\n", retval));
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
|
||||||
}
|
|
||||||
|
|
||||||
int set_interpolation(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int arg = 0;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logINFO, ("Setting interpolation: %u\n", arg));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
if (getPumpProbe() && arg) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not set interpolation. Disable pump probe mode first.\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
ret = setInterpolation(arg);
|
|
||||||
if (ret == FAIL) {
|
|
||||||
if (arg)
|
|
||||||
sprintf(mess, "Could not set interpolation or enable all "
|
|
||||||
"counters for it.\n");
|
|
||||||
else
|
|
||||||
sprintf(mess, "Could not set interpolation\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
int retval = getInterpolation();
|
|
||||||
validate(&ret, mess, (int)arg, (int)retval, "set interpolation",
|
|
||||||
DEC);
|
|
||||||
LOG(logDEBUG1, ("interpolation retval: %u\n", retval));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_pump_probe(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int retval = -1;
|
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting pump probe\n"));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// get only
|
|
||||||
retval = getPumpProbe();
|
|
||||||
LOG(logDEBUG1, ("pump probe retval: %u\n", retval));
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
|
||||||
}
|
|
||||||
|
|
||||||
int set_pump_probe(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int arg = 0;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logINFO, ("Setting pump probe: %u\n", arg));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
if (getInterpolation() && arg) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not set pump probe mode. Disable interpolation mode first.\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
ret = setPumpProbe(arg);
|
|
||||||
if (ret == FAIL) {
|
|
||||||
sprintf(mess, "Could not set pump probe\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
int retval = getPumpProbe();
|
|
||||||
validate(&ret, mess, (int)arg, (int)retval, "set pump probe", DEC);
|
|
||||||
LOG(logDEBUG1, ("pump probe retval: %u\n", retval));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_analog_pulsing(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int retval = -1;
|
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting analog pulsing\n"));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// get only
|
|
||||||
retval = getAnalogPulsing();
|
|
||||||
LOG(logDEBUG1, ("analog pulsing retval: %u\n", retval));
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
|
||||||
}
|
|
||||||
|
|
||||||
int set_analog_pulsing(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int arg = 0;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logINFO, ("Setting analog pulsing: %u\n", arg));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
ret = setAnalogPulsing(arg);
|
|
||||||
if (ret == FAIL) {
|
|
||||||
sprintf(mess, "Could not set analog pulsing\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
int retval = getAnalogPulsing();
|
|
||||||
validate(&ret, mess, (int)arg, (int)retval, "set analog pulsing",
|
|
||||||
DEC);
|
|
||||||
LOG(logDEBUG1, ("analog pulsing retval: %u\n", retval));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_digital_pulsing(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int retval = -1;
|
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting digital pulsing\n"));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// get only
|
|
||||||
retval = getDigitalPulsing();
|
|
||||||
LOG(logDEBUG1, ("digital pulsing retval: %u\n", retval));
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
|
||||||
}
|
|
||||||
|
|
||||||
int set_digital_pulsing(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
int arg = 0;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
LOG(logINFO, ("Setting digital pulsing: %u\n", arg));
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
ret = setDigitalPulsing(arg);
|
|
||||||
if (ret == FAIL) {
|
|
||||||
sprintf(mess, "Could not set digital pulsing\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
|
||||||
int retval = getDigitalPulsing();
|
|
||||||
validate(&ret, mess, (int)arg, (int)retval, "set digital pulsing",
|
|
||||||
DEC);
|
|
||||||
LOG(logDEBUG1, ("digital pulsing retval: %u\n", retval));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
|
||||||
}
|
|
@ -7,7 +7,6 @@ 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
|
||||||
@ -17,8 +16,6 @@ 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
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
class detectorData;
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
using ns = std::chrono::nanoseconds;
|
using ns = std::chrono::nanoseconds;
|
||||||
class detectorData;
|
|
||||||
class DetectorImpl;
|
class DetectorImpl;
|
||||||
class MacAddr;
|
class MacAddr;
|
||||||
class IpAddr;
|
class IpAddr;
|
||||||
@ -144,7 +144,7 @@ class Detector {
|
|||||||
defs::detectorSettings settings = defs::STANDARD,
|
defs::detectorSettings settings = defs::STANDARD,
|
||||||
bool trimbits = true, Positions pos = {});
|
bool trimbits = true, Positions pos = {});
|
||||||
|
|
||||||
/** [Mythen3] It loads trim files from settingspath. An energy of -1 will pick up values from detector */
|
/** [Mythen3] It loads trim files from settingspath */
|
||||||
void setThresholdEnergy(std::array<int, 3> threshold_ev,
|
void setThresholdEnergy(std::array<int, 3> threshold_ev,
|
||||||
defs::detectorSettings settings = defs::STANDARD,
|
defs::detectorSettings settings = defs::STANDARD,
|
||||||
bool trimbits = true, Positions pos = {});
|
bool trimbits = true, Positions pos = {});
|
||||||
@ -159,10 +159,6 @@ class Detector {
|
|||||||
* is attached. */
|
* is attached. */
|
||||||
void loadTrimbits(const std::string &fname, Positions pos = {});
|
void loadTrimbits(const std::string &fname, Positions pos = {});
|
||||||
|
|
||||||
/** [Eiger][Mythen3] If no extension specified, serial number of each module
|
|
||||||
* is attached. */
|
|
||||||
void saveTrimbits(const std::string &fname, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Eiger][Mythen3] -1 if they are all different */
|
/** [Eiger][Mythen3] -1 if they are all different */
|
||||||
Result<int> getAllTrimbits(Positions pos = {}) const;
|
Result<int> getAllTrimbits(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -596,17 +592,12 @@ class Detector {
|
|||||||
/** Options: IDLE, TRANSMITTING, RUNNING */
|
/** Options: IDLE, TRANSMITTING, RUNNING */
|
||||||
Result<defs::runStatus> getReceiverStatus(Positions pos = {}) const;
|
Result<defs::runStatus> getReceiverStatus(Positions pos = {}) const;
|
||||||
|
|
||||||
/** Gets the number of frames caught for each port in receiver. */
|
Result<int64_t> getFramesCaught(Positions pos = {}) const;
|
||||||
Result<std::vector<int64_t>> getFramesCaught(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** Gets the number of missing packets for each port in receiver. Negative
|
/** Gets the number of missing packets for each port in receiver. Negative
|
||||||
* number denotes extra packets. */
|
* number denotes extra packets. */
|
||||||
Result<std::vector<int64_t>> getNumMissingPackets(Positions pos = {}) const;
|
Result<std::vector<int64_t>> getNumMissingPackets(Positions pos = {}) const;
|
||||||
|
|
||||||
/** Gets frame index for each port in receiver. */
|
|
||||||
Result<std::vector<int64_t>>
|
|
||||||
getRxCurrentFrameIndex(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Eiger][Jungfrau][Moench][CTB] */
|
/** [Eiger][Jungfrau][Moench][CTB] */
|
||||||
Result<uint64_t> getNextFrameNumber(Positions pos = {}) const;
|
Result<uint64_t> getNextFrameNumber(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -708,48 +699,60 @@ class Detector {
|
|||||||
/**[Jungfrau] Options 0-31 (or number of udp destinations) */
|
/**[Jungfrau] Options 0-31 (or number of udp destinations) */
|
||||||
void setFirstUDPDestination(const int value, Positions pos = {});
|
void setFirstUDPDestination(const int value, Positions pos = {});
|
||||||
|
|
||||||
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
|
Result<IpAddr> getDestinationUDPIP(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/** IP of the interface in receiver that the detector sends data to */
|
/** IP of the interface in receiver that the detector sends data to */
|
||||||
void setDestinationUDPIP(const IpAddr ip, Positions pos = {});
|
void setDestinationUDPIP(const IpAddr ip, Positions pos = {},
|
||||||
|
const int rx_index = 0);
|
||||||
|
|
||||||
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
||||||
Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const;
|
Result<IpAddr> getDestinationUDPIP2(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
||||||
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {});
|
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {},
|
||||||
|
const int rx_index = 0);
|
||||||
|
|
||||||
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
|
Result<MacAddr> getDestinationUDPMAC(Positions pos = {},
|
||||||
|
const int rxIndex = 0) const;
|
||||||
|
|
||||||
/** Mac address of the receiver (destination) udp interface. Not mandatory
|
/** Mac address of the receiver (destination) udp interface. Not mandatory
|
||||||
* to set as setDestinationUDPIP (udp_dstip) retrieves it from slsReceiver
|
* to set as setDestinationUDPIP (udp_dstip) retrieves it from slsReceiver
|
||||||
* process but must be set if you use a custom receiver (not slsReceiver).
|
* process but must be set if you use a custom receiver (not slsReceiver).
|
||||||
*/
|
*/
|
||||||
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {});
|
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {},
|
||||||
|
const int rx_index = 0);
|
||||||
|
|
||||||
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
||||||
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const;
|
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/* [Jungfrau][Gotthard2] Mac address of the receiver (destination) udp
|
/* [Jungfrau][Gotthard2] Mac address of the receiver (destination) udp
|
||||||
interface 2. \n Not mandatory to set as udp_dstip2 retrieves it from
|
interface 2. \n Not mandatory to set as udp_dstip2 retrieves it from
|
||||||
slsReceiver process but must be set if you use a custom receiver (not
|
slsReceiver process but must be set if you use a custom receiver (not
|
||||||
slsReceiver). \n [Jungfrau] bottom half \n [Gotthard2] veto debugging \n
|
slsReceiver). \n [Jungfrau] bottom half \n [Gotthard2] veto debugging \n
|
||||||
*/
|
*/
|
||||||
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {});
|
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {},
|
||||||
|
const int rx_index = 0);
|
||||||
|
|
||||||
Result<int> getDestinationUDPPort(Positions pos = {}) const;
|
Result<int> getDestinationUDPPort(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/** Default is 50001. \n If module_id is -1, ports for each module is
|
/** Default is 50001. \n If module_id is -1, ports for each module is
|
||||||
* calculated (incremented by 1 if no 2nd interface) */
|
* calculated (incremented by 1 if no 2nd interface) */
|
||||||
void setDestinationUDPPort(int port, int module_id = -1);
|
void setDestinationUDPPort(int port, int module_id = -1,
|
||||||
|
const int rxIndex = 0);
|
||||||
|
|
||||||
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging */
|
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging */
|
||||||
Result<int> getDestinationUDPPort2(Positions pos = {}) const;
|
Result<int> getDestinationUDPPort2(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging \n
|
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging \n
|
||||||
* Default is 50002. \n If module_id is -1, ports for each module is
|
* Default is 50002. \n If module_id is -1, ports for each module is
|
||||||
* calculated (incremented by 1 if no 2nd interface)*/
|
* calculated (incremented by 1 if no 2nd interface)*/
|
||||||
void setDestinationUDPPort2(int port, int module_id = -1);
|
void setDestinationUDPPort2(int port, int module_id = -1,
|
||||||
|
const int rxIndex = 0);
|
||||||
|
|
||||||
/** Reconfigures Detector with UDP destination. More for debugging as the
|
/** Reconfigures Detector with UDP destination. More for debugging as the
|
||||||
* configuration is done automatically when the detector has sufficient UDP
|
* configuration is done automatically when the detector has sufficient UDP
|
||||||
@ -761,7 +764,8 @@ class Detector {
|
|||||||
* information */
|
* information */
|
||||||
void validateUDPConfiguration(Positions pos = {});
|
void validateUDPConfiguration(Positions pos = {});
|
||||||
|
|
||||||
Result<std::string> printRxConfiguration(Positions pos = {}) const;
|
Result<std::string> printRxConfiguration(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/** [Eiger][CTB][Moench][Mythen3] */
|
/** [Eiger][CTB][Moench][Mythen3] */
|
||||||
Result<bool> getTenGiga(Positions pos = {}) const;
|
Result<bool> getTenGiga(Positions pos = {}) const;
|
||||||
@ -820,7 +824,8 @@ class Detector {
|
|||||||
/** true when slsReceiver is used */
|
/** true when slsReceiver is used */
|
||||||
Result<bool> getUseReceiverFlag(Positions pos = {}) const;
|
Result<bool> getUseReceiverFlag(Positions pos = {}) const;
|
||||||
|
|
||||||
Result<std::string> getRxHostname(Positions pos = {}) const;
|
Result<std::string> getRxHostname(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets receiver hostname or IP address for each module. \n Used for TCP
|
* Sets receiver hostname or IP address for each module. \n Used for TCP
|
||||||
@ -828,20 +833,24 @@ class Detector {
|
|||||||
* Also updates receiver with detector parameters. \n Also resets any prior
|
* Also updates receiver with detector parameters. \n Also resets any prior
|
||||||
* receiver property (not on detector). \n receiver is receiver hostname or
|
* receiver property (not on detector). \n receiver is receiver hostname or
|
||||||
* IP address, can include tcp port eg. hostname:port
|
* IP address, can include tcp port eg. hostname:port
|
||||||
|
*
|
||||||
|
* rxIndex of -1 is rewritten as 0 (for backwards compatibility)
|
||||||
*/
|
*/
|
||||||
void setRxHostname(const std::string &receiver, Positions pos = {});
|
void setRxHostname(const std::string &receiver, Positions pos = {}, const int rxIndex = 0);
|
||||||
|
|
||||||
/** multiple rx hostnames. Single element will set it for all */
|
/** - single element, assumes rxIndex is 0 (for backwards compatibility).
|
||||||
void setRxHostname(const std::vector<std::string> &name);
|
* - muliple element with pos empty or -1, sets each element for each module (1:1 for backwards compatibility, rxIndex = 0)
|
||||||
|
* multiple element for specific position, each element for each RR rxr */
|
||||||
|
void setRxHostname(const std::vector<std::string> &name, Positions pos);
|
||||||
|
|
||||||
Result<int> getRxPort(Positions pos = {}) const;
|
Result<int> getRxPort(Positions pos = {}, const int rx_index = 0) const;
|
||||||
|
|
||||||
/** TCP port for client-receiver communication. \n
|
/** TCP port for client-receiver communication. \n
|
||||||
* Default is 1954. \n Must be different if multiple receivers on same pc.
|
* Default is 1954. \n Must be different if multiple receivers on same pc.
|
||||||
* \n Must be first command to set a receiver parameter to be able to
|
* \n Must be first command to set a receiver parameter to be able to
|
||||||
* communicate. \n Multi command will automatically increment port for
|
* communicate. \n Multi command will automatically increment port for
|
||||||
* individual modules.*/
|
* individual modules.*/
|
||||||
void setRxPort(int port, int module_id = -1);
|
void setRxPort(int port, int module_id = -1, const int rx_index = 0);
|
||||||
|
|
||||||
Result<int> getRxFifoDepth(Positions pos = {}) const;
|
Result<int> getRxFifoDepth(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -888,7 +897,7 @@ class Detector {
|
|||||||
void setRxLock(bool value, Positions pos = {});
|
void setRxLock(bool value, Positions pos = {});
|
||||||
|
|
||||||
/** Client IP Address that last communicated with the receiver */
|
/** Client IP Address that last communicated with the receiver */
|
||||||
Result<IpAddr> getRxLastClientIP(Positions pos = {}) const;
|
Result<sls::IpAddr> getRxLastClientIP(Positions pos = {}) const;
|
||||||
|
|
||||||
/** Get thread ids from the receiver in order of [parent, tcp, listener 0,
|
/** Get thread ids from the receiver in order of [parent, tcp, listener 0,
|
||||||
* processor 0, streamer 0, listener 1, processor 1, streamer 1, arping]. If
|
* processor 0, streamer 0, listener 1, processor 1, streamer 1, arping]. If
|
||||||
@ -903,16 +912,6 @@ class Detector {
|
|||||||
* every minute. Useful in 10G mode. */
|
* every minute. Useful in 10G mode. */
|
||||||
void setRxArping(bool value, Positions pos = {});
|
void setRxArping(bool value, Positions pos = {});
|
||||||
|
|
||||||
/** at module level */
|
|
||||||
Result<defs::ROI> getIndividualRxROIs(Positions pos) const;
|
|
||||||
|
|
||||||
defs::ROI getRxROI() const;
|
|
||||||
|
|
||||||
/** only at multi module level without gap pixels */
|
|
||||||
void setRxROI(const defs::ROI value);
|
|
||||||
|
|
||||||
void clearRxROI();
|
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/** @name File */
|
/** @name File */
|
||||||
@ -1029,13 +1028,15 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setRxZmqPort(int port, int module_id = -1);
|
void setRxZmqPort(int port, int module_id = -1);
|
||||||
|
|
||||||
Result<IpAddr> getRxZmqIP(Positions pos = {}) const;
|
Result<IpAddr> getRxZmqIP(Positions pos = {},
|
||||||
|
const int rx_index = 0) const;
|
||||||
|
|
||||||
/** Zmq Ip Address from which data is to be streamed out of the receiver. \n
|
/** Zmq Ip Address from which data is to be streamed out of the receiver. \n
|
||||||
* Also restarts receiver zmq streaming if enabled. \n Default is from
|
* Also restarts receiver zmq streaming if enabled. \n Default is from
|
||||||
* rx_hostname. \n Modified only when using an intermediate process between
|
* rx_hostname. \n Modified only when using an intermediate process between
|
||||||
* receiver. */
|
* receiver. */
|
||||||
void setRxZmqIP(const IpAddr ip, Positions pos = {});
|
void setRxZmqIP(const IpAddr ip, Positions pos = {},
|
||||||
|
const int rx_index = 0);
|
||||||
|
|
||||||
Result<int> getClientZmqPort(Positions pos = {}) const;
|
Result<int> getClientZmqPort(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -1486,36 +1487,6 @@ class Detector {
|
|||||||
|
|
||||||
Result<int> getGainCaps(Positions pos = {});
|
Result<int> getGainCaps(Positions pos = {});
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
Result<defs::polarity> getPolarity(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
void setPolarity(defs::polarity value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
Result<bool> getInterpolation(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Mythen3] interpolation mode enables all counters and disables vth3. Disabling sets back counter mask and vth3. */
|
|
||||||
void setInterpolation(bool value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
Result<bool> getPumpProbe(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Mythen3] pump probe mode only enables vth2. Disabling sets back to previous value */
|
|
||||||
void setPumpProbe(bool value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
Result<bool> getAnalogPulsing(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
void setAnalogPulsing(bool value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
Result<bool> getDigitalPulsing(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Mythen3] */
|
|
||||||
void setDigitalPulsing(bool value, Positions pos = {});
|
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/** @name CTB / Moench Specific */
|
/** @name CTB / Moench Specific */
|
||||||
@ -1657,13 +1628,6 @@ class Detector {
|
|||||||
|
|
||||||
/** [CTB] Default is enabled. */
|
/** [CTB] Default is enabled. */
|
||||||
void setLEDEnable(bool enable, Positions pos = {});
|
void setLEDEnable(bool enable, Positions pos = {});
|
||||||
|
|
||||||
void setDacNames(const std::vector<std::string> names);
|
|
||||||
|
|
||||||
std::vector<std::string> getDacNames() const;
|
|
||||||
|
|
||||||
defs::dacIndex getDacIndex(const std::string &name);
|
|
||||||
std::string getDacName(defs::dacIndex i);
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/** @name Pattern */
|
/** @name Pattern */
|
||||||
@ -1798,22 +1762,31 @@ class Detector {
|
|||||||
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
||||||
* Advanced user Function!
|
* Advanced user Function!
|
||||||
* Program firmware from command line, after which detector controller is
|
* Program firmware from command line, after which detector controller is
|
||||||
* rebooted. forceDeleteNormalFile is true, if normal file found
|
* rebooted. [Jungfrau][CTB][Moench] fname is a pof file (full path) \n
|
||||||
* in device tree, it must be deleted, a new device drive created and
|
* [Mythen3][Gotthard2] fname is an rbf file (full path)
|
||||||
* programming continued.[Jungfrau][CTB][Moench] fname is a pof file (full
|
|
||||||
* path) \n [Mythen3][Gotthard2] fname is an rbf file (full path)
|
|
||||||
*/
|
*/
|
||||||
void programFPGA(const std::string &fname, const bool forceDeleteNormalFile,
|
void programFPGA(const std::string &fname, Positions pos = {});
|
||||||
Positions pos = {});
|
|
||||||
|
|
||||||
/** [Jungfrau][CTB][Moench] Advanced user Function! */
|
/** [Jungfrau][CTB][Moench] Advanced user Function! */
|
||||||
void resetFPGA(Positions pos = {});
|
void resetFPGA(Positions pos = {});
|
||||||
|
|
||||||
|
/** [[deprecated ("Replaced by updateDetectorServer, which does not require
|
||||||
|
* tftp")]] [Jungfrau][Eiger][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
||||||
|
* Advanced user Function! \n
|
||||||
|
* Copy detector server fname from tftp folder of hostname to detector. Also
|
||||||
|
* creates a symbolic link to a shorter name (without vx.x.x). Then the
|
||||||
|
* detector controller reboots (except eiger) \n
|
||||||
|
* [Jungfrau][Gotthard][CTB][Moench] Also changes respawn server (to the
|
||||||
|
* link), which is effective after a reboot.
|
||||||
|
*/
|
||||||
|
void copyDetectorServer(const std::string &fname,
|
||||||
|
const std::string &hostname, Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau][Eiger][Ctb][Moench][Mythen3][Gotthard2] Copies detector
|
/** [Jungfrau][Eiger][Ctb][Moench][Mythen3][Gotthard2] Copies detector
|
||||||
* server via TCP (without tftp).\nMakes a symbolic link with a shorter
|
* server via TCP (without tftp).\nMakes a symbolic link with a shorter
|
||||||
* name (without vx.x.x).\nThen, detector controller reboots (except
|
* name (without vx.x.x).\nThen, detector controller reboots (except
|
||||||
* Eiger).\n[Jungfrau][Ctb][Moench] Also deletes old server binary and
|
* Eiger).\n[Jungfrau][Ctb][Moench]Also changes respawn server to the
|
||||||
* changes respawn server to the link, which is effective after a reboot.
|
* link, which is effective after a reboot.
|
||||||
*/
|
*/
|
||||||
void updateDetectorServer(const std::string &fname, Positions pos = {});
|
void updateDetectorServer(const std::string &fname, Positions pos = {});
|
||||||
|
|
||||||
@ -1828,6 +1801,19 @@ class Detector {
|
|||||||
* Function! */
|
* Function! */
|
||||||
void rebootController(Positions pos = {});
|
void rebootController(Positions pos = {});
|
||||||
|
|
||||||
|
/** [[deprecated ("Replaced by overloaded updateDetectorServer, which does
|
||||||
|
* not require tftp and has one less argument")]] Advanced user Function!\n
|
||||||
|
* [Jungfrau][Gotthard][CTB][Moench] Updates the firmware, detector server,
|
||||||
|
* make a soft link and then reboots detector controller. \n
|
||||||
|
* [Mythen3][Gotthard2] Will require a script to start up the shorter named
|
||||||
|
* server link at start up \n sname is name of detector server binary found
|
||||||
|
* on tftp folder of host pc \n hostname is name of pc to tftp from \n fname
|
||||||
|
* is programming file name with full path to it
|
||||||
|
*/
|
||||||
|
void updateFirmwareAndServer(const std::string &sname,
|
||||||
|
const std::string &hostname,
|
||||||
|
const std::string &fname, Positions pos = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advanced user Function!\n [Jungfrau][Gotthard][CTB][Moench] Updates the
|
* Advanced user Function!\n [Jungfrau][Gotthard][CTB][Moench] Updates the
|
||||||
* firmware, detector server, make a soft link and then reboots detector
|
* firmware, detector server, make a soft link and then reboots detector
|
||||||
@ -1923,7 +1909,7 @@ class Detector {
|
|||||||
void setDetectorLock(bool lock, Positions pos = {});
|
void setDetectorLock(bool lock, Positions pos = {});
|
||||||
|
|
||||||
/** Client IP Address that last communicated with the detector */
|
/** Client IP Address that last communicated with the detector */
|
||||||
Result<IpAddr> getLastClientIP(Positions pos = {}) const;
|
Result<sls::IpAddr> getLastClientIP(Positions pos = {}) const;
|
||||||
|
|
||||||
/** Execute a command on the detector server console */
|
/** Execute a command on the detector server console */
|
||||||
Result<std::string> executeCommand(const std::string &value,
|
Result<std::string> executeCommand(const std::string &value,
|
||||||
@ -1945,6 +1931,7 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
std::string getUserDetails() const;
|
std::string getUserDetails() const;
|
||||||
|
|
||||||
|
Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const;
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -4,19 +4,32 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short data structure to hold the detector data after postprocessing
|
@short data structure to hold the detector data after postprocessing
|
||||||
*/
|
*/
|
||||||
class detectorData {
|
class detectorData {
|
||||||
public:
|
public:
|
||||||
detectorData(double progressIndex, std::string fileName, int nx, int ny, char *data, int databytes, int dynamicRange, uint64_t fileIndex, bool completeImage)
|
|
||||||
: progressIndex(progressIndex), fileName(fileName), fileIndex(fileIndex), nx(nx), ny(ny), data(data), databytes(databytes), dynamicRange(dynamicRange), completeImage(completeImage){};
|
|
||||||
|
|
||||||
detectorData(double progressIndex, std::string fileName, int nx, int ny, char *data, int databytes, int dynamicRange, uint64_t fileIndex, bool completeImage, std::array<int, 4> rxRoi)
|
|
||||||
: progressIndex(progressIndex), fileName(fileName), fileIndex(fileIndex), nx(nx), ny(ny), data(data), databytes(databytes), dynamicRange(dynamicRange), completeImage(completeImage), rxRoi(rxRoi) {};
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param progress progress index
|
||||||
|
* @param fname file name prefix
|
||||||
|
* @param x number of detector channels (1D detector) or dimension in x (2D
|
||||||
|
* detector)
|
||||||
|
* @param y dimension in y (2D detector)
|
||||||
|
* @param d pointer to data in char* format
|
||||||
|
* @param dbytes number of bytes of image pointed to by cval pointer
|
||||||
|
* @param dr dynamic range or bits per pixel
|
||||||
|
* @param fIndex file index
|
||||||
|
* @param complete true if complete image, else missing packets
|
||||||
|
*/
|
||||||
|
detectorData(double progress, std::string fname, int x, int y, char *d,
|
||||||
|
int dbytes, int dr, uint64_t fIndex, bool complete)
|
||||||
|
: progressIndex(progress), fileName(fname), fileIndex(fIndex), nx(x),
|
||||||
|
ny(y), data(d), databytes(dbytes), dynamicRange(dr),
|
||||||
|
completeImage(complete){};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
* data has to be deleted by caller
|
* data has to be deleted by caller
|
||||||
*/
|
*/
|
||||||
~detectorData(){};
|
~detectorData(){};
|
||||||
@ -47,11 +60,8 @@ class detectorData {
|
|||||||
uint64_t fileIndex;
|
uint64_t fileIndex;
|
||||||
int nx;
|
int nx;
|
||||||
int ny;
|
int ny;
|
||||||
char *data{nullptr};
|
char *data;
|
||||||
int databytes;
|
int databytes;
|
||||||
int dynamicRange;
|
int dynamicRange;
|
||||||
bool completeImage;
|
bool completeImage;
|
||||||
std::array<int,4> rxRoi{{-1, -1, -1, -1}};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11,8 +11,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
/** Macro to make an integer command.
|
/** Macro to make an integer command.
|
||||||
* CMDNAME name of the function that does the command
|
* CMDNAME name of the function that does the command
|
||||||
* GETFCN Detector function to get
|
* GETFCN Detector function to get
|
||||||
@ -55,7 +53,7 @@ namespace sls {
|
|||||||
os << args[0] << '\n'; \
|
os << args[0] << '\n'; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -77,9 +75,9 @@ namespace sls {
|
|||||||
WrongNumberOfParameters(1); \
|
WrongNumberOfParameters(1); \
|
||||||
} \
|
} \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
throw RuntimeError("cannot put"); \
|
throw sls::RuntimeError("cannot put"); \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -104,7 +102,7 @@ namespace sls {
|
|||||||
det->SETFCN(args[0], std::vector<int>{det_id}); \
|
det->SETFCN(args[0], std::vector<int>{det_id}); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -130,7 +128,7 @@ namespace sls {
|
|||||||
det->SETFCN(val, std::vector<int>{det_id}); \
|
det->SETFCN(val, std::vector<int>{det_id}); \
|
||||||
os << ToStringHex(val, 16) << '\n'; \
|
os << ToStringHex(val, 16) << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -156,7 +154,7 @@ namespace sls {
|
|||||||
det->SETFCN(val, std::vector<int>{det_id}); \
|
det->SETFCN(val, std::vector<int>{det_id}); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -182,13 +180,39 @@ namespace sls {
|
|||||||
det->SETFCN(val, std::vector<int>{det_id}); \
|
det->SETFCN(val, std::vector<int>{det_id}); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
|
} \
|
||||||
|
return os.str(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define INTEGER_COMMAND_VEC_ID_RX(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
|
||||||
|
std::string CMDNAME(const int action) { \
|
||||||
|
std::ostringstream os; \
|
||||||
|
os << cmd << ' '; \
|
||||||
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
|
os << HLPSTR << '\n'; \
|
||||||
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
|
if (!args.empty()) { \
|
||||||
|
WrongNumberOfParameters(0); \
|
||||||
|
} \
|
||||||
|
auto t = det->GETFCN(std::vector<int>{det_id}, rx_id); \
|
||||||
|
os << OutString(t) << '\n'; \
|
||||||
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
|
if (args.size() != 1) { \
|
||||||
|
WrongNumberOfParameters(1); \
|
||||||
|
} \
|
||||||
|
auto val = CONV(args[0]); \
|
||||||
|
det->SETFCN(val, std::vector<int>{det_id}, rx_id); \
|
||||||
|
os << args.front() << '\n'; \
|
||||||
|
} else { \
|
||||||
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/** int or enum */
|
/** int or enum */
|
||||||
#define INTEGER_COMMAND_VEC_ID_GET(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
|
#define INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, \
|
||||||
|
HLPSTR) \
|
||||||
std::string CMDNAME(const int action) { \
|
std::string CMDNAME(const int action) { \
|
||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
os << cmd << ' '; \
|
os << cmd << ' '; \
|
||||||
@ -208,7 +232,33 @@ namespace sls {
|
|||||||
det->SETFCN(val, det_id); \
|
det->SETFCN(val, det_id); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
|
} \
|
||||||
|
return os.str(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, \
|
||||||
|
HLPSTR) \
|
||||||
|
std::string CMDNAME(const int action) { \
|
||||||
|
std::ostringstream os; \
|
||||||
|
os << cmd << ' '; \
|
||||||
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
|
os << HLPSTR << '\n'; \
|
||||||
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
|
if (!args.empty()) { \
|
||||||
|
WrongNumberOfParameters(0); \
|
||||||
|
} \
|
||||||
|
auto t = det->GETFCN(std::vector<int>{det_id}, rx_id); \
|
||||||
|
os << OutString(t) << '\n'; \
|
||||||
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
|
if (args.size() != 1) { \
|
||||||
|
WrongNumberOfParameters(1); \
|
||||||
|
} \
|
||||||
|
auto val = CONV(args[0]); \
|
||||||
|
det->SETFCN(val, det_id, rx_id); \
|
||||||
|
os << args.front() << '\n'; \
|
||||||
|
} else { \
|
||||||
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -234,7 +284,7 @@ namespace sls {
|
|||||||
det->SETFCN(val, det_id); \
|
det->SETFCN(val, det_id); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -254,7 +304,7 @@ namespace sls {
|
|||||||
os << OutString(t) << '\n'; \
|
os << OutString(t) << '\n'; \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
if (det_id != -1) { \
|
if (det_id != -1) { \
|
||||||
throw RuntimeError( \
|
throw sls::RuntimeError( \
|
||||||
"Cannot execute this at module level"); \
|
"Cannot execute this at module level"); \
|
||||||
} \
|
} \
|
||||||
if (args.size() != 1) { \
|
if (args.size() != 1) { \
|
||||||
@ -264,7 +314,7 @@ namespace sls {
|
|||||||
det->SETFCN(val); \
|
det->SETFCN(val); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -275,7 +325,7 @@ namespace sls {
|
|||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
os << cmd << ' '; \
|
os << cmd << ' '; \
|
||||||
if (det_id != -1) { \
|
if (det_id != -1) { \
|
||||||
throw RuntimeError("Cannot execute this at module level"); \
|
throw sls::RuntimeError("Cannot execute this at module level"); \
|
||||||
} \
|
} \
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
os << HLPSTR << '\n'; \
|
os << HLPSTR << '\n'; \
|
||||||
@ -293,7 +343,7 @@ namespace sls {
|
|||||||
det->SETFCN(val); \
|
det->SETFCN(val); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -319,7 +369,7 @@ namespace sls {
|
|||||||
det->SETFCN(INDEX, val, std::vector<int>{det_id}); \
|
det->SETFCN(INDEX, val, std::vector<int>{det_id}); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -347,7 +397,7 @@ namespace sls {
|
|||||||
std::vector<int>{det_id}); \
|
std::vector<int>{det_id}); \
|
||||||
os << args[0] << ' ' << args[1] << '\n'; \
|
os << args[0] << ' ' << args[1] << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -358,12 +408,12 @@ namespace sls {
|
|||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
os << cmd << ' '; \
|
os << cmd << ' '; \
|
||||||
if (det_id != -1) { \
|
if (det_id != -1) { \
|
||||||
throw RuntimeError("Cannot execute this at module level"); \
|
throw sls::RuntimeError("Cannot execute this at module level"); \
|
||||||
} \
|
} \
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
os << HLPSTR << '\n'; \
|
os << HLPSTR << '\n'; \
|
||||||
else if (action == slsDetectorDefs::GET_ACTION) { \
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
throw RuntimeError("Cannot get"); \
|
throw sls::RuntimeError("Cannot get"); \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
if (!args.empty()) { \
|
if (!args.empty()) { \
|
||||||
WrongNumberOfParameters(0); \
|
WrongNumberOfParameters(0); \
|
||||||
@ -371,7 +421,7 @@ namespace sls {
|
|||||||
det->SETFCN(); \
|
det->SETFCN(); \
|
||||||
os << "successful\n"; \
|
os << "successful\n"; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -384,7 +434,7 @@ namespace sls {
|
|||||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
os << HLPSTR << '\n'; \
|
os << HLPSTR << '\n'; \
|
||||||
else if (action == slsDetectorDefs::GET_ACTION) { \
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
throw RuntimeError("Cannot get"); \
|
throw sls::RuntimeError("Cannot get"); \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
if (!args.empty()) { \
|
if (!args.empty()) { \
|
||||||
WrongNumberOfParameters(0); \
|
WrongNumberOfParameters(0); \
|
||||||
@ -392,7 +442,7 @@ namespace sls {
|
|||||||
det->SETFCN(std::vector<int>{det_id}); \
|
det->SETFCN(std::vector<int>{det_id}); \
|
||||||
os << "successful\n"; \
|
os << "successful\n"; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -403,12 +453,12 @@ namespace sls {
|
|||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
os << cmd << ' '; \
|
os << cmd << ' '; \
|
||||||
if (det_id != -1) { \
|
if (det_id != -1) { \
|
||||||
throw RuntimeError("Cannot execute this at module level"); \
|
throw sls::RuntimeError("Cannot execute this at module level"); \
|
||||||
} \
|
} \
|
||||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
os << HLPSTR << '\n'; \
|
os << HLPSTR << '\n'; \
|
||||||
else if (action == slsDetectorDefs::GET_ACTION) { \
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
throw RuntimeError("Cannot get"); \
|
throw sls::RuntimeError("Cannot get"); \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
if (args.size() != 1) { \
|
if (args.size() != 1) { \
|
||||||
WrongNumberOfParameters(1); \
|
WrongNumberOfParameters(1); \
|
||||||
@ -416,7 +466,7 @@ namespace sls {
|
|||||||
det->SETFCN(args[0]); \
|
det->SETFCN(args[0]); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -429,7 +479,7 @@ namespace sls {
|
|||||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
os << HLPSTR << '\n'; \
|
os << HLPSTR << '\n'; \
|
||||||
else if (action == slsDetectorDefs::GET_ACTION) { \
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
throw RuntimeError("Cannot get"); \
|
throw sls::RuntimeError("Cannot get"); \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
if (args.size() != 1) { \
|
if (args.size() != 1) { \
|
||||||
WrongNumberOfParameters(1); \
|
WrongNumberOfParameters(1); \
|
||||||
@ -437,7 +487,7 @@ namespace sls {
|
|||||||
det->SETFCN(args[0], std::vector<int>{det_id}); \
|
det->SETFCN(args[0], std::vector<int>{det_id}); \
|
||||||
os << args.front() << '\n'; \
|
os << args.front() << '\n'; \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -456,9 +506,29 @@ namespace sls {
|
|||||||
auto t = det->GETFCN(std::vector<int>{det_id}); \
|
auto t = det->GETFCN(std::vector<int>{det_id}); \
|
||||||
os << OutString(t) << '\n'; \
|
os << OutString(t) << '\n'; \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
throw RuntimeError("Cannot put"); \
|
throw sls::RuntimeError("Cannot put"); \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
|
} \
|
||||||
|
return os.str(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GET_COMMAND_RX(CMDNAME, GETFCN, HLPSTR) \
|
||||||
|
std::string CMDNAME(const int action) { \
|
||||||
|
std::ostringstream os; \
|
||||||
|
os << cmd << ' '; \
|
||||||
|
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||||
|
os << HLPSTR << '\n'; \
|
||||||
|
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||||
|
if (!args.empty()) { \
|
||||||
|
WrongNumberOfParameters(0); \
|
||||||
|
} \
|
||||||
|
auto t = det->GETFCN(std::vector<int>{det_id}); \
|
||||||
|
os << OutString(t) << '\n'; \
|
||||||
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
|
throw sls::RuntimeError("Cannot put"); \
|
||||||
|
} else { \
|
||||||
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -475,11 +545,11 @@ namespace sls {
|
|||||||
WrongNumberOfParameters(0); \
|
WrongNumberOfParameters(0); \
|
||||||
} \
|
} \
|
||||||
auto t = det->GETFCN(); \
|
auto t = det->GETFCN(); \
|
||||||
os << ToString(t) << '\n'; \
|
os << sls::ToString(t) << '\n'; \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
throw RuntimeError("Cannot put"); \
|
throw sls::RuntimeError("Cannot put"); \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -498,9 +568,9 @@ namespace sls {
|
|||||||
auto t = det->GETFCN(std::vector<int>{det_id}); \
|
auto t = det->GETFCN(std::vector<int>{det_id}); \
|
||||||
os << OutStringHex(t) << '\n'; \
|
os << OutStringHex(t) << '\n'; \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
throw RuntimeError("Cannot put"); \
|
throw sls::RuntimeError("Cannot put"); \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
@ -518,13 +588,15 @@ namespace sls {
|
|||||||
auto t = det->GETFCN(VAL, std::vector<int>{det_id}); \
|
auto t = det->GETFCN(VAL, std::vector<int>{det_id}); \
|
||||||
os << OutString(t) << APPEND << '\n'; \
|
os << OutString(t) << APPEND << '\n'; \
|
||||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||||
throw RuntimeError("Cannot put"); \
|
throw sls::RuntimeError("Cannot put"); \
|
||||||
} else { \
|
} else { \
|
||||||
throw RuntimeError("Unknown action"); \
|
throw sls::RuntimeError("Unknown action"); \
|
||||||
} \
|
} \
|
||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
class CmdProxy {
|
class CmdProxy {
|
||||||
public:
|
public:
|
||||||
explicit CmdProxy(Detector *ptr) : det(ptr) {}
|
explicit CmdProxy(Detector *ptr) : det(ptr) {}
|
||||||
@ -558,7 +630,7 @@ class CmdProxy {
|
|||||||
return ToStringHex(value, width);
|
return ToStringHex(value, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename V> std::string OutString(const Result<V> &value) {
|
template <typename V> std::string OutString(const sls::Result<V> &value) {
|
||||||
if (value.equal())
|
if (value.equal())
|
||||||
return ToString(value.front());
|
return ToString(value.front());
|
||||||
return ToString(value);
|
return ToString(value);
|
||||||
@ -743,10 +815,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* Pattern */
|
/* Pattern */
|
||||||
/* Moench */
|
/* Moench */
|
||||||
|
|
||||||
/* Advanced */
|
/* Advanced */
|
||||||
{"copydetectorserver", "updatedetectorserver"},
|
|
||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
{"nframes", "framecounter"},
|
{"nframes", "framecounter"},
|
||||||
{"now", "runtime"},
|
{"now", "runtime"},
|
||||||
@ -782,7 +851,7 @@ class CmdProxy {
|
|||||||
{"threshold", &CmdProxy::Threshold},
|
{"threshold", &CmdProxy::Threshold},
|
||||||
{"thresholdnotb", &CmdProxy::Threshold},
|
{"thresholdnotb", &CmdProxy::Threshold},
|
||||||
{"settingspath", &CmdProxy::settingspath},
|
{"settingspath", &CmdProxy::settingspath},
|
||||||
{"trimbits", &CmdProxy::Trimbits},
|
{"trimbits", &CmdProxy::trimbits},
|
||||||
{"trimval", &CmdProxy::trimval},
|
{"trimval", &CmdProxy::trimval},
|
||||||
{"trimen", &CmdProxy::TrimEnergies},
|
{"trimen", &CmdProxy::TrimEnergies},
|
||||||
{"gappixels", &CmdProxy::GapPixels},
|
{"gappixels", &CmdProxy::GapPixels},
|
||||||
@ -840,7 +909,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
{"dac", &CmdProxy::Dac},
|
{"dac", &CmdProxy::Dac},
|
||||||
{"daclist", &CmdProxy::DacList},
|
{"daclist", &CmdProxy::daclist},
|
||||||
{"dacvalues", &CmdProxy::DacValues},
|
{"dacvalues", &CmdProxy::DacValues},
|
||||||
{"resetdacs", &CmdProxy::ResetDacs},
|
{"resetdacs", &CmdProxy::ResetDacs},
|
||||||
{"defaultdac", &CmdProxy::DefaultDac},
|
{"defaultdac", &CmdProxy::DefaultDac},
|
||||||
@ -863,8 +932,7 @@ class CmdProxy {
|
|||||||
{"rx_status", &CmdProxy::ReceiverStatus},
|
{"rx_status", &CmdProxy::ReceiverStatus},
|
||||||
{"status", &CmdProxy::DetectorStatus},
|
{"status", &CmdProxy::DetectorStatus},
|
||||||
{"rx_framescaught", &CmdProxy::rx_framescaught},
|
{"rx_framescaught", &CmdProxy::rx_framescaught},
|
||||||
{"rx_missingpackets", &CmdProxy::rx_missingpackets},
|
{"rx_missingpackets", &CmdProxy::RxMissingPackets},
|
||||||
{"rx_frameindex", &CmdProxy::rx_frameindex},
|
|
||||||
{"nextframenumber", &CmdProxy::nextframenumber},
|
{"nextframenumber", &CmdProxy::nextframenumber},
|
||||||
{"trigger", &CmdProxy::Trigger},
|
{"trigger", &CmdProxy::Trigger},
|
||||||
{"scan", &CmdProxy::Scan},
|
{"scan", &CmdProxy::Scan},
|
||||||
@ -877,8 +945,8 @@ class CmdProxy {
|
|||||||
{"udp_numdst", &CmdProxy::udp_numdst},
|
{"udp_numdst", &CmdProxy::udp_numdst},
|
||||||
{"udp_cleardst", &CmdProxy::udp_cleardst},
|
{"udp_cleardst", &CmdProxy::udp_cleardst},
|
||||||
{"udp_firstdst", &CmdProxy::udp_firstdst},
|
{"udp_firstdst", &CmdProxy::udp_firstdst},
|
||||||
{"udp_srcip", &CmdProxy::UDPSourceIP},
|
{"udp_srcip", &CmdProxy::udp_srcip},
|
||||||
{"udp_srcip2", &CmdProxy::UDPSourceIP2},
|
{"udp_srcip2", &CmdProxy::udp_srcip2},
|
||||||
{"udp_dstip", &CmdProxy::UDPDestinationIP},
|
{"udp_dstip", &CmdProxy::UDPDestinationIP},
|
||||||
{"udp_dstip2", &CmdProxy::UDPDestinationIP2},
|
{"udp_dstip2", &CmdProxy::UDPDestinationIP2},
|
||||||
{"udp_srcmac", &CmdProxy::udp_srcmac},
|
{"udp_srcmac", &CmdProxy::udp_srcmac},
|
||||||
@ -909,8 +977,6 @@ class CmdProxy {
|
|||||||
{"rx_lastclient", &CmdProxy::rx_lastclient},
|
{"rx_lastclient", &CmdProxy::rx_lastclient},
|
||||||
{"rx_threads", &CmdProxy::rx_threads},
|
{"rx_threads", &CmdProxy::rx_threads},
|
||||||
{"rx_arping", &CmdProxy::rx_arping},
|
{"rx_arping", &CmdProxy::rx_arping},
|
||||||
{"rx_roi", &CmdProxy::Rx_ROI},
|
|
||||||
{"rx_clearroi", &CmdProxy::rx_clearroi},
|
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
{"fformat", &CmdProxy::fformat},
|
{"fformat", &CmdProxy::fformat},
|
||||||
@ -966,7 +1032,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* Gotthard Specific */
|
/* Gotthard Specific */
|
||||||
{"roi", &CmdProxy::ROI},
|
{"roi", &CmdProxy::ROI},
|
||||||
{"clearroi", &CmdProxy::clearroi},
|
{"clearroi", &CmdProxy::ClearROI},
|
||||||
{"exptimel", &CmdProxy::exptimel},
|
{"exptimel", &CmdProxy::exptimel},
|
||||||
|
|
||||||
/* Gotthard2 Specific */
|
/* Gotthard2 Specific */
|
||||||
@ -997,11 +1063,6 @@ class CmdProxy {
|
|||||||
{"gatedelay2", &CmdProxy::GateDelay},
|
{"gatedelay2", &CmdProxy::GateDelay},
|
||||||
{"gatedelay3", &CmdProxy::GateDelay},
|
{"gatedelay3", &CmdProxy::GateDelay},
|
||||||
{"gaincaps", &CmdProxy::GainCaps},
|
{"gaincaps", &CmdProxy::GainCaps},
|
||||||
{"polarity", &CmdProxy::polarity},
|
|
||||||
{"interpolation", &CmdProxy::interpolation},
|
|
||||||
{"pumpprobe", &CmdProxy::pumpprobe},
|
|
||||||
{"apulse", &CmdProxy::apulse},
|
|
||||||
{"dpulse", &CmdProxy::dpulse},
|
|
||||||
|
|
||||||
/* CTB/ Moench Specific */
|
/* CTB/ Moench Specific */
|
||||||
{"samples", &CmdProxy::Samples},
|
{"samples", &CmdProxy::Samples},
|
||||||
@ -1072,6 +1133,7 @@ class CmdProxy {
|
|||||||
/* Advanced */
|
/* Advanced */
|
||||||
{"programfpga", &CmdProxy::ProgramFpga},
|
{"programfpga", &CmdProxy::ProgramFpga},
|
||||||
{"resetfpga", &CmdProxy::resetfpga},
|
{"resetfpga", &CmdProxy::resetfpga},
|
||||||
|
{"copydetectorserver", &CmdProxy::CopyDetectorServer},
|
||||||
{"updatedetectorserver", &CmdProxy::UpdateDetectorServer},
|
{"updatedetectorserver", &CmdProxy::UpdateDetectorServer},
|
||||||
{"updatekernel", &CmdProxy::UpdateKernel},
|
{"updatekernel", &CmdProxy::UpdateKernel},
|
||||||
{"rebootcontroller", &CmdProxy::rebootcontroller},
|
{"rebootcontroller", &CmdProxy::rebootcontroller},
|
||||||
@ -1096,7 +1158,8 @@ class CmdProxy {
|
|||||||
{"framecounter", &CmdProxy::framecounter},
|
{"framecounter", &CmdProxy::framecounter},
|
||||||
{"runtime", &CmdProxy::runtime},
|
{"runtime", &CmdProxy::runtime},
|
||||||
{"frametime", &CmdProxy::frametime},
|
{"frametime", &CmdProxy::frametime},
|
||||||
{"user", &CmdProxy::UserDetails}
|
{"user", &CmdProxy::UserDetails},
|
||||||
|
{"rx_frameindex", &CmdProxy::rx_frameindex}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1115,7 +1178,6 @@ class CmdProxy {
|
|||||||
std::string ClientVersion(int action);
|
std::string ClientVersion(int action);
|
||||||
std::string DetectorSize(int action);
|
std::string DetectorSize(int action);
|
||||||
std::string Threshold(int action);
|
std::string Threshold(int action);
|
||||||
std::string Trimbits(int action);
|
|
||||||
std::string TrimEnergies(int action);
|
std::string TrimEnergies(int action);
|
||||||
std::string GapPixels(int action);
|
std::string GapPixels(int action);
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
@ -1134,7 +1196,6 @@ class CmdProxy {
|
|||||||
std::string TemperatureValues(int action);
|
std::string TemperatureValues(int action);
|
||||||
/* dacs */
|
/* dacs */
|
||||||
std::string Dac(int action);
|
std::string Dac(int action);
|
||||||
std::string DacList(int action);
|
|
||||||
std::string DacValues(int action);
|
std::string DacValues(int action);
|
||||||
std::string ResetDacs(int action);
|
std::string ResetDacs(int action);
|
||||||
std::string DefaultDac(int action);
|
std::string DefaultDac(int action);
|
||||||
@ -1148,13 +1209,10 @@ class CmdProxy {
|
|||||||
IpAddr getIpFromAuto();
|
IpAddr getIpFromAuto();
|
||||||
UdpDestination getUdpEntry();
|
UdpDestination getUdpEntry();
|
||||||
std::string UDPDestinationList(int action);
|
std::string UDPDestinationList(int action);
|
||||||
std::string UDPSourceIP(int action);
|
|
||||||
std::string UDPSourceIP2(int action);
|
|
||||||
std::string UDPDestinationIP(int action);
|
std::string UDPDestinationIP(int action);
|
||||||
std::string UDPDestinationIP2(int action);
|
std::string UDPDestinationIP2(int action);
|
||||||
/* Receiver Config */
|
/* Receiver Config */
|
||||||
std::string ReceiverHostname(int action);
|
std::string ReceiverHostname(int action);
|
||||||
std::string Rx_ROI(int action);
|
|
||||||
/* File */
|
/* File */
|
||||||
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
||||||
std::string ZMQHWM(int action);
|
std::string ZMQHWM(int action);
|
||||||
@ -1169,6 +1227,7 @@ class CmdProxy {
|
|||||||
std::string TemperatureEvent(int action);
|
std::string TemperatureEvent(int action);
|
||||||
/* Gotthard Specific */
|
/* Gotthard Specific */
|
||||||
std::string ROI(int action);
|
std::string ROI(int action);
|
||||||
|
std::string ClearROI(int action);
|
||||||
/* Gotthard2 Specific */
|
/* Gotthard2 Specific */
|
||||||
std::string InjectChannel(int action);
|
std::string InjectChannel(int action);
|
||||||
std::string VetoPhoton(int action);
|
std::string VetoPhoton(int action);
|
||||||
@ -1201,6 +1260,7 @@ class CmdProxy {
|
|||||||
std::string JsonParameter(int action);
|
std::string JsonParameter(int action);
|
||||||
/* Advanced */
|
/* Advanced */
|
||||||
std::string ProgramFpga(int action);
|
std::string ProgramFpga(int action);
|
||||||
|
std::string CopyDetectorServer(int action);
|
||||||
std::string UpdateDetectorServer(int action);
|
std::string UpdateDetectorServer(int action);
|
||||||
std::string UpdateKernel(int action);
|
std::string UpdateKernel(int action);
|
||||||
std::string UpdateFirmwareAndDetectorServer(int action);
|
std::string UpdateFirmwareAndDetectorServer(int action);
|
||||||
@ -1254,7 +1314,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
settings, getSettings, setSettings,
|
settings, getSettings, setSettings,
|
||||||
StringTo<slsDetectorDefs::detectorSettings>,
|
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||||
"[standard, fast, highgain, dynamicgain, lowgain, "
|
"[standard, fast, highgain, dynamicgain, lowgain, "
|
||||||
"mediumgain, veryhighgain, highgain0, "
|
"mediumgain, veryhighgain, highgain0, "
|
||||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
||||||
@ -1276,6 +1336,11 @@ class CmdProxy {
|
|||||||
"[path]\n\t[Eiger][Mythen3] Directory where settings files "
|
"[path]\n\t[Eiger][Mythen3] Directory where settings files "
|
||||||
"are loaded from/to.");
|
"are loaded from/to.");
|
||||||
|
|
||||||
|
EXECUTE_SET_COMMAND_1ARG(
|
||||||
|
trimbits, loadTrimbits,
|
||||||
|
"[fname]\n\t[Eiger][Mythen3] Loads the trimbit file to detector. If no "
|
||||||
|
"extension specified, serial number of each module is attached.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
trimval, getAllTrimbits, setAllTrimbits, StringTo<int>,
|
trimval, getAllTrimbits, setAllTrimbits, StringTo<int>,
|
||||||
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
|
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
|
||||||
@ -1289,7 +1354,7 @@ class CmdProxy {
|
|||||||
"interfaces must be set to 2. slsReceiver and slsDetectorGui "
|
"interfaces must be set to 2. slsReceiver and slsDetectorGui "
|
||||||
"does not handle.");
|
"does not handle.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(
|
||||||
master, getMaster, setMaster, StringTo<int>,
|
master, getMaster, setMaster, StringTo<int>,
|
||||||
"[0, 1]\n\t[Eiger] Sets half module to master and "
|
"[0, 1]\n\t[Eiger] Sets half module to master and "
|
||||||
"others to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
|
"others to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
|
||||||
@ -1352,7 +1417,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
timing, getTimingMode, setTimingMode,
|
timing, getTimingMode, setTimingMode,
|
||||||
StringTo<slsDetectorDefs::timingMode>,
|
sls::StringTo<slsDetectorDefs::timingMode>,
|
||||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
||||||
"detector.\n\t[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] "
|
"detector.\n\t[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] "
|
||||||
"[auto|trigger]\n\t[Mythen3] "
|
"[auto|trigger]\n\t[Mythen3] "
|
||||||
@ -1472,6 +1537,10 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
|
GET_COMMAND_NOID(
|
||||||
|
daclist, getDacList,
|
||||||
|
"\n\tGets the list of commands for every dac for this detector.");
|
||||||
|
|
||||||
/* on chip dacs */
|
/* on chip dacs */
|
||||||
INTEGER_USER_IND_COMMAND(
|
INTEGER_USER_IND_COMMAND(
|
||||||
vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>,
|
vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>,
|
||||||
@ -1543,15 +1612,11 @@ class CmdProxy {
|
|||||||
"to IDLE or STOPPED. Goes to stop server.");
|
"to IDLE or STOPPED. Goes to stop server.");
|
||||||
|
|
||||||
GET_COMMAND(rx_framescaught, getFramesCaught,
|
GET_COMMAND(rx_framescaught, getFramesCaught,
|
||||||
"\n\tNumber of frames caught by each port in receiver.");
|
"\n\tNumber of frames caught by receiver.");
|
||||||
|
|
||||||
GET_COMMAND(rx_missingpackets, getNumMissingPackets,
|
GET_COMMAND(rx_missingpackets, getNumMissingPackets,
|
||||||
"\n\tNumber of missing packets for each port in receiver. If "
|
"\n\tNumber of missing packets for each port in receiver. "
|
||||||
"negative, they are packets in excess. ");
|
"Negative number denotes extra packets.");
|
||||||
|
|
||||||
GET_COMMAND(rx_frameindex, getRxCurrentFrameIndex,
|
|
||||||
"\n\tCurrent frame index received for each port in receiver "
|
|
||||||
"during acquisition.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
nextframenumber, getNextFrameNumber, setNextFrameNumber,
|
nextframenumber, getNextFrameNumber, setNextFrameNumber,
|
||||||
@ -1599,6 +1664,19 @@ class CmdProxy {
|
|||||||
"out from in a round robin fashion. The entry must not have been "
|
"out from in a round robin fashion. The entry must not have been "
|
||||||
"empty. Default: 0");
|
"empty. Default: 0");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
|
||||||
|
"[x.x.x.x]\n\tIp address of the detector (source) udp "
|
||||||
|
"interface. Must be same subnet as destination udp "
|
||||||
|
"ip.\n\t[Eiger] Set only for 10G. For 1G, detector will "
|
||||||
|
"replace with its own DHCP IP address.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
udp_srcip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr,
|
||||||
|
"[x.x.x.x]\n\t[Jungfrau][Gotthard2] Ip address of the detector "
|
||||||
|
"(source) udp interface 2. Must be same subnet as destination udp "
|
||||||
|
"ip2.\n\t [Jungfrau] top half or inner interface\n\t [Gotthard2] veto "
|
||||||
|
"debugging.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
|
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
|
||||||
@ -1611,14 +1689,14 @@ class CmdProxy {
|
|||||||
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the top "
|
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the top "
|
||||||
"half or inner (source) udp interface. ");
|
"half or inner (source) udp interface. ");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID_RX(
|
||||||
udp_dstmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr,
|
udp_dstmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr,
|
||||||
"[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp "
|
"[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp "
|
||||||
"interface. Not mandatory to set as udp_dstip retrieves it from "
|
"interface. Not mandatory to set as udp_dstip retrieves it from "
|
||||||
"slsReceiver process, but must be set if you use a custom receiver "
|
"slsReceiver process, but must be set if you use a custom receiver "
|
||||||
"(not slsReceiver).");
|
"(not slsReceiver).");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID_RX(
|
||||||
udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
|
udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
|
||||||
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) "
|
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) "
|
||||||
"udp interface 2. Not mandatory to set as udp_dstip2 retrieves it from "
|
"udp interface 2. Not mandatory to set as udp_dstip2 retrieves it from "
|
||||||
@ -1627,14 +1705,14 @@ class CmdProxy {
|
|||||||
"[Gotthard2] veto "
|
"[Gotthard2] veto "
|
||||||
"debugging.");
|
"debugging.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(
|
||||||
udp_dstport, getDestinationUDPPort, setDestinationUDPPort,
|
udp_dstport, getDestinationUDPPort, setDestinationUDPPort,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[n]\n\tPort number of the receiver (destination) udp "
|
"[n]\n\tPort number of the receiver (destination) udp "
|
||||||
"interface. Default is 50001. \n\tIf multi command, ports for each "
|
"interface. Default is 50001. \n\tIf multi command, ports for each "
|
||||||
"module is calculated (incremented by 1 if no 2nd interface)");
|
"module is calculated (incremented by 1 if no 2nd interface)");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(
|
||||||
udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2,
|
udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[n]\n\t[Jungfrau][Eiger][Gotthard2] Port number of the "
|
"[n]\n\t[Jungfrau][Eiger][Gotthard2] Port number of the "
|
||||||
@ -1656,7 +1734,7 @@ class CmdProxy {
|
|||||||
"valid. If not configured, it will throw with error message "
|
"valid. If not configured, it will throw with error message "
|
||||||
"requesting missing udp information.");
|
"requesting missing udp information.");
|
||||||
|
|
||||||
GET_COMMAND(rx_printconfig, printRxConfiguration,
|
GET_COMMAND_RX(rx_printconfig, printRxConfiguration,
|
||||||
"\n\tPrints the receiver configuration.");
|
"\n\tPrints the receiver configuration.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
@ -1693,7 +1771,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* Receiver Config */
|
/* Receiver Config */
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(
|
||||||
rx_tcpport, getRxPort, setRxPort, StringTo<int>,
|
rx_tcpport, getRxPort, setRxPort, StringTo<int>,
|
||||||
"[port]\n\tTCP port for client-receiver communication. Default is "
|
"[port]\n\tTCP port for client-receiver communication. Default is "
|
||||||
"1954. Must be different if multiple receivers on same pc. Must be "
|
"1954. Must be different if multiple receivers on same pc. Must be "
|
||||||
@ -1711,7 +1789,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy,
|
rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy,
|
||||||
StringTo<slsDetectorDefs::frameDiscardPolicy>,
|
sls::StringTo<slsDetectorDefs::frameDiscardPolicy>,
|
||||||
"[nodiscard (default)|discardempty|discardpartial(fastest)]\n\tFrame "
|
"[nodiscard (default)|discardempty|discardpartial(fastest)]\n\tFrame "
|
||||||
"discard policy of receiver. nodiscard does not discard frames, "
|
"discard policy of receiver. nodiscard does not discard frames, "
|
||||||
"discardempty discards empty frames, discardpartial discards partial "
|
"discardempty discards empty frames, discardpartial discards partial "
|
||||||
@ -1752,16 +1830,11 @@ class CmdProxy {
|
|||||||
"the interface it is "
|
"the interface it is "
|
||||||
"listening to every minute. Useful in 10G mode.");
|
"listening to every minute. Useful in 10G mode.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND_NOID(
|
|
||||||
rx_clearroi, clearRxROI,
|
|
||||||
"Resets Region of interest in receiver. Default is all "
|
|
||||||
"channels/pixels enabled.");
|
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
fformat, getFileFormat, setFileFormat,
|
fformat, getFileFormat, setFileFormat,
|
||||||
StringTo<slsDetectorDefs::fileFormat>,
|
sls::StringTo<slsDetectorDefs::fileFormat>,
|
||||||
"[binary|hdf5]\n\tFile format of data file. For HDF5, package must be "
|
"[binary|hdf5]\n\tFile format of data file. For HDF5, package must be "
|
||||||
"compiled with HDF5 flags. Default is binary.");
|
"compiled with HDF5 flags. Default is binary.");
|
||||||
|
|
||||||
@ -1823,7 +1896,7 @@ class CmdProxy {
|
|||||||
"default, which streams the first frame in an acquisition, "
|
"default, which streams the first frame in an acquisition, "
|
||||||
"and then depending on the rx zmq frequency/ timer");
|
"and then depending on the rx zmq frequency/ timer");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(
|
||||||
rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>,
|
rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>,
|
||||||
"[port]\n\tZmq port for data to be streamed out of the receiver. Also "
|
"[port]\n\tZmq port for data to be streamed out of the receiver. Also "
|
||||||
"restarts receiver zmq streaming if enabled. Default is 30001. "
|
"restarts receiver zmq streaming if enabled. Default is 30001. "
|
||||||
@ -1831,7 +1904,7 @@ class CmdProxy {
|
|||||||
"client(gui). Must be different for every detector (and udp port). "
|
"client(gui). Must be different for every detector (and udp port). "
|
||||||
"Multi command will automatically increment for individual modules.");
|
"Multi command will automatically increment for individual modules.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(
|
||||||
zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>,
|
zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>,
|
||||||
"[port]\n\tZmq port in client(gui) or intermediate process for data to "
|
"[port]\n\tZmq port in client(gui) or intermediate process for data to "
|
||||||
"be streamed to from receiver. Default connects to receiver zmq "
|
"be streamed to from receiver. Default connects to receiver zmq "
|
||||||
@ -1841,7 +1914,7 @@ class CmdProxy {
|
|||||||
"port). Multi command will automatically increment for individual "
|
"port). Multi command will automatically increment for individual "
|
||||||
"modules.");
|
"modules.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID_RX(
|
||||||
rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr,
|
rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr,
|
||||||
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of "
|
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of "
|
||||||
"the receiver. Also restarts receiver zmq streaming if enabled. "
|
"the receiver. Also restarts receiver zmq streaming if enabled. "
|
||||||
@ -1977,13 +2050,13 @@ class CmdProxy {
|
|||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
gainmode, getGainMode, setGainMode,
|
gainmode, getGainMode, setGainMode,
|
||||||
StringTo<slsDetectorDefs::gainMode>,
|
sls::StringTo<slsDetectorDefs::gainMode>,
|
||||||
"[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t["
|
"[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t["
|
||||||
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
||||||
"you can damage the detector!!!");
|
"you can damage the detector!!!");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(filtercells, getNumberOfFilterCells,
|
INTEGER_COMMAND_VEC_ID(filtercells, getNumberOfFilterCells,
|
||||||
setNumberOfFilterCells, StringTo<int>,
|
setNumberOfFilterCells, sls::StringTo<int>,
|
||||||
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
|
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
|
||||||
"chipv1.1. Advanced user Command");
|
"chipv1.1. Advanced user Command");
|
||||||
|
|
||||||
@ -1992,10 +2065,6 @@ class CmdProxy {
|
|||||||
"[(optional unit) ns|us|ms|s]\n\t[Gotthard] Exposure time "
|
"[(optional unit) ns|us|ms|s]\n\t[Gotthard] Exposure time "
|
||||||
"left for current frame. ");
|
"left for current frame. ");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(clearroi, clearROI,
|
|
||||||
"[Gotthard] Resets Region of interest in detector. All "
|
|
||||||
"channels enabled. Default is all channels enabled.");
|
|
||||||
|
|
||||||
/* Gotthard2 Specific */
|
/* Gotthard2 Specific */
|
||||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||||
bursts, getNumberOfBursts, setNumberOfBursts, StringTo<int64_t>,
|
bursts, getNumberOfBursts, setNumberOfBursts, StringTo<int64_t>,
|
||||||
@ -2019,7 +2088,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
timingsource, getTimingSource, setTimingSource,
|
timingsource, getTimingSource, setTimingSource,
|
||||||
StringTo<slsDetectorDefs::timingSourceType>,
|
sls::StringTo<slsDetectorDefs::timingSourceType>,
|
||||||
"[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal "
|
"[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal "
|
||||||
"and external is system timing. Default is internal.");
|
"and external is system timing. Default is internal.");
|
||||||
|
|
||||||
@ -2034,30 +2103,6 @@ class CmdProxy {
|
|||||||
"[n_gates]\n\t[Mythen3] Number of external gates in gating "
|
"[n_gates]\n\t[Mythen3] Number of external gates in gating "
|
||||||
"or trigger_gating mode (external gating).");
|
"or trigger_gating mode (external gating).");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(polarity, getPolarity, setPolarity,
|
|
||||||
StringTo<defs::polarity>,
|
|
||||||
"[pos|neg]\n\t[Mythen3] Sets negative or positive "
|
|
||||||
"polarity. Default is positive");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(interpolation, getInterpolation, setInterpolation,
|
|
||||||
StringTo<int>,
|
|
||||||
"[0, 1]\n\t[Mythen3] Enables or disables "
|
|
||||||
"interpolation. Default is disabled. Interpolation mode enables all counters and disables vth3. Disabling sets back counter mask and vth3.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(pumpprobe, getPumpProbe, setPumpProbe, StringTo<int>,
|
|
||||||
"[0, 1]\n\t[Mythen3] Enables or disables pump probe "
|
|
||||||
"mode. Default is disabled. Pump probe mode only enables vth2. Disabling sets back to previous value.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(apulse, getAnalogPulsing, setAnalogPulsing,
|
|
||||||
StringTo<int>,
|
|
||||||
"[0, 1]\n\t[Mythen3] Enables or disables analog "
|
|
||||||
"pulsing. Default is disabled");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(dpulse, getDigitalPulsing, setDigitalPulsing,
|
|
||||||
StringTo<int>,
|
|
||||||
"[0, 1]\n\t[Mythen3] Enables or disables digital "
|
|
||||||
"pulsing. Default is disabled");
|
|
||||||
|
|
||||||
/* CTB/ Moench Specific */
|
/* CTB/ Moench Specific */
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
@ -2105,7 +2150,7 @@ class CmdProxy {
|
|||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
romode, getReadoutMode, setReadoutMode,
|
romode, getReadoutMode, setReadoutMode,
|
||||||
StringTo<slsDetectorDefs::readoutMode>,
|
sls::StringTo<slsDetectorDefs::readoutMode>,
|
||||||
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. "
|
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. "
|
||||||
"Default is analog.");
|
"Default is analog.");
|
||||||
|
|
||||||
@ -2289,6 +2334,10 @@ class CmdProxy {
|
|||||||
"ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench]["
|
"ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench]["
|
||||||
"CTB] Timestamp at a frame start."
|
"CTB] Timestamp at a frame start."
|
||||||
"\n\t[Gotthard2] not in burst and auto mode.");
|
"\n\t[Gotthard2] not in burst and auto mode.");
|
||||||
|
|
||||||
|
GET_COMMAND(
|
||||||
|
rx_frameindex, getRxCurrentFrameIndex,
|
||||||
|
"\n\tCurrent frame index received in receiver during acquisition.");
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
|
|
||||||
#include "CtbConfig.h"
|
|
||||||
#include "SharedMemory.h"
|
|
||||||
#include "sls/ToString.h"
|
|
||||||
#include "sls/string_utils.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <fstream>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
CtbConfig::CtbConfig(){
|
|
||||||
for (size_t i=0; i!=num_dacs; ++i){
|
|
||||||
setDacName(i, "dac"+ToString(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CtbConfig::check_index(size_t i) const {
|
|
||||||
if (!(i < num_dacs)) {
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << "DAC index is too large needs to be below " << num_dacs;
|
|
||||||
throw RuntimeError(oss.str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CtbConfig::check_size(const std::string &name) const {
|
|
||||||
|
|
||||||
if (name.empty())
|
|
||||||
throw RuntimeError("Name needs to be at least one character");
|
|
||||||
|
|
||||||
// dacname_length -1 to account for \0 termination
|
|
||||||
if (!(name.size() < (name_length - 1))) {
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << "Length of name needs to be less than " << name_length - 1
|
|
||||||
<< " chars";
|
|
||||||
throw RuntimeError(oss.str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CtbConfig::setDacName(size_t index, const std::string &name) {
|
|
||||||
|
|
||||||
check_index(index);
|
|
||||||
check_size(name);
|
|
||||||
|
|
||||||
char *dst = &dacnames[index * name_length];
|
|
||||||
memset(dst, '\0', name_length);
|
|
||||||
memcpy(dst, &name[0], name.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CtbConfig::setDacNames(const std::vector<std::string>& names){
|
|
||||||
for (size_t i = 0; i!=num_dacs; ++i){
|
|
||||||
setDacName(i, names[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CtbConfig::getDacName(size_t index) const {
|
|
||||||
return dacnames + index * name_length;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> CtbConfig::getDacNames() const {
|
|
||||||
std::vector<std::string> names;
|
|
||||||
for (size_t i = 0; i != num_dacs; ++i)
|
|
||||||
names.push_back(getDacName(i));
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* CtbConfig::shm_tag(){
|
|
||||||
return shm_tag_;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sls
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user