Compare commits

...

134 Commits

Author SHA1 Message Date
37b2efb1ed Merge pull request #1178 from slsdetectorgroup/main_910/conda_build_fix
Some checks failed
CMake / Configure and build using cmake (push) Failing after 9s
fixed conda build
2025-03-28 14:39:43 +01:00
7ac18fbad9 update cmake<=3.28 in conda build requirements 2025-03-28 14:21:56 +01:00
6839315a7c release date 2025-03-28 11:38:50 +01:00
527915a2ca fixed conda build 2025-03-28 11:37:11 +01:00
64aad1e196 Merge pull request #1143 from slsdetectorgroup/9.1.0.rc
Some checks failed
CMake / Configure and build using cmake (push) Failing after 10s
9.1.0
2025-03-26 08:38:23 +01:00
d3f847100e updated date on release notes
Some checks failed
CMake / Configure and build using cmake (push) Failing after 11s
2025-03-25 17:08:40 +01:00
e1224936ca udpate api versioning 2025-03-25 17:02:53 +01:00
f29ef9e345 Merge pull request #1165 from slsdetectorgroup/910/multirxr_proper_cleanup_on_ctrlc
910: multirxr dirty destruct leaving arping thread hanging + versioning (multi and framesync)
2025-03-25 16:54:19 +01:00
00e3b196f6 added release notes 2025-03-20 13:40:37 +01:00
0109973e68 missed to commit 2025-03-20 13:38:17 +01:00
ad995b381a multireceiverapp: changed from pointer to destruct properly (or could have used reset() before exit but kept this for consistency with slsReceiver and slsFrameSynchronizer, added --version/ -v for slsMultiReciever and slsFramesynchronizer (in 10, could be done properly, got rid of unnecessary break after an exit in multireceiverapp, removed outdated f: command line option in slsReceiver used previously for config files, updated version print out to print binary in slsReceiver version command 2025-03-20 13:33:04 +01:00
53b84b17a6 Merge pull request #1162 from slsdetectorgroup/910/fix_tests_real_g2
Some checks failed
CMake / Configure and build using cmake (push) Failing after 10s
910: fixed tests for real gotthard2. change in reg address to test
2025-03-19 17:16:19 +01:00
16d404c21b fixed tests for real gotthard2. change in reg address to test 2025-03-19 17:11:05 +01:00
34ce96ffa0 Merge pull request #1157 from slsdetectorgroup/910/jf_timing_decoder_only_hw2.0
Some checks failed
CMake / Configure and build using cmake (push) Failing after 12s
jf: get timing info decoder only for hw 2.0
2025-03-18 12:31:45 +01:00
d5fa26ef9a even get is not supported for timing info decoder for jungfrau hw v1.0. only hw v2.0 is uspported 2025-03-18 12:29:25 +01:00
77f20b4e97 updated jungfrau binary 2025-03-18 11:04:55 +01:00
a295208c12 Merge pull request #1125 from slsdetectorgroup/910/release_notes
release notes
2025-03-12 09:29:48 +01:00
36a6087e1d Update RELEASE.txt
Updated frame sync notes
2025-03-12 08:10:49 +01:00
fb406a7c6c experimental tag on frame syncrhonizer release notes 2025-03-11 15:41:21 +01:00
6e4380db43 updated 910 lib versioning dates 2025-03-11 15:25:40 +01:00
903652bb72 added back the binaries that were missing 2025-03-11 11:04:43 +01:00
1609706093 minor changes in topic 2025-03-11 10:43:39 +01:00
14d2d171bb Merged main to 9.1.0.rc, keeping 9.1.0.rc changes 2025-03-11 10:34:17 +01:00
dd8452b365 jf firmware dates updated in release notes 2025-03-11 09:40:12 +01:00
15a9fb86da Merge pull request #1140 from slsdetectorgroup/910/jf_firmware_dates
910/jf firmware dates
2025-03-11 09:36:02 +01:00
222d2b3fad updated jf binary for fwv 1.6 and 2.6 2025-03-11 09:31:05 +01:00
a57531312f jungfrau firmware dates for fw v 1.6 and fw2.6 2025-03-11 09:29:01 +01:00
85a03a1d72 removed CMakeFiles folder. mistakenly added to repo (#1136) 2025-03-10 14:26:22 +01:00
fc197ed002 changed line 66 in docs/conf.py.in to app.add_css_file(filename) (#1130)
Co-authored-by: AliceMazzoleni99 <l_mazzol_a@pc17378.psi.ch>
2025-03-06 14:41:46 +01:00
a5d242876b m3:default period set to 0, updated serverBin folder as well (#1126) 2025-03-04 16:06:46 +01:00
76ce5de89e added release notes for m3 default period 2025-03-04 15:43:45 +01:00
dbb0dbcbcd release notes 2025-03-04 15:28:09 +01:00
87d40d418e reverted servers of eiger, gotthard, gotthard2, moench and mythen3 as nothing has really changed there other than formatting 2025-03-03 15:30:35 +01:00
c82712b587 prior release notes 2025-03-03 11:40:29 +01:00
9dd1509714 formatting 2025-03-03 11:02:38 +01:00
c8290598db 910: multi ids ignored silently in config file (#1114)
* warn that the multi id is ignored in config file? or throw?

* throw and not just warn with printouts as that could be silent as well

* throw for any multi id command in the file.
2025-02-27 10:41:31 +01:00
ff6a2655a2 when creating the python bindings for Detector class, it should ignore the assignment operators (#1106) 2025-02-26 12:20:35 +01:00
7b2e6ae4ab 910: udpated help on multi module and multi command help (#1116)
* udpated help on multi module and multi command help

* fixed issues with empty lines and other syntax with docuemntation

* fixed some warningsin documentation

* some changes to documentation about command line usage

* minor
2025-02-26 11:13:59 +01:00
706f3a103c jf: removed check to allow chipv1.0 also to set comp disable time (#1117) 2025-02-24 09:38:57 +01:00
5de98b3db0 file from Anna: could be reduce print out in zmq processing when using energy threshold (#1112) 2025-02-21 12:49:18 +01:00
7494e41862 910/frame synchronizer (#1086)
* wip: draft of frame synchronizer, semaphores not done yet

* signal handler not affecting semaphore inside lambda function

* finally works with sem

* install targets cmake error fix

* reducing the number of data call backs. incoming from developer

* WIP: of synchronisation (#969)

* WIP of synchronisation

* working so far if everything goes right

* added all information into json headers

* valid json

* allow frame synchronizer to have access to static libzmq when compiling on conda (libzeromq-devel not installed by default

* upto date with multirecieverapp for invalid arguments and help

* formatting

* remove warnings

* changes to print

* removed prints

* no need for print frames to be called

* minor

* commnet

* adding json header in start callback, imagesize in data callback and formatted

* fixed sanitizer issues. 1 left for ctrl+C
- zmq_msg_t should be deleted, not freed. Same with the char arrays and semaphores.

* fixed sanitizer issues and made it more readable

* moving clearing old frames to new startacq just in case it has to process soem frames before the callback

* created a callback mutex to register the callbacks when using threads for different Receiver objects instead of child processes, remove the clean up of the frames (deleting from a signal is thread unsafe) from the siginterrupt handler, reading or  setting terminate should also be inside the mutex, pass receiver object index so that only the first one   cleans up the shared structure

---------

Co-authored-by: Felix Engelmann <felix-github@nlogn.org>
2025-02-18 11:19:00 +01:00
7607fdc9a7 910 jf : bunch id decoder and auto comp disable (#1096)
* jf wip: bunch id decoder only in pcb v2.0 check and comments

* auto comp disable the same way for both chip versions. compdisabletime also available for 1.1 now

* formatting

* fixed tests

* updated jf binary
2025-02-18 11:16:11 +01:00
1bfffb842d added documentation of order in hostname command in quick start guide, udp header format for row and column values and in command line hostname (#1098) 2025-02-18 11:12:20 +01:00
7c48ae9a49 dont usleep if no transmission delay (#1100) 2025-02-18 11:10:26 +01:00
bf82aeee8d 910/restream stop delay (#1093)
* wait a bit for post processor to process the dummy

* refactoring

* minor
2025-02-11 11:02:32 +01:00
84e83bf551 restream stop if stop called, temp solution (#1092)
* restream stop if stop called, temp solution until new command for it

* chekckrestream is ambiguous when only checking receiver

* moved restreaming in background to receiver stop instead of detector stop (was in stop before due to gui stop button access), increase to 2s time to restream in client acquire

* minor

* moved stop to module class

* fix from before
2025-02-11 09:17:25 +01:00
60ce31bb17 removed .str().c_str() (#1089) 2025-02-11 09:15:18 +01:00
2947b65e02 versioning and formatting 2025-02-04 14:25:21 +01:00
1b41e39ad1 updated client versioning (#1061) 2024-11-26 15:14:03 +01:00
64fea22c2b back to getting version for conda from tag (#1059) 2024-11-26 14:35:46 +01:00
9beaed7813 release notes 2024-11-26 11:16:33 +01:00
0aeb7e4417 9.0.0.rc (#1058)
* dev: update 2d gain plot color map (if no x and ymin/max changes or window resizing): setFixedWidth was updating for window resize, updated virtual servers for g2 and jungfrau to keep changing gain and data for every frame. the data value (#819)

* Dev/jf/fix pedestal (#821)

* jf pedestal fix: touch enable bit last

* dev: jf sync: stopping master gives idle (#824)

* jf sync mode master could return idle when stopped and so not all modules return the same value and must check for 'stopped or idle', Also must throw if any of the module gives an error

* added contains_only to sls::Result (#827)

* added variadic template for checking if a result contains only specified values

* fix for gcc4.8

* renamed to Result::contains_only

* updated condition in Detector.cpp

* stop on only the positions

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>

* dev jf: change status reg bits  (#829)

* jf: rewrite of status reg bits, waiting state includes both wati for trigger and start frame, blocking trigger only waits if its not in waiting for trigger and run busy enabled, error state connected in firmware

* dev jf: reconfigure chip when touching electron collection mode bit (#831)

* jf: if bit 14 in reg 0x5d (electron mode collection bit) is changed, configure chip if v1.1 and powered on. so touch writeregister (setbit/clearbit also calls write register in the end). replace when electroncollectionmode command introduced

* eiger required fw version to 32: fix for blocking trigger in quad (#834)

* fix warning for prev_val (variable size array) in tests (#838)

* Dev: : gui acq finished callback for different status (#850)

* fix acquisition finished status to have different status for different modules, but does not have to be error. for eg. jf sync fw (2.4.1 gives idle for master and stopped for slaves when stopping acquiistion)

* handling inconsistent fnums to be -1 in gui, so when one sets 0 (change of value) will also give an exception (#854)

* Dev: fix py virtual test  (#846)

* draft to fix virtual test when it fails

* catching errors in tests and removing sigchild ignore so servers (process in background) executing commands will not fail (pclose no child processes, if sigchld is ignored) fixed

* uncommented python loading config

* somehow killal slsReciever in second detector test fails even though no receiver running

* fixing script for virtual simlator test:fixed issue with check if process running, fixed moench tests

* formatting

* tests for jf (#835)

* execute command inside server fixed (from fix simulator tests and exec command PR) (#857)

* dev: fix server logic in checking detector idle  (#861)

* fix buggy logic in checking detector idle and an argument check

* Dev: trigger signal issues handled at acquire (#864)

* if blocking and handling sync, only master gets blocking acq, slaves get non blocking as they are first and so dont get status or error caught when slaves dont get trigger (due to not connected etc) and acq returns with slaves still in waiting status. so check status of all in blocking acq

* for all dets with sync, ensure atleast one master when starting acq

* docs updated about sync

* minor fix for test_simulator

* updating docs

* fixed doc

* added python 3.12 to the conda build variants

* documentation and examples

* formatting

* forward declare zmq_msg_t and moved include (#869)

* forward declare zmq_msg_t and moved include

* removed zmq from pkg list

* removed zmq as dependency for slsdet (#870)

* dev: moench: min exptime (#865)

* moench: remove min clock cycles for setting exptime (had been ported from jf)

* commands code generation (#871)

* commands code generation  (#803)

* commands code generation for only frames command

* fix cmake file and add Caller files

* working exptime, fully extended commands file and its variants

* start adding template commands

* add INT_CMD_VEC_ID template

* add list command, generate multiple bins, format code

* reach 208 commands using the cpp macros

* add tests for command parser

* start adding tests for commands parser

* fix typo to use commands.yaml

* add more tests for command_parser

* add all template functions (up to 218 commands)

* finish template functions and add more CmdProxy.cpp functions (250+)

* 257 commands

* 300 commands the rest are very special commands

* add special commands without generation

* separate special functions from generated c++ file

* implementing one command for put and get (buggy)

* add infer action in a separate file

* generate header for special commands from yaml

* allow only 0 or 1 for bool inputs

* group all commands in gen_commands.py

* add help to gen_commands.py

* add autocomplete bash script

* autocompletion: add support for module levels and help

* remove debugging line

* add autocompletion, help to commands, change int [0,1] to bool

* copy tests for Caller.cpp. Tests pass

* update with the new developer branch changes

* fix errors after merging (there is problems with tests)

* fixed port/stopport in yaml (intput typo), added '_caller' to the test dac and test on chip dac command in global test for cmdcaller

* undo previous test simulator debug change

* add documentation for the generated code

* reducing the comment to be replaced in length so formatting does not split into 2 lines

* removed formatting specific style of C++11 in gen_commands.py to keep with the top level clang format of the project
* regeneratign code for commands

* automation generated

* Redirect deprecated commands (#872)

* working implementation, need to fix dac

* fixed deprecation redirect for dac command

* Detector specific autocomplete (#873)

* working implementation, need to fix dac

* fixed deprecation redirect for dac command

* detector specific completion for dac

* added autocomplete using detector specific

* fixed error when autocompleting partial words

* Generate commands/fix commands (#875)

* fix vm_a, im_a etc have deg Celsius suffix, also help missing or changed in some places

* dac: require det id for all, arg0 to be printed at output, help for onchip dac and dac, onchipdac: spacing

* getscan detid and blocking trigger help

* udp_Dstlist det_id fixed, but rx_id invalid

* cmdApp in line with cmdLineApp (missing version, receiver_id, not creating det object in help action

* added set_command to differentiate between check_det_id and require_det_id (mixed up), args: -1 needs to check for at least one argument

* reordering

* reordering and checked till integer_command_hex

* fixed a lot more commands

* fix caller tests for eiger

* changes to tests after Bechir left

* changing .cmd to .cmdcall for the caller commands

* fixed tests for caller, still warning for setexptime about cast input

* autocomplete ran

* add moench test

* regenerating autocomplete and commands

* fixing other things from merge conflicts (renaming slsDetectorDefs to defs in commands.yaml)

* formatting

* added code injection to help (#876)

* updated 3 commands to have get output that can be put into put (#877)

* updated some commands to have get output that can be put into put

* fix tests for clkdiv

* adding help to free (#878)

* removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy) (#879)

* More helpful error messages for unsupported actions (#880)

* removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy)

* Added specific help for unsupported actions

* fixed a vetofile get special exception message. more specific warning for special exception message instead of no function warning

* added condition checking true in exceptions for special message

---------
Co-authored-by: Bechir Brahem <bachbrahem@gmail.com>
Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>

* Generate commands/fix det command rename (#881)

* made a link to bash autocompletion script in main folder, and replaced all references to 'det' command with 'sls_detector'

* Generate commands/fix detp detg command rename (#882)

* replacing detp with sls_Detector_put and detg with sls_detector_get

* sls_detector_not implemented, but extended message to ask user to use sls_detector_get or sls_detector_put

* autocompletion also for sls_detector or det

* Xilinx ctb (#884)

* updated registers, arm64

* compiler set to aarch64 for xilinx server

* updated RegisterDefs.h

* merge into generate branch and resolving conflicts and adding the xilinx changes to callerspecial and commands.yaml

* compiles and can print firmware version (using a different csp0 address)

* fixing other servers (gotthard, jungfrau, moench, mythen3) that it returns in case of mapping failure, xilinxctb: added that it checks type, prints proper fw version, checks kernel date, added armprocessor define to use in common places, added specifiers to supress overflow and truncation warnings

* added detector ip and mac adddress to the printout

* fixed tests and recompiled servers

* Xilinx client tests (#887)

* implemented testbus, testfpga, set/get #frames, triggers, allowed that and for connection to client, also allowed, getnumchannels, configuremac, getrunstatus, setdetectorposition with dummy values

* allowing tests for xilinx

* binaries in

* Dev/xilinx defaults and pattern (#888)

* implemented testbus, testfpga, set/get #frames, triggers, allowed that and for connection to client, also allowed, getnumchannels, configuremac, getrunstatus, setdetectorposition with dummy values

* connected kernelversion, hardwareversion, versions, framesl, triggersl, dr, timingmode, pattern (except patioctrl) thats there for altera ctb

* replaced set/get64Bit to set/getU64bit in all loadpattern.c for (ctb and m3 also)

* minor

* updated commands generation

* formatting

* moench default speed set to after init readout configuration (half speed) (#886)

* Fixed path when building as submodule

* Moench v8 (#892)

* new rct structure for moench03

* new moench data structure for offline processing

* meonch raw data and zmq process files updated to 7.0.3 version

* implemented config file for Zmq file

* raw data and zmq work with config file, but only with one file/interface

* zmq config change

* added config examples for zmq and rawdata

* pmod for 7.0.3 and 8.0.0 from previous releases

* updated pmod 8.0.1 for rh7 and rh8

* m3 fix to get kernel version properly on nios without an incorrect error msg (#898)

* moench: changed max shifts of adc clk from 240 to 200 (#900)

* Protect from getenv("HOME") returning nullptr  (#907) (#908)

* Protect from getenv("HOME") returning nullptr (e.g., in case running in systemd)

* Write proper warning in Module.cpp

Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>

* Dev/xilinx acq (#901)

* period and exptime(patternwaittime level 0)

* added new regsieterdefs and updated api version and fixedpattern reg

* autogenerate commands

* formatting

* minor

* wip resetflow, readout mode, transceiver mask, transceiver enable

* acquisition, but streaming done bit and busy (exposing + read chip to fifo) not known yet from fw

* programming fpga and device tree done

* most configuration done, need to connect configuretransceiver to client

* stuck at resetting transciever timed out

* minor

* fixed virtual, added chip busyto fifo, streaming busy, set/getnext framenumber

* configuretransceiver from client, added help in client

* make formatt and command generation

* tests for xilinx ctb works

* command generation

* dacs added and tested, power not done

* power added

* added temp_fpga

* binaries in

* ctrlreg is 0 to enable chip=fixed, high dac val = min val= fixed, power regulators in weird order=fixed, device tree could be loaded with dacs before adcs=fixed

* start works

* virtual server sends

* receiver works

* tests

* python function and enum generation, commands generatorn and autocomplete, formatting, tests

* tests fail at start(transceiver not aligned)

* tests passed

* all binaries compiled

* eiger binary in

* added --nomodule cehck for xilinx

* updated binaries

* formatting

* moench server: changed default values of adcphase for full speed from 300 to 150 and dac vipre_cds from 800 to 1280 (#922)

* client bug fix: m3 multi module bad channel file throws bad allocation when modules skipped, needed to add vectors in 2d vector of bad channel list (#920)

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>

* developer: blocking acquire stop with slave temporarily in waiting (#926)

* client: stopping a blocking acquire of multi modules checks status to catch slaves that might still be in waiting. Problem is (gotthard2 25um at least) slave is in waiting only temporarily before going go idle/stopped. So a 50ms sleep is necessary ot not throw an unnecessary error

* client: when stopping blocking acquire, wait up to 1s in 50ms increments for slave to stop waiting temporarily

* fix to rapidjson for build with gcc 14 (#929)

* Dev: m3 clkdiv0 20 (#924)

* m3: clk 0 changed from 10 to 20 (100MHz to 50MHz)

* g2: startup clk div back to 10 as in firmware but setting in software startup to 20

* m3: minor print error if clk divider > max

* G2: reconfigure chip (#927)

* changed common.c readADCFromFile to make it more general and move temperature calculation for Eiger out of this function and inside whereever it is called.
* g2 and m2: gethighvoltage was just a variable set in server, it is now moved to a get inside DAC5671 implementation (but not reading a measured value, instead what is set from a file), high voltage variable used inside DAC5671 for virtual servers
* g2: switching off hv (ifrom non zero to zero value) will wait for 10s; powering on chip reconfigures chip; powering off chip unconfigures chip; powering off chip also includes check if hv = 0, if not throw exception; chip configuration checked before acquring; at start up: hv switched off and chip powered on, so does not wait 10s to switch off hv;
* included test to check powering off chip when hv is on should throw an exception
* g2:  check if chip configured before acquiring

* nios: read hv value set from file and virtual still goes into DAC5671 for conversions to and fro dac to V, change common readadc to readparameter to generalize, make sethighvoltage into a get and set to catch errors in get as well, g2: if not at startup, remmeber hv value before setting it and after check if value was being switched off (from a non zero value) and wait 10s if it was (10s wait only for switching off from non zero and not at startup)

* developer: moench empty data callback  (#936)

* moench (feature to wait for post processing to be done in new sls_detector_acquire_zmq executable)

READOUT_ACTION_ZMQ added to action enums
sls_detector_acquire_zmq added to executables
empty data call back so that client listens to last dummy zmq packet from moench post processor
processor: remove NEWZMQ ifdefs and remove connect for zmq publisher socket

* fix to compile

* cmds generated and parsed

* dev: client: status for blocking acquire stop with slave temporarily in waiting (#944)

* acq finish call back gets status squashed with default error but before that need to wait for gotthard slaves to catch up from waiting to stopped

* bug fixes related to file saving (#931) (#946)

* fix the file path resetting issue of GUI in the case where different modules have different fpath setting.

* fix stack-buffer-overflow issue when using HDF5 HDF5DataFile::parameterDataTypes have 64bit type (i.e. STD_U64LE), the size of fill_value should be at least 8 bytes.

* change the type of fill_value to uint64_t

Co-authored-by: Z.H. Li <zhenghenge@gmail.com>

* updated documentation from martin (#948)

* Dev/xilinx ctb test (#942)

* voltage regulators only looks at dac and not at ctrl_reg

* xilinx: change dac max to 2048, setting dac ist not inverse conversion from dac to voltage anymore, but setting power is inverse, also there is max and min to power, a different min for vio and this is checked at funcs interface, not printign or converting to mv in dac for power regulators (as its conversion max and min are different)

* Use links for dacs/adc and adapt power rglt thresholds

* Remove wait for transceiver reset

* adc and dac device not used anymore and hence removed

* udp restucturing: arm has to be multiple of 16 and no byteswap in udp_gen, option to compile locally in arm architecture, memsize of the second udp memory has to be limited

---------

Co-authored-by: Martin Brückner <martin.brueckner@psi.ch>

* formatting

* dev: jungfrau HW 1.0: adc output clock phase to 120 (#952)

* jungfrau: change adc output clock phase from 180 to 120 for v1.0 boards for reliable readout of adc #2

* versioning

* formatting

* rx: moved creating fpath (if it doesnt exist) from setting file path to at the start of acquisition when creating file. This is done here so that it does not fail if fwrite is disabled anyway. Also fixed it in documentation. Changed in documentation that the default for fwrite is disabled (#957)

* added keepalive zmq socket option (after 60s of idle time, 10 probes every sec. Mainly because an issue at Max IV (#956)

* Moench mess from developer (#953)

* new moench data structure for offline processing

* Dev/zmq stream all ipv6 adn remove rx_zmqip (#958)

* enable ipv6 in zmq socket

* removed rx_zmqip API and field in gui, changed client updaterxrzip to updateclientzmqip to have the rx_hostname ip if 0. 

* updated command line for rx_zmqip to give a warning. 

* Replaced 'depreciated' to 'deprecated' everywhere

* switching from * to 0.0.0.0 works for rebinding zmq sockets

* fixed help in command line for rx_zmqip * to 0.0.0.0 and removed cmd in python

* remove publisher zmq socket ip also for moench post processing

* fixed tests

* publisher zmq ip macros to be reused

* fixed a warning about narrowing conversion from size_t to int (#963)

* fixed stop server not starting up with setup variables (#949)

* m3: fixed stop server not starting up with setup variables

* all servers except eiger fixed for virtual stop server to start up with setupDetector function called

* virtual tests work

* eiger: versions print neednt be in stop server

* jungfrau: stop server (not virtual) also needs to read config file

* ensuring master is setup for virtual and real servers

* Dev/pyctbgui merge (#960)

* added empty c extension

* added rotation to the decoding

* added color map, options and findex

* minor

* move checks to before acquisition

* added pixel map based decoder

* cleanup

* no thread creation for single thread processing

* added rotation and test to compare

* allow high and low water mark for zmq (also buffer size) for fast readouts

* removed roatation during decoding

* added Transpose to image and invert Y False to invert it

* retains the zoomed state after the first image of gui, catch and display exception if no detector connected

* moved start frame to dockable widget, removed extra frame number label, moved current measurement also to dockable widget, hide frame plot entirely when showing patternviewer

* first image dependin on which plot

* remember settings of main window size and position, dockewidget if docked, its size and posisiotn as well, then update it next time the gui is opened

* change in comment

* using c decoder for moench 04 and matterhorn

* catch exception from invalid image from decoder

* clean up

* update row and col when choosing image type, neeeded to show values

* fix for previous PR

* disable resetting colormap values
keep the range selected for every new acquisition

* fix typos + tested on virtual matterhorn

* minor print

* refactored Slow ADCs Tab

* refactored DAC tab

* refactored power supplies

* refactored signals tab

* refactored transceiver tab

* fix typo

* fix typo2

* remove commented code

* delete commented code

* delete commented code

* delete commented signals code

* remove commented code for transceiver tab

* refactor adc tab

* refactor Pattern Tab

* Refactor transceivers tab (PR#5) (#118)

* refactored transceiver tab

* remove commented code for transceiver tab

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>

* refactor adc tab (PR#6) (#119)


* refactor adc tab

* refactored Plot and Acquisition Tabs

* fix the regression issue

* restructure project files

* applying singleton and renaming tabs to services

* working install using pip

* applies singleton to tab classes and remove CI erros

* added pyzmq and pillow

* remove the singleton implementation and keep changes

* fix merge errors in mainWindow

* moved misplaced init file

* rename service to tab

* reorganize imports

* iterate over tabs

* reorder tabs

* add slowadc to the list

* saving changes (buggy)
power supply ui not showing in the gui

* split power supply tab

* fixed tests

* add hardcoded values to defines file

* fix error

* separate power supply

* fix errors for powerSuppliesTab

* split dacs

* split slow adcs

* split signals tab

* added tests for bit_utils

* add slowAdc class to defines

* split transceiver ui file

* split adc.ui

* split pattern ui file

* split plot and acquisition ui file

* added basic test for parsing bit names

* removed redundant code in read_alias_file

* fix dacs ui position

* testing for correct exception

* cmd and args at split

* group radio buttons

* fix comments from PR#1

* show legend

* added python version and dev requirements to setup.py

* fix dac issue

* moved _decoder into pkg

* added inplace build

* removed clear

* fixed dependencies

* make tests run without slsdet

* updated name of action

* define colcount

* fixed loading of alias file

* add yapf and ruff

* apply formatting

* fix E and F rules

* add more ruff rules

* change variable name

* squashing gh debugging commits and add pre-commit

* update label values to mv units

* add hook for yapf

* reconfigure yapf precommit hook

* add format and check_format to makefile

* change gh actions

* update readme

* added check_format

* WIP

* added linting in github action

* updated readme]

* add more control for color choice

* remove useless file

* fix un-updated line after refactoring Defines
BIT0_31_MASK is not found in Defines.signals

* visually improve the interface

* fix last commit

* add only selected plots for legend

* add hide legend button

* change hide legend to show legend
checkbox show legend is checked by default

* add support for saving in numpy

* solve conversations

* fix acq index offset

* fix browse button in pattern error

* fix other browse button errors

* finish tests and add usage.md

* remove buffer

* add file,numpy-like interface and tests

* remove useless .npy files

* subscriptible npz files

* remove useless files

* remove repetetive tests

* save changes

* add mode r+, add with support,remove logging

* remove offset of acqIndex between raw and numpy saving

* fix only saving last frame

* save signals of multiple devices

* add comments and move condition for clearer code

* fix bug when vieweing pattern file

* iterate over enabled and plotted plots

* add padestal substraction to transceiver and analog data

* init pedestal frames to detector.frames

* restore old exception

* add pedestal substraction for digital signals

* remove frames spinbox from plotTab

* remove comments and use str instead of Path

* avoid saving all frames

* correct exception and log error's trace

* add gui tests

* add waveform test

* add pedestal test

* refactor by using fixtures

* add tests for moench analog and pattern

* add pytest-qt to dependencies

* add save and load gui parameters

* remove nohup file

* fix old bug IndexError

* save plot type

* a

* handle canceling load, loading matterhorn pedestal for moench

* remove comparing .png files for pattern test

* save plot type

* red error on status bar when shape mismatch for loaded pedestal

* fix makefile and docstrings

* fix PRs conversation

* move code into different function

* fix wrong function names for power supply

* removed old ctbgui

* removed unnecessary files

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
Co-authored-by: Braham Bechir <braham_b@pc11979.psi.ch>
Co-authored-by: Bechir <bechir.braham@psi.ch>
Co-authored-by: Bechir <bechir.brahem420@gmail.com>

* Dev/xilinx mat update (#959)

* put back code to obtain adc and dac device indexafter loading device tree and then create folder iio_device_links and create symbolic links there according to device indices found. ln -sf operation not permitted, so folder has to be deleted and created everytime. Also refactored definitions to have all the xilinx name or detector specific stuff out of programbyArm.c

* uncommented waittransceiverreset at startup (should work now) and return of powering off chip at startup (error for transceiver alignment reset)

* updated registerdefs from firmware

* minor prints and updating names from registerdefs

* waittransceiverreset has been fixed in firmware and removing warnign for that, transceiver alignment check for powering off chip is not done in fw (giving a warning and returning ok for now)

* fixing ipchecksum (not done), removed startperiphery, allowing readout command to be allowed for xilinx when acquiring

* dont build doc for Tobi Schluter from libzmq, which uses iso-8859-1 and the umlaut cause compilation to fail on some machines (#973)

* 8.0.2 psi modules

* missed the rx_zmqip implementations in detector.h and python bindings (#975)

* rx_zmqip has been removed. Remove it also for pyctbgui (#979)

* format

* Dev/rx callbacks (#966)

* changed rxr callback signatures to all include structs
* removed datamodify call back as size can be changed in the original data call back now
* bringing some parameters (set functions) to dataProcessor class for its callback (namely udpport, quad, fliprows, totalframes, jsonheader), resulting in also removing totalframes from 2 other function signatures

* updated MultiReceiverApp to reflect the new callback signatures

* Dev/reg bit change no validate (#970)

- do not validate write reg, setbit and clearbit by default anymore
- --validate will force validation on the bitmask or entire reg
- remove return value for write reg (across server to client, but thankfully not in the Detector class)
- extend validation into writereg, setbit and clearbit for Eiger (always special)
-  need to check python (TODO)
- missed the rx_zmqip implementations in detector.h and python bindings

* sleep implemented for command line, mainly for config files for firmware developers (#982)

* change gain mode help from dynamicgain to dynamic (#988)

* fixing python version. allowing versions to execute even if no detector connected or in shared memory (#990)

* Jf: Electron collection mode (#983)

* electron collection mode for jungfrau. also removing the config chip when using register command
* collectionMode: HOLE/ELECTRON (enum)

* Dev/m3 readout speed (#985)

* added readoutspeed command to m3 (fullspeed - 10, half speed - 20, quarter speed - 40), removed reaodut pll, moved up system pll clock indices, leaving pll index in common altera code, default speed is half speed, allow only system_c0 to be set, the others can be obtained, same for clkphase, maxclkphaseshift, clkfreq. added to readoutspeedlist commands, updated help and updated tests

* updated readoutspeedlist command

* jf: timing info decoder (#987)

* timing_info_decoder command with options swissfel (default) and shine. added to python, command line generation, autocomplete, tostring, tests.

* updated jungfrau timing info decoder mask (#991)

* minor. removed warning print at startup for empty eth udp to listen to (#992)

* removed 'Caller/CALLER' from test names as there is only one command line now (#993)

* formatting

* Dev/g2 stop frame number (#980)

* get/set next frame number in G2 (firmware only has set, no get)
* firmware has issues: each stop keeps 2 frame header in fifo and the resetting frame number happens after that
* removed the option to set burstmode to burst external or continuwous internal
* needs to be revisited before 9.0.0

* formatting

* fix the command help in the command help generator for Gotthard2 about nextframenumber (#994)

* first draft at fixing nextframenumber properly with firmware (#995)

* fixing nextframenumber properly with firmware

* updated firmware to have getnextframenumber and fixed setnextframenumber to reset also the header fifo when stopping

* fix tests for gotthard2

* Dev/g2 fix next frame number (#996)

* binaries in

* formatting

* release notes

* release notes

* updating firmware dates

* release notes

* package release version and renaming server names

* updated client versioning

* updated moench fw release version

* 900/proper free (#1002)

* first draft of fixing the free function available within the class

* removed class member function freeSharedmemory for both Detector and Module; made the free function freeSharedmemory accessible to python interface; setHostname if there is already a module in shm will recreate the Detector object while freeing shm completely and keeping detsize and intitialchecks (previous commit), sethostname called from DetectorClass in virtual command to have one point of entry (previous commit), testing Module class frees shared memory using free function

* Detector class: added copy and move constructor and assignmentoperators due to explicit destructor (DetectorImpl fwd declared), DetectorImpl class: included ZmqSocket to remove destructor (should not be virtual in any case), Module class: removed explciit destructor to allow compiler generated constructor and operators

* formatting

* updated client version date

* minor fix for readme autocomplete

* setting detsize after hostname should throw also for single module for consistency (#999)

* 900/autocomplete documentation (#1003)

* fixed the gendoc to reflect the new parser, updated documentation to include info about autocomplete in the command line part, error in createing docs

* fixed list deprecated, fixed command help (to show properly on a html, fixed other help warnings

* minor indents

* 900/g2 chip configure at startup (#1008)

* g2: chip reconfigure variable not set when powering on at startup because readconfig is the one configuring the chip the first time to default chip settings

* cleaning up code

* 900/rm volatile (#1006)

* Removing volatile and replacing with atomic to ensure atomicity

* compiling header include issue

* 900/jf firmware rollback (#1010)

* jf: rolling back firmware required to v1.5 and 2.5, updated release notes, fixed a bug when updating server (when server name same as link name:throws with no message, pedestal mode check changed for the time being for loops to be 0xFF size

* compensating for jf fw bug for pedestalmode where loops should be 16 bit, but is 8 bit in fw. to be fixed in next version

* formatting

* fixed python test simulator to kill previous servers

* gui: hide 'complete image' and just show 'missing packets' when there are missing packets in that image form the receiver (#1013)

* release notes update (#1015)

* 900/detach pthreads not joining (#1017)

* detach the pthreads that are not joining else memory leak

* release notes

* removed the clean up comment, also refactored the pthread join/detach for ctb 1g

* 900/server malloc check (#1020)

* usleep in communication to actually relay the err message of memory allocation to the client (weird but test for now), function in server to handle memory allcoation issues (updates mess, ret and sendsit to the client and returns prior from function implementatin, setting fnum in client for the speicific functions that send to detector each argument separtely, they need to remember the fnum else they throw with the incorrect fnum

* server: every malloc must check if it succeeded, rearranging so that the free is clear as well (only in funcs so far)

* formatting

* fixed malloc checks in other places other than funcs.c

* bug fix return from previous commit

* pointer bug from previous commit

* formatting

* binaries in

* 900/document json ctb file format (#1027)

* docs receiver formats rewrite

* added documentation for all the receiver files, updated release notes, udpated help in commands help for timing, fixed by throwing exception for aa dividy by 0 error caused by not freeing memory (detsize) when switching between 1d and 2d detectors, removed unnecessary 'recevier up' printout, fixed dbit list 64 bit mask error in master json file (was not 64 bit before), fixed bug in reading gotthard1 data (needs to be tested)

* generating commands help and formatting, also fix help for trimen command line

* added ctb frame format documentation, added some links to some commands, added documentation about adding expat-devel in installation for rhel8 gui, fixed some indentation issues that screwed up command line help documentation

* added ctb frame format documentation

* updated documentation about zeromq-devel for <8.0.0 versions

* fixed typo in python for vb_pixbuf Jungfrau dac (#1030)

* fixed cli documentation (#1037)

* 900: legal gain values in jungfrau simulator (#1043)

* legal gain values in jungfrau simulator

* typo

* release notes

* 900/jungfrau temp control default enable (#1041)

* jungfrau: enabling temp control by default at server startup

* 900: fixed invalid arguments to slsmultireceiver (#1039)

* wasnt showing error message for invalid arguments to slsmultireceiver
* allow 0 arguments to act like an slsReceiver with start tcp port 1954 and just 1 receiver

* 9.0.0: version from file to cmake and python (#1024)

- renamed conda-recipe folder
- added a check to see if build and install folder exists in build.sh (conda recipe)
- created VERSION file that has '0.0.0'for developer but can be updated using update_version.py that takes in a version. The script checks for semantic versioning and updates VERSION file
- VERSION file also copied along with py files to slsdet in python cmakelist and build_pylib.sh (for conda), also copied in root folder for installations (for no coding purpose)
- init.py and setup.py reads this file to get the version (a bit differently to find the VERSION file)
- VERSION file read into cmake to get the version and also added to compile definition. So RELEASE removed from versionAPI.h (using SLS_DET_VERSION compile definiton instead) and also removed updateRelease script.
- conda getting project version from environment variable SLS_DET_VERSION that is set in build_pylib.sh prior.
- added 3.13 python to conda build
- anything related to ctb removed from release notes as users will always use developer
- sets 9.0.0 to VERSION file  by running update_version.py without an argument

* formatting

* finalized binaries

* updated m3 fw version (#1046)

* release notes

* fix cmake (cannot find VERSION file) when using package as subfolder as cmake_source_dir is not same anymore, add troubleshooting doc for m3 regarding loose control board for waiting status in auto timing mode, fix m3 tests to test register write (previously was read only) (#1047)

* 900: bumped pybind11 version and added setuptools on host (#1050)

* bumped pybind11 version and added setuptools on host

* updated pybind11 tarball to 2.13 and in cmakefile to get 2.13 frpm github, also updated documentation about pybind 2.13

* update release notes, doc

* updating readme

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>

* 900 cmake_source_dir (#1053)

* when package used as subdirectory (cmake-subfolder-example) it fails when python is used because the cmake_source_dir is now the one above package.

* changed cmake_current_list_dir to cmake_current_source_dir

* removing the unnecessary VERSION file installed in the root directory (from PR #1020)

* 900: pybind 2.13.6 and python 3.8 (#1054)

* changed pybind 2.13.0 to 2.13.6, kept conda at min 2.13.0

* changed min python version from 3.6 to 3.8

* 900/docs (#1056)

* minimum python is 3.8, so >=

* removed ctb frame documentation. should be in internal wiki

* updated release notes

* updated releate date

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
Co-authored-by: froejdh_e <erik.frojdh@psi.ch>
Co-authored-by: anberga <34126852+anberga@users.noreply.github.com>
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-authored-by: Z.H. Li <zhenghenge@gmail.com>
Co-authored-by: Martin Brückner <martin.brueckner@psi.ch>
Co-authored-by: Braham Bechir <braham_b@pc11979.psi.ch>
Co-authored-by: Bechir <bechir.braham@psi.ch>
Co-authored-by: Bechir <bechir.brahem420@gmail.com>
2024-11-26 11:13:45 +01:00
4880f87791 8.0.2.rc (#974)
* moench: changed max shifts of adc clk from 240 to 200 (#909)

* moench server name and version renaming

* 802/moench default speed (#910)

* moench:change default speed to half speed

* Protect from getenv("HOME") returning nullptr  (#907)

* Protect from getenv("HOME") returning nullptr (e.g., in case running in systemd)

* Write proper warning in Module.cpp

* moench: min exptime and also a firmware update required (#911)

* moench server: changed default values of adcphase for full speed from 300 to 150 and dac vipre_cds from 800 to 1280 (#921)

* client bug fix: m3 multi module bad channel file throws bad allocation when modules skipped, needed to add vectors in 2d vector of bad channel list (#919)

* 8.0.2.rc: client: blocking acquire stop with slave temporarily in waiting (#925)

* client: stopping a blocking acquire of multi modules checks status to catch slaves that might still be in waiting. Problem is (gotthard2 25um at least) slave is in waiting only temporarily before going go idle/stopped. So a 50ms sleep is necessary ot not throw an unnecessary error

* client: when stopping blocking acquire, wait up to 1s in 50ms increments for slave to stop waiting temporarily

* fix to rapidjson for build with gcc 14 (#928)

* 8.0.2.rc: m3 clkdiv0 20 (#923)

* m3: clk 0 changed from 10 to 20 (100MHz to 50MHz)

* g2: startup clk div back to 10 as in firmware but setting in software startup to 20

* 8.0.2.rc: moench empty data callback (#935)

* moench: empty data call back so that zmq sockets are still made and listened to in acquire that it waits for the dummy packet to be done

* moench zmq postprocessor: remove NEWZMQ ifdefs and remove connect for publisher socket

* changed enum from READOUT_ACTION_ZMQ to READOUT_ZMQ_ACTION for consistency

* 8.0.2.rc: client: status for blocking acquire stop with slave temporarily in waiting (#943)

* acq finish call back gets status squashed with default error but before that need to wait for gotthard slaves to catch up from waiting to stopped

* bug fixes related to file saving (#931)

* fix the file path resetting issue of GUI in the case where different modules have different fpath setting.

* fix stack-buffer-overflow issue when using HDF5 HDF5DataFile::parameterDataTypes have 64bit type (i.e. STD_U64LE), the size of fill_value should be at least 8 bytes.

* change the type of fill_value to uint64_t

* updated documentation from martin (#947)

* 802: jungfrau HW 1.0: adc output clock phase to 120  (#951)

* jungfrau: change adc output clock phase from 180 to 120 for v1.0 boards for reliable readout of adc #2

* formatting

* 802/release notes (#954)

* updated release notes

* versioning

* fixed a warning about narrowing conversion from size_t to int (#962)

* updating client versioning

* dont build doc for Tobi Schluter from libzmq, which uses iso-8859-1 and the umlaut cause compilation to fail on some machines (#972)

* updated release notes

---------

Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
Co-authored-by: Z.H. Li <zhenghenge@gmail.com>
2024-09-17 09:44:14 +02:00
97f0c1fe46 8.0.1.rc (#891)
* forward declare zmq_msg_t and moved include

* removed zmq as dependency for slsdet (#870)

* Fixed path when building as submodule

* new moench data structure for offline processing

* meonch raw data and zmq process files updated to 7.0.3 version

* implemented config file for Zmq file

* raw data and zmq work with config file, but only with one file/interface

* zmq config change

* added config examples for zmq and rawdata

* update release notes, release versions

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
Co-authored-by: froejdh_e <erik.frojdh@psi.ch>
Co-authored-by: Anna Bergamaschi <anna.bergamaschi@psi.ch>
Co-authored-by: anberga <34126852+anberga@users.noreply.github.com>
2024-01-16 15:31:25 +01:00
a86fd00e59 Merge branch 'main' into 8.0.0.rc 2023-11-13 16:38:25 +01:00
24894667b7 release fw for ctb 2023-11-13 16:03:52 +01:00
4b414bfddb release notes 2023-11-12 15:39:58 +01:00
15d357d9ab release notes 2023-11-12 15:32:28 +01:00
f95de054f9 formatting 2023-11-12 15:29:34 +01:00
0aef8113dd documentation and examples 2023-11-12 15:11:36 +01:00
9785a41048 Merge branch '8.0.0.rc' of github.com:slsdetectorgroup/slsDetectorPackage into 8.0.0.rc 2023-11-10 17:29:47 +01:00
417e1a88a5 fixed doc 2023-11-10 17:29:35 +01:00
9c0dd0385d updating docs 2023-11-10 16:02:21 +01:00
5ab64efe3e added python 3.12 to the conda build variants 2023-11-10 14:18:38 +01:00
8f77e4d4fe added python 3.12 to the conda build variants 2023-11-10 14:17:40 +01:00
41c5b75b10 trigger signal issues handled at acquire (#862)
* if blocking and handling sync, only master gets blocking acq, slaves get non blocking as they are first and so dont get status or error caught when slaves dont get trigger (due to not connected etc) and acq returns with slaves still in waiting status. so check status of all in blocking acq

* for all dets with sync, ensure atleast one master when starting acq

* docs updated about sync
2023-11-10 11:24:18 +01:00
bfe53c6693 udpated release notes 2023-11-09 15:10:17 +01:00
f7997dd09a 8.0.0.rc: fix server logic in checking detector idle (#860)
* fix buggy logic in checking detector idle and an argument check
2023-11-09 15:07:03 +01:00
c64e87a2b6 7.0.3.rc: fix server logic in checking detector idle (#859)
* fix buggy logic in checking detector idle and an argument check
2023-11-09 14:21:11 +01:00
5eeb8e29c1 project version change 2023-11-08 17:31:29 +01:00
09697fa325 updated release notes 2023-11-08 17:30:07 +01:00
90b4daef39 updated release notes 2023-11-08 17:28:48 +01:00
2082f1eee7 updated release notes 2023-11-08 17:28:17 +01:00
d3a636b563 updated release notes 2023-11-08 17:24:56 +01:00
50b9b6ca39 update release notes 2023-11-08 14:14:04 +01:00
e86b57cdfc versioning, format, release notes, update test simulator (no need for psutil) 2023-11-08 12:12:17 +01:00
14e11e8b5b formatting and versioning 2023-11-08 11:43:09 +01:00
beafe86554 execute command inside server fixed (from fix simulator tests and exec command PR) (#856) 2023-11-08 09:26:00 +01:00
af3dc1e7f4 7.0.3.rc: execute command inside server fixed (from fix simulator tests and exec command PR) (#855)
* execute command inside server fixed (from fix simulator tests and exec command PR)
2023-11-08 09:25:52 +01:00
573177203b formatting 2023-11-07 14:51:15 +01:00
a3ca9ebce5 updating release notes 2023-11-07 14:35:42 +01:00
8174fc9691 Update RELEASE.txt 2023-11-07 12:34:10 +01:00
d6eac6da71 updated release notes 2023-11-07 11:22:09 +01:00
56c7ae4852 8.0.0.rc: fix py virtual test (#841)
* fix virtual test when it fails

* catching errors in tests and removing sigchild ignore so servers (process in background) executing commands will not fail (pclose no child processes, if sigchld is ignored) fixed

* uncommented python loading config

* somehow killal slsReciever in second detector test fails even though no receiver running

* fixing script for virtual simlator test:fixed issue with check if process running, fixed moench tests
2023-11-07 09:30:24 +01:00
9b9b09ceaf 703rc/tests/fix execute command (#842)
* fix execute command
* fix for tests for ctb
2023-11-07 09:29:48 +01:00
cfebaee2a5 handling inconsistent fnums to be -1 in gui, so when one sets 0 (change of value) will also give an exception (#853) 2023-11-06 16:11:40 +01:00
4613c54f57 handling inconsistent fnums to be -1 in gui, so when one sets 0 (change of value) will also give an exception (#852) 2023-11-06 16:11:25 +01:00
51f9d6f011 8.0.0rc: : gui acq finished callback for different status (#851)
* fix acquisition finished status to have different status for different modules, but does not have to be error. for eg. jf sync fw (2.4.1 gives idle for master and stopped for slaves when stopping acquiistion)
2023-11-06 16:08:23 +01:00
58ac7ac280 7.0.3.rc: gui acq finished callback for different status (#847)
* fix acquisition finished status to have different status for different modules, but does not have to be error. for eg. jf sync fw (2.4.1 gives idle for master and stopped for slaves when stopping acquiistion)
2023-11-06 16:07:38 +01:00
82edfa75d3 7.0.3.rc: process the raw data files as a list (#848)
* Added file list option for moenchRawDataProcess
2023-11-03 12:10:20 +01:00
35ed926047 formatting 2023-10-25 09:36:51 +02:00
4023ed0775 updated versioning 2023-10-25 09:36:04 +02:00
b6ef3bc39e updated release notest 2023-10-25 09:15:10 +02:00
2035666792 versioning and binaries updated 2023-10-25 08:43:23 +02:00
1ff4d806e7 minor 2023-10-25 08:25:02 +02:00
3861379653 updated release notes 2023-10-24 17:39:47 +02:00
91140bbb71 formatting 2023-10-24 11:17:18 +02:00
a5632fcbea fix warning for prev_val (variable size array) in tests (#837) 2023-10-23 15:55:13 +02:00
d44329117d fix warning for prev_val (variable size array) in tests (#836) 2023-10-23 15:52:59 +02:00
4a454aa698 tests for jf (#835) 2023-10-19 16:55:29 +02:00
0e43072db8 eiger required fw version to 32: fix for blocking trigger in quad (#833) 2023-10-18 17:04:26 +02:00
6c67025ea8 7.0.3.rc eiger: fw version to 32 (quad blocking trigger) (#832)
* eiger required fw version to 32: fix for blocking trigger in quad
2023-10-18 16:51:17 +02:00
e5ee27dbfa 8.0.0.rc jf: reconfigure chip when touching electron collection mode bit (#830)
* jf: if bit 14 in reg 0x5d (electron mode collection bit) is changed, configure chip if v1.1 and powered on. so touch writeregister (setbit/clearbit also calls write register in the end). replace when electroncollectionmode command introduced
2023-10-18 10:49:44 +02:00
601249cc71 8.0.0.rc jf: change status reg bits (#828)
* rewrite of status reg bits, waiting state includes both wati for trigger and start frame, blocking trigger only waits if its not in waiting for trigger and run busy enabled, error state connected in firmware
2023-10-18 10:36:56 +02:00
ff60b8c379 8.0.0.rc: jf sync: stopping master gives idle (#823)
* jf sync mode master could return idle when stopped and so not all modules return the same value and must check for 'stopped or idle', Also must throw if any of the module gives an error

* added contains_only to sls::Result (#827)

* added variadic template for checking if a result contains only specified values

* fix for gcc4.8

* renamed to Result::contains_only

* stop on only the positions

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2023-10-13 15:25:19 +02:00
37ce3d6f59 7.0.3.rc: jf sync: stopping master gives idle (#822)
* jf sync mode master could return idle when stopped and so not all modules return the same value and must check for 'stopped or idle', Also must throw if any of the module gives an error ( not jungfrau, but eiger could)

* added contains_only to sls::Result (#827)

* added variadic template for checking if a result contains only specified values

* fix for gcc4.8

* renamed to Result::contains_only

* stop on only the positions

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2023-10-13 12:27:43 +02:00
bf26533fd8 8.0.0.rc: jf fix pedestal (#820)
* jf pedestal fix: touch enable bit last
2023-10-05 10:28:51 +02:00
7106273521 update 2d gain plot (if no x and ymin/max changes or window resizing): setFixedWidth was updating for window resize, updated virtual servers for g2 and jungfrau to keep changing gain and data for every frame (#817) 2023-10-03 17:22:14 +02:00
1484d038de 7.03.rc: update 2d gain plot color map (if no x and ymin/max changes or window resizing): setFixedWidth was updating for window resize, updated virtual servers for g2 and jungfrau to keep changing gain and data for every frame. the data value (#818) 2023-10-03 17:22:03 +02:00
fb0090c79e removing the misleading word 'Simulating' when programmig fpga (#814) 2023-09-28 16:20:59 +02:00
adc68cd519 formatting 2023-09-28 15:51:40 +02:00
1566eef247 703rc/fix numeric limits (#812)
* fixed compilation for fedora for numeric_limits

* formatting
2023-09-28 10:49:02 +02:00
e7cd90db78 fixed crashing of moench03RawDataProcess when nframes>0 (#810) 2023-09-27 09:22:40 +02:00
45414149fe binaries in for the previous PR 2023-09-22 15:59:35 +02:00
48759f440e 703rc/fix port size (#802)
* validate port numbers in client

* validate port numbers created at virtual servers and receiver process as tcp ports
2023-09-18 08:59:53 +02:00
b367b7e431 fixed some interpolation issues (#796) 2023-08-28 13:38:19 +02:00
f0b2a6f6f9 update release notes 2023-08-25 14:02:50 +02:00
f761046bfc updated docs and versions 2023-07-12 16:50:13 +02:00
1a859b83db formatting 2023-07-12 16:06:31 +02:00
70bfc875a6 updating release notes 2023-07-11 17:02:27 +02:00
c0755308a4 updating release notes 2023-07-11 17:01:14 +02:00
ab5509e10c updating release notes 2023-07-11 17:00:42 +02:00
004cb26646 updated firmware versions for 7.0.2 2023-07-10 12:21:19 +02:00
a4f47a5945 synced master status running when setting to slave (#747)
* jf: unsync before setting master/slave and then sync (if it was set) to overcome master going into running state when making it a slave and synced

* add tests for this condition

* updated release notes, updated min fw version requirement for v1.0 boards
2023-05-25 11:04:05 +02:00
312f3f473d fix that only master starts second and not all (for start acq), typo with pos and masters list (#743) 2023-05-11 10:20:17 +02:00
5871086cd6 formatting 2023-05-08 17:04:04 +02:00
6a0fe823b3 enable fix g0 when in expert mode (when gain mode enabled and not just visible) (#736) 2023-05-08 14:20:21 +02:00
5912aae53e Rx roi zmq (#726)
adding rx_roi also in the zmq header for external guis to put the "yellow box".. sending full roi instead of -1, and sending for each zmq port. "(multiple yellow boxes)".
2023-05-08 12:23:05 +02:00
8833ccf5cc 7.0.2.rc (#721)
* row and column for jungfrau mixed up

* multi module jungfrau sync must do slaves first then master for start acquisition and send software trigger, and master first and then slaves for stopacquisition

* non blocking to slaves first and only then blocking/nonblocking to the master for sending software trigger(jungfrau multi mod sync)

* fixed get/set timing jungfrau when sync enabled, getsync during blocking acquire (for trigger or stop) will get stuck as it should ask the stop server

* switching between 1 and 2 interfaces did not set gui/client zmq port properly. Resulted in dummy streaming forever. fixed

* formatting, refactoring: const & for positions, multi mod M3 stop first master first

* adding missing cstdint for gcc 13

* Refactoring handle sync out, handling synchronization also for softwaretrigger for m3, for start/sync/stop for g2/g1

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
2023-05-08 12:11:19 +02:00
77c558a7be formatting 2023-03-24 12:54:55 +01:00
378fc301b8 updating client version, release version and project_version in CMakeLists.txt 2023-03-23 15:43:17 +01:00
87d6e16090 7.0.1 fix det server version (#702)
* check server version before initial checks, catch old server version exception, get old server version as 64 bit and print it along with exception
2023-03-23 15:37:01 +01:00
2ef021041c rx_arping sigchld (#701)
* rx_arping pclose gave -1 due to sigchld being ignored, fixed with sig handler doing a wait
2023-03-23 13:58:40 +01:00
574127b5ac fix hdf5 compilation using det spec fields in header (#700)
* fix hdf5 compilation using det spec fields in header
2023-03-23 12:30:38 +01:00
72 changed files with 1108 additions and 228 deletions

View File

@ -1 +0,0 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file

View File

@ -249,8 +249,8 @@ endif()
if(SLS_USE_SANITIZER)
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
#target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread -fno-omit-frame-pointer)
#target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
endif()

View File

@ -1,21 +1,15 @@
SLS Detector Package Major Release x.x.x released on xx.xx.202x
SLS Detector Package Minor Release 9.1.0 released on 28.03.2025
===============================================================
This document describes the differences between vx.x.x and vx.0.2
This document describes the differences between v9.1.0 and v9.0.0
CONTENTS
--------
1 New, Changed or Resolved Features
1.1 Compilation
1.2 Callback
1.3 Python
1.4 Client
1.5 Detector Server
1.6 Simulator
1.7 Receiver
1.8 Gui
1 Changes
1.1 New or Changed Features
1.2 Resolved Features
2 On-board Detector Server Compatibility
3 Firmware Requirements
4 Kernel Requirements
@ -24,11 +18,131 @@ This document describes the differences between vx.x.x and vx.0.2
1 New, Changed or Resolved Features
=====================================
1 Changes
==========
1.1 New or Changed Features
============================
Receiver
--------
* Frame Synchronizer (experimental)
Added a new binary, similar to slsMultiReceiver, to collect images from
several receivers and stream them out as a ZMQ multipart message
(one part for each UDP port). No reconstuction of the image. Includeds start
and end ZMQ messages as well for the start and end callback parameters.
Documentation
-------------
* Command line - multi module and multi detector indices
Help on this topic has been added to the 'Command line' topic.
* Row and column index (UDP header or callback)
Help on how this is determined from the hostname is added to the 'UDP
Header' and the 'Quick Start Guide' topics. Also added to the help in '
hostname' command line help. Please note that this can be overwritten by
corresponding row and column commands.
1.2 Resolved Features
======================
Firmware
---------
* [Jungfrau] Column select and filter resistor
Configuration fix for chip v1.1 for these parameters
Firmware &/ On-board Detector Server
------------------------------------
* [Jungfrau] Timing Info Decoder
Only allowed for hardware v2.0 now.
* [Jungfrau] Auto Comparator Disable - chip v1.0
Previously, this mode for chip v1.0 automatically disabled the on-chip
gain switching compatator after a fixed portion of the exposure time.
Now, one must set also the comparator disable time using 'compdisabletime'
just as in chip v1.1.
* [Mythen3] Default period on server start up is 0 now.
Client
-------
* Command line - Multi detector index inside file
Multi detector index '[index]-' was ignored silently in the config/parameter
file since 5.0.0. Now, it will throw an exception. Please use the multi
detector index on the 'config' or 'parameter' command instead.
* [Mythen3] patternX command autocompletes the argument to a path now.
Receiver
--------
* Multiple Receiver objects in multiple threads
slsMultiReceiver uses child processes, but if user rewrote to use multiple
receiver objects in multiple threads instead, a callback mutex is now
implemented to handle the locking mechanism between threads for the callbacks.
* Removed potentially unsafe str().c_str() calls.
* slsMultiReceiver Ctrl + C
Now cleans up properly upon Ctrl + C, including exiting the Arping thread.
* slsMultiReceiver version
--version or -v now gives the version of slsMultiReceiver.
ZMQ
---
* [Moench] Reduced significant print out in zmq processing using energy
threshold.
* [Moench] Zmq dummy packet restreaming command did nothing
Temporary solution was to move from 'stop' to 'rx_stop' as 'stop' did not
go further if module is idle.
* [Moench] Too many Zmq dummy packets- unclear end in acquire
Give time to process dummy packet before restreaming it and wait more
before restreaming to reduce amoutn of zmq dummy packets to process.
Simulators
-----------
* [Jungfrau][Moench] Slightly faster transmistting time by removing sleeping
only if there is a transmission delay
2 On-board Detector Server Compatibility
@ -36,8 +150,8 @@ This document describes the differences between vx.x.x and vx.0.2
Eiger 9.0.0
Jungfrau 9.0.0
Mythen3 9.0.0
Jungfrau 9.1.0
Mythen3 9.1.0
Gotthard2 9.0.0
Gotthard 9.0.0
Moench 9.0.0
@ -66,14 +180,14 @@ This document describes the differences between vx.x.x and vx.0.2
Eiger 02.10.2023 (v32) (updated in 7.0.3)
Jungfrau 20.09.2023 (v1.5, HW v1.0) (updated in 8.0.0)
21.09.2023 (v2.5, HW v2.0) (updated in 8.0.0)
Jungfrau 09.02.2025 (v1.6, HW v1.0) (updated in 9.1.0)
08.02.2025 (v2.6, HW v2.0) (updated in 9.1.0)
Mythen3 11.10.2024 (v1.5) (updated in 9.0.0)
Mythen3 13.11.2024 (v2.0) (updated in 9.0.0)
Gotthard2 03.10.2024 (v1.0) (updated in 9.0.0)
Moench 26.10.2023 (v2.0) (updated in 9.0.0)
Moench 26.10.2023 (v2.0) (updated in 8.0.2)
Gotthard 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave)

View File

@ -1 +1 @@
0.0.0
9.1.0

View File

@ -6,3 +6,9 @@ python:
- 3.12
- 3.13
c_stdlib:
- sysroot # [linux]
c_stdlib_version: # [linux]
- 2.17 # [linux]

View File

@ -15,35 +15,18 @@ build:
requirements:
build:
- {{ compiler('c') }}
- {{stdlib('c')}}
- {{compiler('cxx')}}
- cmake
- cmake<=3.28
- ninja
- qt 5.*
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-libegl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
- expat
host:
- libstdcxx-ng
- libgcc-ng
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
- expat
- libgl-devel
- libtiff
- zlib
run:
- libstdcxx-ng
@ -123,3 +106,4 @@ outputs:
run:
- {{ pin_subpackage('slsdetlib', exact=True) }}
- expat

View File

@ -63,4 +63,4 @@ html_static_path = ['static']
def setup(app):
app.add_stylesheet('css/extra.css') # may also be an URL
app.add_css_file('css/extra.css') # may also be an URL

View File

@ -4,11 +4,54 @@ Command line interface
Usage
-------------
Commands can be used either with sls_detector_get or sls_detector_put
The syntax is *'[detector index]-[module index]:[command]'*, where the indices are by default '0', when not specified.
Module index
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modules are indexed based on their order in the hostname command. They are used to configure a specific module within a detector and are followed by a ':' in syntax.
.. code-block::
# Applies to all modules of detector 0
sls_detector_put exptime 5s
# Applies to only the 4th module
sls_detector_put 3:exptime 5s
Detector index
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This index is useful when configuring multiple detectors from a single host. Each detector uses a unique shared memory identified by a detector index, derived again from the hostname command. It is followed by a '-'.
.. code-block::
# For detector with index 2 in shared memory
sls_detector_put 2-hostname bchip133+bchip123+bchip456
# Without '-', the detector index defaults to 0
sls_detector_put hostname bchip133+bchip123+bchip456
# Accessing all modules with detector index 2
sls_detector_put 2-exptime
# Starting acquisition only for detector with index 2
sls_detector_put 2-start
# Applies only to the 2nd detector, 4th module
sls_detector_put 1-3:exptime 5s
Command Execution
^^^^^^^^^^^^^^^^^^^^^^^
Commands can be executed using:
* **sls_detector_put**: setting values
* **sls_detector_get**: getting values
* **sls_detector**: automatically infers based on the number of arguments.
* **sls_detector_help**: gets help on the specific command
* **sls_detector_acquire**: initiates acquisition with the detector. This command blocks until the entire acquisition process is completed.
.. code-block::
sls_detector_get exptime
Help
--------
@ -28,12 +71,15 @@ Help
# list of deprecated commands
list deprecated
# autocompletion
# bash_autocomplete.sh or zsh_autocomplete.sh must be sourced from the
# main package folder to enable auto completion of commands and arguments
# for the command line on that shell.
source bash_autocomplete.sh
Autocompletion
---------------
bash_autocomplete.sh or zsh_autocomplete.sh must be sourced from the main package folder to enable auto completion of commands and arguments for the command line on that shell.
.. code-block::
source bash_autocomplete.sh
Commands

View File

@ -13,7 +13,6 @@ containing results from all modules. (:ref:`Result class<Result Class>`)
Here are some :ref:`examples <Cplusplus Api Examples>` on how to use the API.
.. _Cplusplus Api Examples:
.. doxygenclass:: sls::Detector
:members:
:undoc-members:

View File

@ -39,7 +39,7 @@ Welcome to slsDetectorPackage's documentation!
.. toctree::
:caption: Command line
:maxdepth: 2
:maxdepth: 1
commandline
quick_start_guide

View File

@ -1,5 +1,6 @@
.. _master file attributes:
Master File Attributes
=======================

View File

@ -128,6 +128,10 @@ For Multiple Modules
# set file path
fpath /tmp
.. note ::
The **hostname** and **detsize** command in a multi module system can affect the row and column values in the udp/zmq header. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on.
Gui
----

View File

@ -39,13 +39,13 @@ Arguments
.. _Automatic start servers:
Automatic start
------------------
One can start the on-board detector server automatically upon powering on the board.
#. Create a soft link to the binary on board
:
#. Create a soft link to the binary on board:
.. code-block:: bash
ln -sf someDetectorServervx.x.x someDetectorServer
@ -87,8 +87,7 @@ One can start the on-board detector server automatically upon powering on the bo
/root/xxxDetectorServer >> /dev/null &
#. Sync, reboot and verify
:
#. Sync, reboot and verify:
.. code-block:: bash
sync

View File

@ -73,9 +73,9 @@ Description
* **modId**: module ID picked up from det_id_[detector type].txt on the detector cpu.
* **row**: row position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command.
* **row**: row position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on.
* **column**: column position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command.
* **column**: column position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on.
* **detType**: detector type from enum of detectorType in the package.

View File

@ -0,0 +1,19 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
# Script to get combined zmq packets from frame synchronizer using pull zmq sockets
import json
import zmq
c = zmq.Context()
s = c.socket(zmq.PULL)
s.connect("tcp://127.0.0.1:5555")
while True:
m = s.recv_multipart()
for p in m:
if p.startswith(b"{"):
print(p.decode().strip())
else:
print("binary")
print("--------")

View File

@ -123,6 +123,9 @@ def visit(node):
if node.kind == cindex.CursorKind.CLASS_DECL:
if node.displayname == "Detector":
for child in node.get_children():
# Skip assignment operators
if child.kind == cindex.CursorKind.CXX_METHOD and child.spelling == "operator=":
continue
if (
child.kind == cindex.CursorKind.CXX_METHOD
and child.access_specifier == cindex.AccessSpecifier.PUBLIC

View File

@ -152,6 +152,10 @@ class Detector(CppDetectorApi):
"""Frees shared memory and sets hostname (or IP address) of all modules concatenated by +
Virtual servers can already use the port in hostname separated by ':' and ports incremented by 2 to accomodate the stop server as well.
Note
-----
The row and column values in the udp/zmq header are affected by the order in this command and the detsize command. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on. This only affects row and column in udp/zmq header.
Example
-------
>>> d.hostname = 'beb031+beb032+'
@ -2566,7 +2570,7 @@ class Detector(CppDetectorApi):
Note
-----
By default, the on-chip gain switching is active during the entire exposure. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us). The % is only for chipv1.0, the duration can be set for chipv1.1.\n
By default, the on-chip gain switching is active during the entire exposure. This mode disables the on-chip gain switching comparator automatically and the duration is set using compdisabletime.\n
Default is 0 or this mode disabled (comparator enabled throughout). 1 enables mode. 0 disables mode.
"""
return self.getAutoComparatorDisable()
@ -2580,10 +2584,6 @@ class Detector(CppDetectorApi):
def compdisabletime(self):
"""[Jungfrau] Time before end of exposure when comparator is disabled.
Note
-----
It is only possible for chipv1.1.
:getter: always returns in seconds. To get in DurationWrapper, use getComparatorDisableTime
Example
@ -2913,7 +2913,7 @@ class Detector(CppDetectorApi):
@property
@element
def timing_info_decoder(self):
"""[Jungfrau] [Jungfrau] Advanced Command and only for SWISSFEL and SHINE. Sets the bunch id or timing info decoder. Default is SWISSFEL.
"""[Jungfrau] [Jungfrau] Advanced Command and only for SWISSFEL and SHINE. Sets the bunch id or timing info decoder. Default is SWISSFEL. Only allowed for pcbv2.0.
Enum: timingInfoDecoder
"""
return self.getTimingInfoDecoder()

View File

@ -1 +0,0 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv9.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv9.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv9.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv9.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv9.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv9.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv9.1.0

View File

@ -0,0 +1 @@
../slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServerv9.1.0

View File

@ -503,6 +503,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
}
#endif
if (ee == PHOTON && val[iy * nx + ix] == max) {
good = 1;
ee = PHOTON_MAX;
// cout << "**" <<id<< " " << iframe << " " << nDark << " "
// << ix << " " << iy << " " << rms << " " << max << " " <<
@ -536,7 +537,6 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
cout << max << " " << val[iy * nx + ix] << endl;
}
//else (clusters + nph)->print();
good = 1;
if (eMin > 0 && tot < eMin)
good = 0;
if (eMax > 0 && tot > eMax)

View File

@ -1974,9 +1974,6 @@ int autoCompDisable(int on) {
}
int setComparatorDisableTime(int64_t val) {
if (getChipVersion() != 11) {
return FAIL;
}
if (val < 0) {
LOG(logERROR,
("Invalid comp disable time: %lld ns\n", (long long int)val));
@ -2817,6 +2814,7 @@ void *start_timer(void *arg) {
getNextFrameNumber(&frameNr);
int iRxEntry = firstDest;
for (int iframes = 0; iframes != numFrames; ++iframes) {
if (transmissionDelayUs)
usleep(transmissionDelayUs);
// check if manual stop

View File

@ -5,8 +5,8 @@
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x230920 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x230921 // 2.0 pcb (version = 011)
#define REQRD_FRMWRE_VRSN_BOARD2 0x250209 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x250208 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \

View File

@ -1927,6 +1927,7 @@ void *start_timer(void *arg) {
getNextFrameNumber(&frameNr);
int iRxEntry = firstDest;
for (int iframes = 0; iframes != numFrames; ++iframes) {
if (transmissionDelayUs)
usleep(transmissionDelayUs);
// check if manual stop

View File

@ -50,7 +50,7 @@
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
#define DEFAULT_GATE_DELAY (0)
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
#define DEFAULT_PERIOD (0) // ns
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)

View File

@ -9090,16 +9090,9 @@ int get_comp_disable_time(int file_des) {
functionNotImplemented();
#else
// get only
if (getChipVersion() != 11) {
ret = FAIL;
strcpy(mess,
"Cannot get comparator disable time. Only valid for chipv1.1\n");
LOG(logERROR, (mess));
} else {
retval = getComparatorDisableTime();
LOG(logDEBUG1,
("retval comp disable time %lld ns\n", (long long int)retval));
}
#endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
}
@ -9117,16 +9110,10 @@ int set_comp_disable_time(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
if (getChipVersion() != 11) {
ret = FAIL;
strcpy(mess, "Cannot get comparator disable time. Only valid for "
"chipv1.1\n");
LOG(logERROR, (mess));
} else {
ret = setComparatorDisableTime(arg);
int64_t retval = getComparatorDisableTime();
LOG(logDEBUG1, ("retval get comp disable time %lld ns\n",
(long long int)retval));
LOG(logDEBUG1,
("retval get comp disable time %lld ns\n", (long long int)retval));
if (ret == FAIL) {
sprintf(mess,
"Could not set comp disable time. Set %lld ns, read "
@ -9135,7 +9122,6 @@ int set_comp_disable_time(int file_des) {
LOG(logERROR, (mess));
}
}
}
#endif
return Server_SendResult(file_des, INT64, NULL, 0);
}
@ -11104,12 +11090,19 @@ int get_timing_info_decoder(int file_des) {
functionNotImplemented();
#else
// get only
if (isHardwareVersion_1_0()) {
ret = FAIL;
sprintf(mess, "Could not get timing info decoder. Not supported "
"for hardware version 1.0\n");
LOG(logERROR, (mess));
} else {
ret = getTimingInfoDecoder(&retval);
LOG(logDEBUG1, ("retval timing info decoder: %d\n", retval));
if (ret == FAIL) {
strcpy(mess, "Could not get timing info decoder\n");
LOG(logERROR, (mess));
}
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
@ -11136,6 +11129,12 @@ int set_timing_info_decoder(int file_des) {
modeNotImplemented("Timing info decoder index", (int)arg);
break;
}
if (ret == OK && isHardwareVersion_1_0()) {
ret = FAIL;
sprintf(mess, "Could not set timing info decoder. Not supported "
"for hardware version 1.0\n");
LOG(logERROR, (mess));
}
if (ret == OK) {
ret = setTimingInfoDecoder(arg);
if (ret == FAIL) {

View File

@ -468,7 +468,7 @@ subdeadtime:
function: setSubDeadTime
compdisabletime:
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of exposure when comparator is disabled. It is only possible for chipv1.1."
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of exposure when comparator is disabled."
inherit_actions: TIME_COMMAND
actions:
GET:
@ -1123,7 +1123,7 @@ temp_control:
input_types: [ bool ]
autocompdisable:
help: "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically after 93.75% (only for chipv1.0) of exposure time (only for longer than 100us). It is possible to set the duration for chipv1.1 using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. "
help: "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically and the duration is set using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. "
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@ -1210,7 +1210,7 @@ polarity:
input_types: [ defs::polarity ]
timing_info_decoder:
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel."
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed for pcbv2.0."
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@ -3429,7 +3429,7 @@ udp_dstlist:
output: [ ToString(args) ]
txdelay:
help: "[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided.Sets up \n\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 *num_modules * n_delay)\n\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay) for every module."
help: "[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided.Sets up \n\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 * num_modules * n_delay)\n\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay) for every module."
actions:
GET:
argc: 0

View File

@ -762,10 +762,9 @@ autocompdisable:
function_alias: autocompdisable
help: "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the on-chip\
\ gain switching is active during the entire exposure.This mode disables the on\
\ - chip gain switching comparator automatically after 93.75% (only for chipv1.0)\
\ of exposure time (only for longer than 100us). It is possible to set the duration\
\ for chipv1.1 using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator\
\ enabled throughout). 1 enables mode. 0 disables mode. "
\ - chip gain switching comparator automatically and the duration is set using\
\ compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled\
\ throughout). 1 enables mode. 0 disables mode. "
infer_action: true
template: true
badchannels:
@ -1607,7 +1606,7 @@ compdisabletime:
command_name: compdisabletime
function_alias: compdisabletime
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of\
\ exposure when comparator is disabled. It is only possible for chipv1.1."
\ exposure when comparator is disabled."
infer_action: true
template: true
confadc:
@ -11488,7 +11487,8 @@ timing_info_decoder:
command_name: timing_info_decoder
function_alias: timing_info_decoder
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and\
\ Shine. Sets the bunch id or timing info decoder. Default is swissfel."
\ Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed\
\ for pcbv2.0."
infer_action: true
template: true
timinglist:
@ -11915,7 +11915,7 @@ txdelay:
help: "[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for\
\ all modules in the detector using the step size provided.Sets up \n\t[Eiger]\
\ txdelay_left to (2 * mod_index * n_delay), \n\t[Eiger] txdelay_right to ((2\
\ * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 *num_modules\
\ * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 * num_modules\
\ * n_delay)\n\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay)\
\ for every module."
infer_action: true

View File

@ -65,7 +65,12 @@ class Detector {
Result<std::string> getHostname(Positions pos = {}) const;
/**Frees shared memory, adds detectors to the list. */
/**Frees shared memory, adds detectors to the list. The row and column
* values in the udp/zmq header are affected by the order in this command
* and the setDetectorSize function. The modules are stacked row by row
* until they reach the y-axis limit set by detsize (if specified). Then,
* stacking continues in the next column and so on. This only affects row
* and column in udp/zmq header.*/
void setHostname(const std::vector<std::string> &hostname);
/** connects to n servers at local host starting at specific control port.
@ -1304,11 +1309,9 @@ class Detector {
* //TODO naming
* By default, the on-chip gain switching is active during the
* entire exposure. This mode disables the on-chip gain switching comparator
* automatically after 93.75% of exposure time (only for longer than 100us).
* The % is for chipv1.0. One can set the duration for chipv1.1 using
* setComparatorDisableTime\n Default is false or this mode
* disabled(comparator enabled throughout). true enables mode. 0 disables
* mode.
* automatically and the duration is set using setComparatorDisableTime\n
* Default is false or this mode disabled(comparator enabled throughout).
* true enables mode. 0 disables mode.
*/
void setAutoComparatorDisable(bool value, Positions pos = {});
@ -1316,7 +1319,7 @@ class Detector {
Result<ns> getComparatorDisableTime(Positions pos = {}) const;
/** [Jungfrau] Time before end of exposure when comparator is
* disabled. It is only possible for chipv1.1.*/
* disabled.*/
void setComparatorDisableTime(ns t, Positions pos = {});
/** [Jungfrau] Advanced TODO naming */
@ -1382,7 +1385,7 @@ class Detector {
Result<defs::timingInfoDecoder>
getTimingInfoDecoder(Positions pos = {}) const;
/** [Jungfrau] Advanced Command! */
/** [Jungfrau] Advanced Command! Only for pcb v2.0 */
void setTimingInfoDecoder(defs::timingInfoDecoder value,
Positions pos = {});

View File

@ -1018,7 +1018,7 @@ std::string Caller::autocompdisable(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([0, 1]
[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically after 93.75% (only for chipv1.0) of exposure time (only for longer than 100us). It is possible to set the duration for chipv1.1 using compdisabletime command.
[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically and the duration is set using compdisabletime command.
Default is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. )V0G0N"
<< std::endl;
return os.str();
@ -2108,7 +2108,7 @@ std::string Caller::compdisabletime(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s]
[Jungfrau] Time before end of exposure when comparator is disabled. It is only possible for chipv1.1. )V0G0N"
[Jungfrau] Time before end of exposure when comparator is disabled. )V0G0N"
<< std::endl;
return os.str();
}
@ -14744,7 +14744,7 @@ std::string Caller::timing_info_decoder(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([swissfel|shine]
[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. )V0G0N"
[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed for pcbv2.0. )V0G0N"
<< std::endl;
return os.str();
}
@ -15365,7 +15365,7 @@ std::string Caller::txdelay(int action) {
[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided.Sets up
[Eiger] txdelay_left to (2 * mod_index * n_delay),
[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and
[Eiger] txdelay_frame to (2 *num_modules * n_delay)
[Eiger] txdelay_frame to (2 * num_modules * n_delay)
[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay) for every module. )V0G0N"
<< std::endl;
return os.str();

View File

@ -210,7 +210,12 @@ std::string Caller::hostname(int action) {
os << "\n\tFrees shared memory and sets hostname (or IP address) of "
"all modules concatenated by +.\n\t Virtual servers can already "
"use the port in hostname separated by ':' and ports incremented "
"by 2 to accomodate the stop server as well."
"by 2 to accomodate the stop server as well. The row and column "
"values in the udp/zmq header are affected by the order in this "
"command and the detsize command. The modules are stacked row by "
"row until they reach the y-axis limit set by detsize (if "
"specified). Then, stacking continues in the next column and so "
"on. This only affects row and column in udp/zmq header."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {

View File

@ -99,6 +99,12 @@ void Detector::loadParameters(const std::vector<std::string> &parameters) {
CmdParser parser;
for (const auto &current_line : parameters) {
parser.Parse(current_line);
if (parser.multi_id() != 0) {
throw RuntimeError(
"Multi-detector indices [" + std::to_string(parser.multi_id()) +
"] are not allowed in the file. Instead, use the index for "
"'config' or 'parameters' command?");
}
caller.call(parser.command(), parser.arguments(), parser.detector_id(),
defs::PUT_ACTION, std::cout, parser.receiver_id());
}

View File

@ -1177,9 +1177,19 @@ int DetectorImpl::acquire() {
if (dataReady == nullptr) {
setJoinThreadFlag(true);
} else if (receiver) {
// wait for postprocessor to process dummies
if (dataReady != nullptr) {
// process dummy from stop receier
if (numZmqRunning != 0)
std::this_thread::sleep_for(std::chrono::milliseconds(200));
while (numZmqRunning != 0) {
Parallel(&Module::restreamStopFromReceiver, {});
// time to process restream dummy
std::this_thread::sleep_for(std::chrono::milliseconds(200));
// increase time for fewer dummies and to catch up
if (numZmqRunning != 0)
std::this_thread::sleep_for(std::chrono::seconds(2));
}
}
}
dataProcessingThread.join();

View File

@ -905,8 +905,13 @@ void Module::startReceiver() {
}
void Module::stopReceiver() {
auto rxStatusPrior = getReceiverStatus();
sendToReceiver(F_STOP_RECEIVER, static_cast<int>(shm()->stoppedFlag),
nullptr);
if (rxStatusPrior == IDLE && getReceiverStreaming()) {
restreamStopFromReceiver();
}
}
void Module::startAcquisition() {
@ -920,26 +925,8 @@ void Module::startReadout() {
}
void Module::stopAcquisition() {
// get det status before stopping acq
runStatus detStatus = ERROR;
try {
detStatus = getRunStatus();
} catch (...) {
}
sendToDetectorStop(F_STOP_ACQUISITION);
shm()->stoppedFlag = true;
// restream dummy header, if rxr streaming and det idle before stop
try {
if (shm()->useReceiverFlag && getReceiverStreaming()) {
if (detStatus == IDLE && getReceiverStatus() == IDLE) {
restreamStopFromReceiver();
}
}
} catch (...) {
}
}
void Module::restreamStopFromReceiver() {

View File

@ -262,8 +262,7 @@ TEST_CASE("compdisabletime", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU &&
det.getChipVersion().squash() * 10 == 11) {
if (det_type == defs::JUNGFRAU) {
auto prev_val = det.getComparatorDisableTime();
{
std::ostringstream oss;
@ -670,7 +669,8 @@ TEST_CASE("pedestalmode", "[.cmdcall]") {
TEST_CASE("timing_info_decoder", "[.cmdcall]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::JUNGFRAU) {
if (det.getDetectorType().squash() == defs::JUNGFRAU &&
det.getHardwareVersion().squash() == "2.0") {
auto prev_val = det.getTimingInfoDecoder();
/*{
std::ostringstream oss;

View File

@ -3323,7 +3323,7 @@ TEST_CASE("reg", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);
@ -3379,7 +3379,7 @@ TEST_CASE("setbit", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);
@ -3409,7 +3409,7 @@ TEST_CASE("clearbit", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);
@ -3439,7 +3439,7 @@ TEST_CASE("getbit", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);

View File

@ -138,13 +138,34 @@ if (SLS_USE_RECEIVER_BINARIES)
slsProjectWarnings
)
install(TARGETS slsReceiver slsMultiReceiver
add_executable(slsFrameSynchronizer
src/FrameSynchronizerApp.cpp
)
set_target_properties(slsFrameSynchronizer PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
set_property(TARGET slsFrameSynchronizer PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
target_link_libraries(slsFrameSynchronizer
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
"$<BUILD_INTERFACE:libzmq-static>"
)
install(TARGETS slsReceiver slsMultiReceiver slsFrameSynchronizer
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sls
)
)
endif(SLS_USE_RECEIVER_BINARIES)

View File

@ -33,6 +33,8 @@ using Interface = ServerInterface;
#define gettid() syscall(SYS_gettid)
#endif
std::mutex ClientInterface::callbackMutex;
ClientInterface::~ClientInterface() {
killTcpThread = true;
LOG(logINFO) << "Shutting down TCP Socket on port " << portNumber;
@ -55,12 +57,14 @@ std::string ClientInterface::getReceiverVersion() { return APIRECEIVER; }
/***callback functions***/
void ClientInterface::registerCallBackStartAcquisition(
int (*func)(const startCallbackHeader, void *), void *arg) {
std::lock_guard<std::mutex> lock(callbackMutex);
startAcquisitionCallBack = func;
pStartAcquisition = arg;
}
void ClientInterface::registerCallBackAcquisitionFinished(
void (*func)(const endCallbackHeader, void *), void *arg) {
std::lock_guard<std::mutex> lock(callbackMutex);
acquisitionFinishedCallBack = func;
pAcquisitionFinished = arg;
}
@ -69,6 +73,7 @@ void ClientInterface::registerCallBackRawDataReady(
void (*func)(sls_receiver_header &, dataCallbackHeader, char *, size_t &,
void *),
void *arg) {
std::lock_guard<std::mutex> lock(callbackMutex);
rawDataReadyCallBack = func;
pRawDataReady = arg;
}
@ -461,15 +466,18 @@ void ClientInterface::setDetectorType(detectorType arg) {
std::string(e.what()) + ']');
}
// callbacks after (in setdetectortype, the object is reinitialized)
{
std::lock_guard<std::mutex> lock(callbackMutex);
if (startAcquisitionCallBack != nullptr)
impl()->registerCallBackStartAcquisition(startAcquisitionCallBack,
pStartAcquisition);
if (acquisitionFinishedCallBack != nullptr)
impl()->registerCallBackAcquisitionFinished(acquisitionFinishedCallBack,
pAcquisitionFinished);
impl()->registerCallBackAcquisitionFinished(
acquisitionFinishedCallBack, pAcquisitionFinished);
if (rawDataReadyCallBack != nullptr)
impl()->registerCallBackRawDataReady(rawDataReadyCallBack,
pRawDataReady);
}
impl()->setThreadIds(parentThreadId, tcpThreadId);
}

View File

@ -194,6 +194,8 @@ class ClientInterface : private virtual slsDetectorDefs {
pid_t tcpThreadId{0};
std::vector<std::string> udpips =
std::vector<std::string>(MAX_NUMBER_OF_LISTENING_THREADS);
// necessary if Receiver objects using threads with callbacks
static std::mutex callbackMutex;
};
} // namespace sls

View File

@ -0,0 +1,635 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/* Creates the slsFrameSynchronizer for running multiple receivers in different
* threads form a single binary that will spit out zmq streams without
* reconstructing image. Sample python script for pull socket for this combiner
* in python/scripts folder. TODO: Not handling empty frames from one socket
*/
#include "sls/Receiver.h"
#include "sls/ToString.h"
#include "sls/container_utils.h"
#include "sls/logger.h"
#include "sls/sls_detector_defs.h"
#include "sls/versionAPI.h"
#include <csignal> //SIGINT
#include <cstdio>
#include <cstring>
#include <iostream>
#include <mutex>
#include <ostream>
#include <semaphore.h>
#include <sys/socket.h>
#include <sys/wait.h> //wait
#include <thread>
#include <unistd.h>
#include <set>
#include <vector>
#include <zmq.h>
std::vector<std::thread> threads;
std::vector<sem_t *> semaphores;
sls::TLogLevel printHeadersLevel = sls::logDEBUG;
/** Define Colors to print data call back in different colors for different
* recievers */
#define PRINT_IN_COLOR(c, f, ...) \
printf("\033[%dm" f RESET, 30 + c + 1, ##__VA_ARGS__)
/** Structure handling different threads */
using ZmqMsgList = std::vector<zmq_msg_t *>;
using FrameMap = std::map<uint64_t, ZmqMsgList>;
using PortFrameMap = std::map<uint16_t, FrameMap>;
struct FrameStatus {
bool starting = true;
bool terminate = false;
int num_receivers;
sem_t available;
std::mutex mtx;
ZmqMsgList headers;
PortFrameMap frames;
ZmqMsgList ends;
FrameStatus(bool start, bool term, int num_recv)
: starting(start), terminate(term), num_receivers(num_recv) {
sem_init(&available, 0, 0);
}
};
FrameStatus *global_frame_status = nullptr;
/**
* Control+C Interrupt Handler
* to let all the processes know to exit properly
*/
void sigInterruptHandler(int p) {
for (size_t i = 0; i != semaphores.size(); ++i) {
sem_post(semaphores[i]);
}
}
void cleanup() {
if (global_frame_status) {
std::lock_guard<std::mutex> lock(global_frame_status->mtx);
for (auto &outer_pair : global_frame_status->frames) {
for (auto &inner_pair : outer_pair.second) {
for (zmq_msg_t *msg : inner_pair.second) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
inner_pair.second.clear();
}
outer_pair.second.clear();
}
global_frame_status->frames.clear();
}
}
/**
* prints usage of this example program
*/
std::string getHelpMessage() {
std::ostringstream os;
os << "\nUsage:\n"
<< "./slsFrameSynchronizer --version or -v\n"
<< "\t - Gets the slsFrameSynchronizer version\n\n"
<< "./slsFrameSynchronizer [start tcp port] [num recevers] [print "
"callback headers (optional)]\n"
<< "\t - tcp port has to be non-zero and 16 bit\n"
<< "\t - print callback headers option is 0 (disabled) by default\n";
return os.str();
}
void zmq_free(void *data, void *hint) { delete[] static_cast<char *>(data); }
void print_frames(const PortFrameMap &frame_port_map) {
LOG(sls::logDEBUG) << "Printing frames";
for (const auto &it : frame_port_map) {
uint16_t udpPort = it.first;
const auto &frame_map = it.second;
LOG(sls::logDEBUG) << "UDP port: " << udpPort;
for (const auto &frame : frame_map) {
uint64_t fnum = frame.first;
const auto &msg_list = frame.second;
LOG(sls::logDEBUG)
<< " acq index: " << fnum << '[' << msg_list.size() << ']';
}
}
}
/** Valid frame numbers mean they exist across all ports or
* has at least a larger fnum in the port with the missing fnum **/
std::set<uint64_t> get_valid_fnums(const PortFrameMap &port_frame_map) {
// empty list
std::set<uint64_t> valid_fnums;
if (port_frame_map.empty()) {
return valid_fnums;
}
// collect all unique frame numbers from all ports
std::set<uint64_t> unique_fnums;
for (auto it = port_frame_map.begin(); it != port_frame_map.begin(); ++it) {
const FrameMap &frame_map = it->second;
for (auto frame = frame_map.begin(); frame != frame_map.end();
++frame) {
unique_fnums.insert(frame->first);
}
}
// collect valid frame numbers
for (auto &fnum : unique_fnums) {
bool is_valid = true;
for (auto it = port_frame_map.begin(); it != port_frame_map.end();
++it) {
uint16_t port = it->first;
const FrameMap &frame_map = it->second;
auto frame = frame_map.find(fnum);
// invalid: fnum missing in one port
if (frame == frame_map.end()) {
LOG(sls::logDEBUG)
<< "Fnum " << fnum << " is missing in port " << port;
// invalid: fnum greater than all in that port
auto last_frame = std::prev(frame_map.end());
auto last_fnum = last_frame->first;
if (fnum > last_fnum) {
LOG(sls::logDEBUG) << "And no larger fnum found. Fnum "
<< fnum << " is invalid.\n";
is_valid = false;
break;
}
}
}
if (is_valid) {
valid_fnums.insert(fnum);
}
}
return valid_fnums;
}
int zmq_send_multipart(void *socket, const ZmqMsgList &messages) {
size_t num_messages = messages.size();
for (size_t i = 0; i != num_messages; ++i) {
zmq_msg_t *msg = messages[i];
// determine flags: ZMQ_SNDMORE for all messages except the last
int flags = (i == num_messages - 1) ? 0 : ZMQ_SNDMORE;
if (zmq_msg_send(msg, socket, flags) == -1) {
LOG(sls::logERROR)
<< "Error sending message: " << zmq_strerror(zmq_errno());
return slsDetectorDefs::FAIL;
}
}
return slsDetectorDefs::OK;
}
void Correlate(FrameStatus *stat) {
void *context = zmq_ctx_new();
void *socket = zmq_socket(context, ZMQ_PUSH);
int rc = zmq_bind(socket, "tcp://*:5555");
if (rc != 0) {
LOG(sls::logERROR) << "failed to bind";
}
while (true) {
sem_wait(&(stat->available));
{
std::lock_guard<std::mutex> lock(stat->mtx);
if (stat->terminate) {
break;
}
if (stat->starting) {
// sending all start packets
if (static_cast<int>(stat->headers.size()) ==
stat->num_receivers) {
stat->starting = false;
// clean up
zmq_send_multipart(socket, stat->headers);
for (zmq_msg_t *msg : stat->headers) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
stat->headers.clear();
}
} else {
// print_frames(stat->frames);
auto valid_fnums = get_valid_fnums(stat->frames);
// sending all valid fnum data packets
for (const auto &fnum : valid_fnums) {
ZmqMsgList msg_list;
PortFrameMap &port_frame_map = stat->frames;
for (auto it = port_frame_map.begin();
it != port_frame_map.end(); ++it) {
uint16_t port = it->first;
const FrameMap &frame_map = it->second;
auto frame = frame_map.find(fnum);
if (frame != frame_map.end()) {
msg_list.insert(msg_list.end(),
stat->frames[port][fnum].begin(),
stat->frames[port][fnum].end());
// clean up
for (zmq_msg_t *msg : stat->frames[port][fnum]) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
stat->frames[port].erase(fnum);
}
}
LOG(printHeadersLevel)
<< "Sending data packets for fnum " << fnum;
zmq_send_multipart(socket, msg_list);
}
}
// sending all end packets
if (static_cast<int>(stat->ends.size()) == stat->num_receivers) {
zmq_send_multipart(socket, stat->ends);
// clean up
for (zmq_msg_t *msg : stat->ends) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
stat->ends.clear();
}
}
}
zmq_close(socket);
zmq_ctx_destroy(context);
}
int StartAcquisitionCallback(
const slsDetectorDefs::startCallbackHeader callbackHeader,
void *objectPointer) {
LOG(printHeadersLevel)
<< "Start Acquisition:"
<< "\n\t["
<< "\n\tUDP Port : " << sls::ToString(callbackHeader.udpPort)
<< "\n\tDynamic Range : " << callbackHeader.dynamicRange
<< "\n\tDetector Shape : "
<< sls::ToString(callbackHeader.detectorShape)
<< "\n\tImage Size : " << callbackHeader.imageSize
<< "\n\tFile Path : " << callbackHeader.filePath
<< "\n\tFile Name : " << callbackHeader.fileName
<< "\n\tFile Index : " << callbackHeader.fileIndex
<< "\n\tQuad Enable : " << callbackHeader.quad
<< "\n\tAdditional Json Header : "
<< sls::ToString(callbackHeader.addJsonHeader).c_str() << "\n\t]";
std::ostringstream oss;
oss << "{\"htype\":\"header\""
<< ", \"udpPorts\":" << sls::ToString(callbackHeader.udpPort)
<< ", \"bitmode\":" << callbackHeader.dynamicRange
<< ", \"filePath\":\"" << callbackHeader.filePath
<< "\", \"fileName\":\"" << callbackHeader.fileName
<< "\", \"fileIndex\":" << callbackHeader.fileIndex
<< ", \"detshape\":" << sls::ToString(callbackHeader.detectorShape)
<< ", \"size\":" << callbackHeader.imageSize
<< ", \"quad\":" << (callbackHeader.quad ? 1 : 0);
if (!callbackHeader.addJsonHeader.empty()) {
oss << ", \"addJsonHeader\": {";
for (auto it = callbackHeader.addJsonHeader.begin();
it != callbackHeader.addJsonHeader.end(); ++it) {
if (it != callbackHeader.addJsonHeader.begin()) {
oss << ", ";
}
oss << "\"" << it->first.c_str() << "\":\"" << it->second.c_str()
<< "\"";
}
oss << " } ";
}
oss << "}\n";
std::string message = oss.str();
LOG(sls::logDEBUG) << "Start Acquisition message:" << std::endl << message;
int length = message.length();
char *hdata = new char[length];
memcpy(hdata, message.c_str(), length);
zmq_msg_t *hmsg = new zmq_msg_t;
zmq_msg_init_data(hmsg, hdata, length, zmq_free, NULL);
// push zmq msg into stat to be processed
FrameStatus *stat = static_cast<FrameStatus *>(objectPointer);
{
std::lock_guard<std::mutex> lock(stat->mtx);
stat->headers.push_back(hmsg);
stat->starting = true;
// clean up old frames
for (int port : callbackHeader.udpPort) {
for (auto &frame_map : stat->frames[port]) {
for (zmq_msg_t *msg : frame_map.second) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
frame_map.second.clear();
}
stat->frames[port].clear();
}
}
sem_post(&stat->available);
return slsDetectorDefs::OK; // TODO: change return to void
}
void AcquisitionFinishedCallback(
const slsDetectorDefs::endCallbackHeader callbackHeader,
void *objectPointer) {
LOG(printHeadersLevel) << "Acquisition Finished:"
<< "\n\t["
<< "\n\tUDP Port : "
<< sls::ToString(callbackHeader.udpPort)
<< "\n\tComplete Frames : "
<< sls::ToString(callbackHeader.completeFrames)
<< "\n\tLast Frame Index : "
<< sls::ToString(callbackHeader.lastFrameIndex)
<< "\n\t]";
std::ostringstream oss;
oss << "{\"htype\":\"series_end\""
<< ", \"udpPorts\":" << sls::ToString(callbackHeader.udpPort)
<< ", \"comleteFrames\":"
<< sls::ToString(callbackHeader.completeFrames)
<< ", \"lastFrameIndex\":"
<< sls::ToString(callbackHeader.lastFrameIndex) << "}\n";
std::string message = oss.str();
int length = message.length();
LOG(sls::logDEBUG) << "Acquisition Finished message:" << std::endl
<< message;
char *hdata = new char[length];
memcpy(hdata, message.c_str(), length);
zmq_msg_t *hmsg = new zmq_msg_t;
zmq_msg_init_data(hmsg, hdata, length, zmq_free, NULL);
// push zmq msg into stat to be processed
FrameStatus *stat = static_cast<FrameStatus *>(objectPointer);
{
std::lock_guard<std::mutex> lock(stat->mtx);
stat->ends.push_back(hmsg);
}
sem_post(&stat->available);
}
void GetDataCallback(slsDetectorDefs::sls_receiver_header &header,
slsDetectorDefs::dataCallbackHeader callbackHeader,
char *dataPointer, size_t &imageSize,
void *objectPointer) {
slsDetectorDefs::sls_detector_header detectorHeader = header.detHeader;
if (printHeadersLevel < sls::logDEBUG) {
// print in different color for each udp port
PRINT_IN_COLOR((callbackHeader.udpPort % 10),
"Data: "
"\n\tCallback Header: "
"\n\t["
"\n\tUDP Port: %u"
"\n\tShape: [%u, %u]"
"\n\tAcq Index : %lu"
"\n\tFrame Index :%lu"
"\n\tProgress : %.2f%%"
"\n\tComplete Image :%s"
"\n\tFlip Rows :%s"
"\n\tAdditional Json Header : %s"
"\n\t]"
"\n\ttReceiver Header: "
"\n\t["
"\n\tFrame Number : %lu"
"\n\tExposure Length :%u"
"\n\tPackets Caught :%u"
"\n\tDetector Specific 1: %lu"
"\n\tTimestamp : %lu"
"\n\tModule Id :%u"
"\n\tRow : %u"
"\n\tColumn :%u"
"\n\tDetector Specific 2 : %u"
"\n\tDetector Specific 3 : %u"
"\n\tDetector Specific 4 : %u"
"\n\tDetector Type : %s"
"\n\tVersion: %u"
"\n\t]"
"\n\tFirst Byte Data: 0x%x"
"\n\tImage Size: %zu\n\n",
callbackHeader.udpPort, callbackHeader.shape.x,
callbackHeader.shape.y, callbackHeader.acqIndex,
callbackHeader.frameIndex, callbackHeader.progress,
sls::ToString(callbackHeader.completeImage).c_str(),
sls::ToString(callbackHeader.flipRows).c_str(),
sls::ToString(callbackHeader.addJsonHeader).c_str(),
detectorHeader.frameNumber, detectorHeader.expLength,
detectorHeader.packetNumber, detectorHeader.detSpec1,
detectorHeader.timestamp, detectorHeader.modId,
detectorHeader.row, detectorHeader.column,
detectorHeader.detSpec2, detectorHeader.detSpec3,
detectorHeader.detSpec4,
sls::ToString(detectorHeader.detType).c_str(),
detectorHeader.version,
// header->packetsMask.to_string().c_str(),
((uint8_t)(*((uint8_t *)(dataPointer)))), imageSize);
}
std::ostringstream oss;
oss << "{\"htype\":\"module\""
<< ", \"port\":" << callbackHeader.udpPort
<< ", \"shape\":" << sls::ToString(callbackHeader.shape)
<< ", \"acqIndex\":" << callbackHeader.acqIndex
<< ", \"frameIndex\":" << callbackHeader.frameIndex
<< ", \"flipRows\":" << (callbackHeader.flipRows ? 1 : 0)
<< ", \"progress\":" << callbackHeader.progress
<< ", \"completeImage\":" << (callbackHeader.completeImage ? 1 : 0)
<< ", \"imageSize\":" << imageSize
<< ", \"frameNumber\":" << detectorHeader.frameNumber
<< ", \"expLength\":" << detectorHeader.expLength
<< ", \"packetNumber\":" << detectorHeader.packetNumber
<< ", \"detSpec1\":" << detectorHeader.detSpec1
<< ", \"timestamp\":" << detectorHeader.timestamp
<< ", \"modId\":" << detectorHeader.modId
<< ", \"row\":" << detectorHeader.row
<< ", \"column\":" << detectorHeader.column
<< ", \"detSpec2\":" << detectorHeader.detSpec2
<< ", \"detSpec3\":" << detectorHeader.detSpec3
<< ", \"detSpec4\":" << detectorHeader.detSpec4
<< ", \"detType\":" << static_cast<int>(detectorHeader.detType)
<< ", \"version\":" << static_cast<int>(detectorHeader.version);
if (!callbackHeader.addJsonHeader.empty()) {
oss << ", \"addJsonHeader\": {";
for (auto it = callbackHeader.addJsonHeader.begin();
it != callbackHeader.addJsonHeader.end(); ++it) {
if (it != callbackHeader.addJsonHeader.begin()) {
oss << ", ";
}
oss << "\"" << it->first.c_str() << "\":\"" << it->second.c_str()
<< "\"";
}
oss << " } ";
}
oss << "}\n";
std::string message = oss.str();
LOG(sls::logDEBUG) << "Data message:" << std::endl << message;
// creating header part of data packet
int length = message.length();
char *hdata = new char[length];
memcpy(hdata, message.c_str(), length);
zmq_msg_t *hmsg = new zmq_msg_t;
zmq_msg_init_data(hmsg, hdata, length, zmq_free, NULL);
// created data part of data packet
char *data = new char[imageSize];
zmq_msg_t *msg = new zmq_msg_t;
zmq_msg_init_data(msg, data, imageSize, zmq_free, NULL);
// push both parts into stat to be processed
FrameStatus *stat = static_cast<FrameStatus *>(objectPointer);
{
std::lock_guard<std::mutex> lock(stat->mtx);
stat->frames[callbackHeader.udpPort][header.detHeader.frameNumber]
.push_back(hmsg);
stat->frames[callbackHeader.udpPort][header.detHeader.frameNumber]
.push_back(msg);
}
sem_post(&stat->available);
}
/**
* Example of main program using the Receiver class
*
* - Defines in file for:
* - Default Number of receivers is 1
* - Default Start TCP port is 1954
*/
int main(int argc, char *argv[]) {
// version
if (argc == 2) {
std::string sargv1 = std::string(argv[1]);
if (sargv1 == "--version" || sargv1 == "-v") {
std::cout << "slsFrameSynchronizer Version: " << APIRECEIVER
<< std::endl;
exit(EXIT_SUCCESS);
}
}
/** - set default values */
int numReceivers = 1;
uint16_t startTCPPort = DEFAULT_TCP_RX_PORTNO;
bool printHeaders = false;
/** - get number of receivers and start tcp port from command line
* arguments */
if (argc > 1) {
try {
if (argc == 3 || argc == 4) {
startTCPPort = sls::StringTo<uint16_t>(argv[1]);
if (startTCPPort == 0) {
throw std::runtime_error("Invalid start tcp port");
}
numReceivers = std::stoi(argv[2]);
if (numReceivers > 1024) {
cprintf(RED,
"Did you mix up the order of the arguments?\n%s\n",
getHelpMessage().c_str());
return EXIT_FAILURE;
}
if (numReceivers == 0) {
cprintf(RED, "Invalid number of receivers.\n%s\n",
getHelpMessage().c_str());
return EXIT_FAILURE;
}
if (argc == 4) {
printHeaders = sls::StringTo<bool>(argv[3]);
if (printHeaders) {
printHeadersLevel = sls::logINFOBLUE;
}
}
} else
throw std::runtime_error("Invalid number of arguments");
} catch (const std::exception &e) {
cprintf(RED, "Error: %s\n%s\n", e.what(), getHelpMessage().c_str());
return EXIT_FAILURE;
}
}
cprintf(RESET, "Number of Receivers: %d\n", numReceivers);
cprintf(RESET, "Start TCP Port: %hu\n", startTCPPort);
cprintf(RESET, "Print Callback Headers: %s\n\n",
(printHeaders ? "Enabled" : "Disabled"));
/** - Catch signal SIGINT to close files and call destructors properly */
struct sigaction sa;
sa.sa_flags = 0; // no flags
sa.sa_handler = sigInterruptHandler; // handler function
sigemptyset(&sa.sa_mask); // dont block additional signals during invocation
// of handler
if (sigaction(SIGINT, &sa, nullptr) == -1) {
cprintf(RED, "Could not set handler function for SIGINT\n");
}
/** - Ignore SIG_PIPE, prevents global signal handler, handle locally,
instead of a server crashing due to client crash when writing, it just
gives error */
struct sigaction asa;
asa.sa_flags = 0; // no flags
asa.sa_handler = SIG_IGN; // handler function
sigemptyset(&asa.sa_mask); // dont block additional signals during
// invocation of handler
if (sigaction(SIGPIPE, &asa, nullptr) == -1) {
cprintf(RED, "Could not set handler function for SIGPIPE\n");
}
FrameStatus stat{true, false, numReceivers};
// store pointer for signal handler
global_frame_status = &stat;
// thread synchronizing all packets
void *user_data = static_cast<void *>(&stat);
std::thread combinerThread(Correlate, &stat);
for (int i = 0; i != numReceivers; ++i) {
sem_t *semaphore = new sem_t;
sem_init(semaphore, 1, 0);
semaphores.push_back(semaphore);
uint16_t port = startTCPPort + i;
threads.emplace_back([i, semaphore, port, user_data]() {
sls::Receiver receiver(port);
receiver.registerCallBackStartAcquisition(StartAcquisitionCallback,
user_data);
receiver.registerCallBackAcquisitionFinished(
AcquisitionFinishedCallback, user_data);
receiver.registerCallBackRawDataReady(GetDataCallback, user_data);
/** - as long as no Ctrl+C */
sem_wait(semaphore);
sem_destroy(semaphore);
delete semaphore;
// clean up frames
if (i == 0)
cleanup();
});
}
for (auto &thread : threads) {
thread.join();
}
{
std::lock_guard<std::mutex> lock(stat.mtx);
stat.terminate = true;
sem_post(&stat.available);
}
combinerThread.join();
sem_destroy(&stat.available);
LOG(sls::logINFOBLUE) << "Goodbye!";
return EXIT_SUCCESS;
}

View File

@ -149,12 +149,12 @@ void Listener::CreateUDPSocket(int &actualSize) {
packetSize = generalData->vetoPacketSize;
}
std::string ip =
(eth.length() ? InterfaceNameToIp(eth).str().c_str() : "");
std::string ip;
if (eth.length() > 0)
ip = InterfaceNameToIp(eth).str();
udpSocket = nullptr;
udpSocket = make_unique<UdpRxSocket>(
udpPortNumber, packetSize, (ip.length() ? ip.c_str() : nullptr),
udpPortNumber, packetSize, (ip.empty() ? nullptr : ip.c_str()),
generalData->udpSocketBufferSize);
LOG(logINFO) << index << ": UDP port opened at port " << udpPortNumber
<< " (" << (ip.length() ? ip : "any") << ')';
@ -213,9 +213,12 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s, int &actualSize) {
try {
// to allowe ports to be bound from udpsocket
udpSocket.reset();
UdpRxSocket g(
udpPortNumber, packetSize,
(eth.length() ? InterfaceNameToIp(eth).str().c_str() : nullptr),
std::string ip;
if (eth.length() > 0)
ip = InterfaceNameToIp(eth).str();
UdpRxSocket g(udpPortNumber, packetSize,
(ip.empty() ? nullptr : ip.c_str()),
generalData->udpSocketBufferSize);
// doubled due to kernel bookkeeping (could also be less due to

View File

@ -7,6 +7,7 @@
#include "sls/container_utils.h"
#include "sls/logger.h"
#include "sls/sls_detector_defs.h"
#include "sls/versionAPI.h"
#include <csignal> //SIGINT
#include <cstring>
@ -39,7 +40,9 @@ void sigInterruptHandler(int p) { sem_post(&semaphore); }
*/
std::string getHelpMessage() {
std::ostringstream os;
os << "\nUsage:\n"
os << "\nUsage:\n\n"
<< "./slsMultiReceiver --version or -v\n"
<< "\t - Gets the slsMultiReceiver version\n\n"
<< "./slsMultiReceiver [start tcp port] [num recevers] [call back "
"option (optional)]\n"
<< "\t - tcp port has to be non-zero and 16 bit\n"
@ -160,6 +163,16 @@ void GetData(slsDetectorDefs::sls_receiver_header &header,
*/
int main(int argc, char *argv[]) {
// version
if (argc == 2) {
std::string sargv1 = std::string(argv[1]);
if (sargv1 == "--version" || sargv1 == "-v") {
std::cout << "slsMultiReceiver Version: " << APIRECEIVER
<< std::endl;
exit(EXIT_SUCCESS);
}
}
/** - set default values */
int numReceivers = 1;
uint16_t startTCPPort = DEFAULT_TCP_RX_PORTNO;
@ -242,40 +255,43 @@ int main(int argc, char *argv[]) {
else if (pid == 0) {
cprintf(BLUE, "Child process %d [ Tid: %ld ]\n", i, (long)gettid());
std::unique_ptr<sls::Receiver> receiver = nullptr;
try {
receiver = sls::make_unique<sls::Receiver>(startTCPPort + i);
} catch (...) {
LOG(sls::logINFOBLUE)
<< "Exiting Child Process [ Tid: " << gettid() << " ]";
throw;
}
/** - register callbacks. remember to set file write enable to 0
* (using the client) if we should not write files and you will
* write data using the callbacks */
uint16_t port = startTCPPort + i;
sls::Receiver receiver(port);
/** - register callbacks. remember to set file write enable
* to 0 (using the client) if we should not write files and you
* will write data using the callbacks */
if (withCallback) {
/** - Call back for start acquisition */
cprintf(BLUE, "Registering StartAcq()\n");
receiver->registerCallBackStartAcquisition(StartAcq, nullptr);
receiver.registerCallBackStartAcquisition(StartAcq,
nullptr);
/** - Call back for acquisition finished */
cprintf(BLUE, "Registering AcquisitionFinished()\n");
receiver->registerCallBackAcquisitionFinished(
receiver.registerCallBackAcquisitionFinished(
AcquisitionFinished, nullptr);
/* - Call back for raw data */
cprintf(BLUE, "Registering GetData() \n");
receiver->registerCallBackRawDataReady(GetData, nullptr);
receiver.registerCallBackRawDataReady(GetData, nullptr);
}
/** - as long as no Ctrl+C */
sem_wait(&semaphore);
sem_destroy(&semaphore);
} catch (...) {
LOG(sls::logINFOBLUE)
<< "Exiting Child Process [ Tid: " << gettid() << " ]";
throw;
}
cprintf(BLUE, "Exiting Child Process [ Tid: %ld ]\n",
(long)gettid());
exit(EXIT_SUCCESS);
break;
}
}

View File

@ -62,7 +62,7 @@ Receiver::Receiver(int argc, char *argv[]) : tcpipInterface(nullptr) {
"\t started with privileges. \n\n";
while (c != -1) {
c = getopt_long(argc, argv, "hvf:t:u:", long_options, &option_index);
c = getopt_long(argc, argv, "hvt:u:", long_options, &option_index);
// Detect the end of the options.
if (c == -1)
@ -87,7 +87,7 @@ Receiver::Receiver(int argc, char *argv[]) : tcpipInterface(nullptr) {
break;
case 'v':
std::cout << "SLS Receiver Version: " << APIRECEIVER << std::endl;
std::cout << "slsReceiver Version: " << APIRECEIVER << std::endl;
LOG(logINFOBLUE) << "Exiting [ Tid: " << gettid() << " ]";
exit(EXIT_SUCCESS);

View File

@ -16,6 +16,8 @@ enum TLogLevel {
logINFOBLUE,
logINFOGREEN,
logINFORED,
logINFOCYAN,
logINFOMAGENTA,
logINFO,
logDEBUG,
logDEBUG1,
@ -60,16 +62,25 @@ class Logger {
// Danger this buffer need as many elements as TLogLevel
static const char *Color(TLogLevel level) noexcept {
static const char *const colors[] = {
RED BOLD, YELLOW BOLD, BLUE, GREEN, RED, RESET,
RESET, RESET, RESET, RESET, RESET, RESET};
RED BOLD, YELLOW BOLD, BLUE, GREEN, RED, CYAN, MAGENTA,
RESET, RESET, RESET, RESET, RESET, RESET, RESET};
// out of bounds
if (level < 0 || level >= sizeof(colors) / sizeof(colors[0])) {
return RESET;
}
return colors[level];
}
// Danger this buffer need as many elements as TLogLevel
static std::string ToString(TLogLevel level) {
static const char *const buffer[] = {
"ERROR", "WARNING", "INFO", "INFO", "INFO", "INFO",
"DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"};
"ERROR", "WARNING", "INFO", "INFO", "INFO",
"INFO", "INFO", "INFO", "DEBUG", "DEBUG1",
"DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"};
// out of bounds
if (level < 0 || level >= sizeof(buffer) / sizeof(buffer[0])) {
return "UNKNOWN";
}
return buffer[level];
}

View File

@ -1,13 +1,13 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */
#define APICTB "developer 0x241107"
#define APIGOTTHARD "developer 0x241107"
#define APIGOTTHARD2 "developer 0x241107"
#define APIMOENCH "developer 0x241107"
#define APIXILINXCTB "developer 0x241107"
#define APIEIGER "developer 0x241107"
#define APIJUNGFRAU "developer 0x241120"
#define APIMYTHEN3 "developer 0x241121"
#define APILIB "developer 0x241122"
#define APIRECEIVER "developer 0x241122"
#define APIGOTTHARD "9.0.0 0x241121"
#define APIGOTTHARD2 "9.0.0 0x241121"
#define APIMOENCH "9.0.0 0x241121"
#define APIEIGER "9.0.0 0x241121"
#define APICTB "9.1.0 0x250204"
#define APIXILINXCTB "9.1.0 0x250204"
#define APIMYTHEN3 "9.1.0 0x250304"
#define APIJUNGFRAU "9.1.0 0x250318"
#define APILIB "9.1.0 0x250325"
#define APIRECEIVER "9.1.0 0x250325"