# Configuration commands

Commands to configure the detector. these commands are often left to the configuration file.

- Detector Structure: commands to configure detector structure
- Detector Status: commands to configure detector status
- Versions: commands to check version of each subsytem

## Detector Structure

commands to configure detector structure

- datastream enables/disables the 0MQ data stream (0MQ threads created) from receiver to client.

- free Free shared memory on the control PC

- add Adds a detector at the end of the multi-detector structure. `put` argument is the hostname or IP adress. Returns the chained list of detector hostnames.

- remove i Removes controller `i` from the multi-detector structure. Can be used for partial readout of the detector.

- type Sets/gets detector type (string).

- hostname `put` adds the hostname (ot IP adress) at the end of the multi-detector structure. If used for a single controlled (i:) replaces the current hostname. Returns the list of the hostnames of the multi-detector structure.

- id[:i] Returns the id of the detector structure. i is the detector position in a multi detector system. If used a `put`, configures the id of the detector structure. i is the detector position in a multi detector system and l is the id of the detector to be added.

- master i `put` sets the position of the master of the acquisition (-1 if none). Returns the position of the master of the detector structure (-1 if none).

- sync Sets/gets the synchronization mode of the detectors in the multi-detector structure. Can be: `none`, `gating`, `trigger`, `complementary`. Mainly used by MYTHEN/GOTTHARD.

## Detector Status

commands to configure detector status

- online [i] sets the detector in online (1) or offline (0) mode

- checkonline returns the hostnames of all detectors without connecting to them

- activate Activates/Deactivates the detector. Deactivated detector does not send data. Used for EIGER only.

- lock [i] Locks/Unlocks the detector to communicate with this client. 1 locks, 0 unlocks.

- nmod [i] sets/gets the number of modules of the detector. Used for MYTHEN only.

- maxmod Gets the maximum number of modules of the detector. Used for MYTHEN only. Cannot put!

- dr [i] sets/gets the dynamic range of detector. Mythen [4,8,16,24]. Eiger [4,8,16,32]. Others cannot put!

- roi [i] [xmin] [xmax] [ymin] [ymax] sets region of interest of the detector, where i is number of rois;i=0 to clear rois. Used for GOTTHARD only.

- detsizechan [xmax] [ymax] sets the maximum number of channels in each dimension for complete detector set; -1 is no limit. Use for multi-detector system as first command in config file.

- roimask [i] ??

- flippeddatax [i] enables/disables data being flipped across x axis. 1 enables, 0 disables. Used for EIGER only. 1 for bottom half-module, 0 for top-half module.

- flags [flag] sets/gets the readout flags to mode. Options: none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, unknown. Used for MYTHEN and EIGER only.

- extsig:[i] [flag] sets/gets the mode of the external signal i. Options: `off`, `gate_in_active_high`, `gate_in_active_low`, `trigger_in_rising_edge`, `trigger_in_falling_edge`, `ro_trigger_in_rising_edge`, `ro_trigger_in_falling_edge`, `gate_out_active_high`, `gate_out_active_low`, `trigger_out_rising_edge`, `trigger_out_falling_edge`, `ro_trigger_out_rising_edge`, `ro_trigger_out_falling_edge`.
  Used in MYTHEN, GOTTHARD, PROPIX only.

- programfpga [file] programs the FPGA with file f (with .pof extension). Used for JUNGFRAU, MOENCH only. Only put!

- resetfpga [f] resets FPGA, where f can be any value. Used for JUNGFRAU only. Only put!

- powerchip [i] Powers on/off the chip. 1 powers on, 0 powers off. Can also get the power status. Used for JUNGFRAU only.

- led [i] sets/gets the led status. 1 on, 0 off. Used for MOENCH only ??

## Versions

Commands to check versions of each subsystem

- timing [mode] sets/gets synchronization mode of the detector. Mode: auto, trigger, ro_trigger, gating, triggered_gating

- exptime [i] sets/gets exposure time in s

- subexptime [i] sets/gets sub exposure time in s. Used in EIGER only in 32 bit mode.

- period [i] sets/gets frame period in s.

- delay [i] sets/gets delay in s. Used in MYTHEN, GOTTHARD only

- gates [i] sets/gets number of gates. Used in MYTHEN, GOTTHARD, EIGER only

- gates [i] sets/gets number of frames. If `timing` is not `auto`, then it is the number of frames per cycle/trigger.

- cycles [i] sets/gets number of triggers. Timing mode should be set appropriately.

- probes [i] sets/gets number of probes to accumulate. When setting, max 3! cycles should be set to 1, frames to the number of pump-probe events. Used in MYTHEN only

- measurements [i] sets/gets number of measurements.

- samples [i] sets/gets number of samples expected from the jctb. Used in CHIP TEST BOARD only.

- exptimel gets exposure time left. Used in MYTHEN, GOTTHARD only. Only get!

- periodl gets frame period left. Used in MYTHEN, GOTTHARD only. Only get!

- delayl gets delay left. Used in MYTHEN, GOTTHARD only. Only get!

- gatesl gets number of gates left. Used in MYTHEN, GOTTHARD only. Only get!

- framesl gets number of frames left. Used in MYTHEN, GOTTHARD only. Only get!

- cyclesl gets number of cylces left. Used in MYTHEN, GOTTHARD only. Only get!

- probesl gets number of probes left. Used in MYTHEN, GOTTHARD only. Only get!

- now ??? Only get!

- timestamp ??? Only get!

- nframes ??? Only get!

- clkdivider [i] sets/gets the readout clock divider. EIGER, JUNGFRAU [0(fast speed), 1(half speed), 2(quarter speed)]. MYTHEN[???]

- clkdivider [i] sets/gets length of set/reset signals (in clock cycles). Used in MYTHEN only

- clkdivider [i] sets/gets waitstates of the bus interface (in clock cycles). Used in MYTHEN only

- clkdivider [i] sets/gets clock divider in tot mode. Used in MYTHEN only

- clkdivider [i] sets/gets duty cycle of the tot clock. Used in MYTHEN only

- phasestep [i] ???

- oversampling [i] ???

- adcclk [i] ???

- adcphase [i] ??? Used in MYTHEN, JUNGFRAU only.

- adcpipeline [i] ???

- dbitclk [i] ???

- dbitphase [i] ???

- config [fname] sets/saves detector/receiver to configuration contained in fname. Same as executing sls_detector_put for every line. Normally a one time operation.

- rx_printconfig prints the receiver configuration. Only get!

- parameters [fname] sets/saves detector parameters contained in fname. Normally once per different measurement.

- setup [fname] sets/saves detector complete setup contained in fname (extensions automatically generated), including trimfiles, ff coefficients etc.

- tengiga [i] enables/disables 10GbE in system (detector & receiver). 1 enabled 10GbE, 0 enables 1GbE. Used in EIGER only.

- pulse [n] [x] [y] pulses pixel at coordinates (x,y) n number of times. Used in EIGER only. Only put!

- pulsenmove [n] [x] [y] pulses pixel n number of times and moves relatively by x value (x axis) and y value(y axis). Used in EIGER only. Only put!

- pulsechip [n]pulses chip n number of times, while n=-1 will reset it to normal mode. Used in EIGER only. Only put!