diff --git a/slsDetectorSoftware/generator/Caller.in.h b/slsDetectorSoftware/generator/Caller.in.h index 14dfb22d6..dbecfd5b9 100644 --- a/slsDetectorSoftware/generator/Caller.in.h +++ b/slsDetectorSoftware/generator/Caller.in.h @@ -67,6 +67,7 @@ class Caller { private: bool ReplaceIfDeprecated(std::string &command); + void SuggestIfRemoved(const std::string &command); using FunctionMap = std::map; using StringMap = std::map; Detector *ptr; // pointer to the detector that executes the command @@ -104,6 +105,12 @@ class Caller { // THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (3) }; + + StringMap removed_functions{ + + // THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (4) + + }; }; } // namespace sls \ No newline at end of file diff --git a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh index 4234674d7..b82958148 100644 --- a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh @@ -80,7 +80,7 @@ _sd() { local IS_PATH=0 -local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern define_bit define_reg definelist_bit definelist_reg delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest include initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " +local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern define_bit define_reg definelist_bit definelist_reg delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest include initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " __acquire() { FCN_RETURN="" return 0 @@ -3117,60 +3117,6 @@ __user() { FCN_RETURN="" return 0 } -__v_a() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_b() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_c() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_chip() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_d() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_io() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} __v_limit() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then diff --git a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh index 7b9e0fa6f..0f6a96183 100644 --- a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh @@ -4,7 +4,7 @@ _sd() { -local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern define_bit define_reg definelist_bit definelist_reg delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest include initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " +local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern define_bit define_reg definelist_bit definelist_reg delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest include initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " __acquire() { FCN_RETURN="" return 0 @@ -3041,60 +3041,6 @@ __user() { FCN_RETURN="" return 0 } -__v_a() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_b() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_c() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_chip() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_d() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} -__v_io() { -FCN_RETURN="" -if [[ ${IS_GET} -eq 0 ]]; then -if [[ "${cword}" == "2" ]]; then -FCN_RETURN="" -fi -fi -return 0 -} __v_limit() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then diff --git a/slsDetectorSoftware/generator/commands.yaml b/slsDetectorSoftware/generator/commands.yaml index dd0960a09..a66f3e608 100644 --- a/slsDetectorSoftware/generator/commands.yaml +++ b/slsDetectorSoftware/generator/commands.yaml @@ -1577,71 +1577,6 @@ v_limit: function: setPower input: [ 'defs::V_LIMIT', 'args[0]' ] -v_a: - inherit_actions: INTEGER_IND_COMMAND - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply a in mV." - actions: - GET: - function: getPower - input: [ 'defs::V_POWER_A' ] - PUT: - function: setPower - input: [ 'defs::V_POWER_A', 'args[0]' ] - -v_b: - inherit_actions: INTEGER_IND_COMMAND - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply b in mV." - actions: - GET: - function: getPower - input: [ 'defs::V_POWER_B' ] - PUT: - function: setPower - input: [ 'defs::V_POWER_B', 'args[0]' ] - -v_c: - inherit_actions: INTEGER_IND_COMMAND - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply c in mV." - actions: - GET: - function: getPower - input: [ 'defs::V_POWER_C' ] - PUT: - function: setPower - input: [ 'defs::V_POWER_C', 'args[0]' ] - -v_d: - inherit_actions: INTEGER_IND_COMMAND - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply d in mV." - actions: - GET: - function: getPower - input: [ 'defs::V_POWER_D' ] - PUT: - function: setPower - input: [ 'defs::V_POWER_D', 'args[0]' ] - -v_io: - inherit_actions: INTEGER_IND_COMMAND - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up)." - actions: - GET: - function: getPower - input: [ 'defs::V_POWER_IO' ] - PUT: - function: setPower - input: [ 'defs::V_POWER_IO', 'args[0]' ] - -v_chip: - inherit_actions: INTEGER_IND_COMMAND - help: "[n_value]\n\t[Ctb] Power supply chip in mV. Do not use it unless you are completely sure you will not fry the board." - actions: - GET: - function: getPower - input: [ 'defs::V_POWER_CHIP' ] - PUT: - function: setPower - input: [ 'defs::V_POWER_CHIP', 'args[0]' ] ################# INTEGER_USER_IND_COMMAND ################### vchip_comp_fe: diff --git a/slsDetectorSoftware/generator/cpp_codegen/codegen.py b/slsDetectorSoftware/generator/cpp_codegen/codegen.py index dc5e3294f..fef9959d0 100644 --- a/slsDetectorSoftware/generator/cpp_codegen/codegen.py +++ b/slsDetectorSoftware/generator/cpp_codegen/codegen.py @@ -36,7 +36,7 @@ class CodeGenerator: self.file.write(line) self.template_file.close() - def write_header(self, in_path, out_path, commands, deprecated_commands): + def write_header(self, in_path, out_path, commands, deprecated_commands, removed_commands): """Write the header file for the caller.h file""" with out_path.open('w') as fp: with in_path.open('r') as fp2: @@ -59,6 +59,11 @@ class CodeGenerator: fp.write(f'{{"{key}", "{value}"}},\n') continue + if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (4)" in line: + for key, value in removed_commands.items(): + fp.write(f'{{"{key}", "{value}"}},\n') + continue + fp.write(line) def write_infer_header(self, in_path, out_path, commands): diff --git a/slsDetectorSoftware/generator/extended_commands.yaml b/slsDetectorSoftware/generator/extended_commands.yaml index ef4b12918..f5c26acee 100644 --- a/slsDetectorSoftware/generator/extended_commands.yaml +++ b/slsDetectorSoftware/generator/extended_commands.yaml @@ -12685,285 +12685,6 @@ user: help: '' infer_action: true is_description: true -v_a: - actions: - GET: - args: - - arg_types: [] - argc: 0 - cast_input: - - false - check_det_id: false - convert_det_id: true - function: getPower - input: - - defs::V_POWER_A - input_types: - - int - output: - - OutString(t) - require_det_id: true - store_result_in_t: true - PUT: - args: - - arg_types: - - int - - int - argc: 1 - cast_input: - - false - - true - check_det_id: false - convert_det_id: true - function: setPower - input: - - defs::V_POWER_A - - args[0] - input_types: - - int - - int - output: - - args.front() - require_det_id: true - store_result_in_t: false - command_name: v_a - function_alias: v_a - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply a in mV." - infer_action: true - template: true -v_b: - actions: - GET: - args: - - arg_types: [] - argc: 0 - cast_input: - - false - check_det_id: false - convert_det_id: true - function: getPower - input: - - defs::V_POWER_B - input_types: - - int - output: - - OutString(t) - require_det_id: true - store_result_in_t: true - PUT: - args: - - arg_types: - - int - - int - argc: 1 - cast_input: - - false - - true - check_det_id: false - convert_det_id: true - function: setPower - input: - - defs::V_POWER_B - - args[0] - input_types: - - int - - int - output: - - args.front() - require_det_id: true - store_result_in_t: false - command_name: v_b - function_alias: v_b - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply b in mV." - infer_action: true - template: true -v_c: - actions: - GET: - args: - - arg_types: [] - argc: 0 - cast_input: - - false - check_det_id: false - convert_det_id: true - function: getPower - input: - - defs::V_POWER_C - input_types: - - int - output: - - OutString(t) - require_det_id: true - store_result_in_t: true - PUT: - args: - - arg_types: - - int - - int - argc: 1 - cast_input: - - false - - true - check_det_id: false - convert_det_id: true - function: setPower - input: - - defs::V_POWER_C - - args[0] - input_types: - - int - - int - output: - - args.front() - require_det_id: true - store_result_in_t: false - command_name: v_c - function_alias: v_c - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply c in mV." - infer_action: true - template: true -v_chip: - actions: - GET: - args: - - arg_types: [] - argc: 0 - cast_input: - - false - check_det_id: false - convert_det_id: true - function: getPower - input: - - defs::V_POWER_CHIP - input_types: - - int - output: - - OutString(t) - require_det_id: true - store_result_in_t: true - PUT: - args: - - arg_types: - - int - - int - argc: 1 - cast_input: - - false - - true - check_det_id: false - convert_det_id: true - function: setPower - input: - - defs::V_POWER_CHIP - - args[0] - input_types: - - int - - int - output: - - args.front() - require_det_id: true - store_result_in_t: false - command_name: v_chip - function_alias: v_chip - help: "[n_value]\n\t[Ctb] Power supply chip in mV. Do not use it unless you are\ - \ completely sure you will not fry the board." - infer_action: true - template: true -v_d: - actions: - GET: - args: - - arg_types: [] - argc: 0 - cast_input: - - false - check_det_id: false - convert_det_id: true - function: getPower - input: - - defs::V_POWER_D - input_types: - - int - output: - - OutString(t) - require_det_id: true - store_result_in_t: true - PUT: - args: - - arg_types: - - int - - int - argc: 1 - cast_input: - - false - - true - check_det_id: false - convert_det_id: true - function: setPower - input: - - defs::V_POWER_D - - args[0] - input_types: - - int - - int - output: - - args.front() - require_det_id: true - store_result_in_t: false - command_name: v_d - function_alias: v_d - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply d in mV." - infer_action: true - template: true -v_io: - actions: - GET: - args: - - arg_types: [] - argc: 0 - cast_input: - - false - check_det_id: false - convert_det_id: true - function: getPower - input: - - defs::V_POWER_IO - input_types: - - int - output: - - OutString(t) - require_det_id: true - store_result_in_t: true - PUT: - args: - - arg_types: - - int - - int - argc: 1 - cast_input: - - false - - true - check_det_id: false - convert_det_id: true - function: setPower - input: - - defs::V_POWER_IO - - args[0] - input_types: - - int - - int - output: - - args.front() - require_det_id: true - store_result_in_t: false - command_name: v_io - function_alias: v_io - help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. Must\ - \ be the first power regulator to be set after fpga reset (on-board detector server\ - \ start up)." - infer_action: true - template: true v_limit: actions: GET: diff --git a/slsDetectorSoftware/generator/gen_commands.py b/slsDetectorSoftware/generator/gen_commands.py index ee4f97a8c..45dbc878f 100644 --- a/slsDetectorSoftware/generator/gen_commands.py +++ b/slsDetectorSoftware/generator/gen_commands.py @@ -14,6 +14,7 @@ GEN_PATH = Path(__file__).parent COMMANDS_PATH = GEN_PATH / 'extended_commands.yaml' DEPRECATED_COMMANDS_PATH = GEN_PATH / 'deprecated_commands.yaml' +REMOVED_COMMANDS_PATH = GEN_PATH / 'removed_commands.yaml' CPP_INPUT_PATH = GEN_PATH / 'Caller.in.cpp' HEADER_INPUT_PATH = GEN_PATH / 'Caller.in.h' CPP_OUTPUT_PATH = GEN_PATH.parent / 'src' / 'Caller.cpp' @@ -39,6 +40,8 @@ def generate( ): commands_config = yaml.unsafe_load(commands_path.open('r')) deprecated_commands_config = yaml.unsafe_load(DEPRECATED_COMMANDS_PATH.open('r')) + removed_commands_config = yaml.unsafe_load(REMOVED_COMMANDS_PATH.open('r')) + type_dist, non_dist = check_infer(commands=commands_config) codegen.open(cpp_output_path) @@ -167,7 +170,8 @@ def generate( codegen.close() print('[X] .cpp code generated') deprecated_commands = [] - codegen.write_header(header_input_path, header_output_path, commands_config, deprecated_commands_config) + removed_commands = [] + codegen.write_header(header_input_path, header_output_path, commands_config, deprecated_commands_config, removed_commands_config) print('[X] header code generated') diff --git a/slsDetectorSoftware/generator/removed_commands.yaml b/slsDetectorSoftware/generator/removed_commands.yaml new file mode 100644 index 000000000..f4ed1e3bb --- /dev/null +++ b/slsDetectorSoftware/generator/removed_commands.yaml @@ -0,0 +1,6 @@ +v_a: "dac and power" +v_b: "dac and power" +v_c: "dac and power" +v_d: "dac and power" +v_io: "dac and power" +v_chip: "dac" diff --git a/slsDetectorSoftware/src/Caller.cpp b/slsDetectorSoftware/src/Caller.cpp index 067cd0e26..f48dd44f2 100644 --- a/slsDetectorSoftware/src/Caller.cpp +++ b/slsDetectorSoftware/src/Caller.cpp @@ -16006,379 +16006,6 @@ std::string Caller::updatemode(int action) { return os.str(); } -std::string Caller::v_a(int action) { - - std::ostringstream os; - // print help - if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([n_value] - [Ctb][Xilinx Ctb] Power supply a in mV. )V0G0N" - << std::endl; - return os.str(); - } - - // check if action and arguments are valid - if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { - throw RuntimeError("Wrong number of arguments for action GET"); - } - - if (args.size() == 0) { - } - - } - - else if (action == slsDetectorDefs::PUT_ACTION) { - if (1 && args.size() != 1) { - throw RuntimeError("Wrong number of arguments for action PUT"); - } - - if (args.size() == 1) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError("Could not convert argument 1 to int"); - } - } - - } - - else { - - throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions " - "are ['GET', 'PUT']"); - } - - // generate code for each action - if (action == slsDetectorDefs::GET_ACTION) { - if (args.size() == 0) { - auto t = det->getPower(defs::V_POWER_A, std::vector{det_id}); - os << OutString(t) << '\n'; - } - } - - if (action == slsDetectorDefs::PUT_ACTION) { - if (args.size() == 1) { - auto arg1 = StringTo(args[0]); - det->setPower(defs::V_POWER_A, arg1, std::vector{det_id}); - os << args.front() << '\n'; - } - } - - return os.str(); -} - -std::string Caller::v_b(int action) { - - std::ostringstream os; - // print help - if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([n_value] - [Ctb][Xilinx Ctb] Power supply b in mV. )V0G0N" - << std::endl; - return os.str(); - } - - // check if action and arguments are valid - if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { - throw RuntimeError("Wrong number of arguments for action GET"); - } - - if (args.size() == 0) { - } - - } - - else if (action == slsDetectorDefs::PUT_ACTION) { - if (1 && args.size() != 1) { - throw RuntimeError("Wrong number of arguments for action PUT"); - } - - if (args.size() == 1) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError("Could not convert argument 1 to int"); - } - } - - } - - else { - - throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions " - "are ['GET', 'PUT']"); - } - - // generate code for each action - if (action == slsDetectorDefs::GET_ACTION) { - if (args.size() == 0) { - auto t = det->getPower(defs::V_POWER_B, std::vector{det_id}); - os << OutString(t) << '\n'; - } - } - - if (action == slsDetectorDefs::PUT_ACTION) { - if (args.size() == 1) { - auto arg1 = StringTo(args[0]); - det->setPower(defs::V_POWER_B, arg1, std::vector{det_id}); - os << args.front() << '\n'; - } - } - - return os.str(); -} - -std::string Caller::v_c(int action) { - - std::ostringstream os; - // print help - if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([n_value] - [Ctb][Xilinx Ctb] Power supply c in mV. )V0G0N" - << std::endl; - return os.str(); - } - - // check if action and arguments are valid - if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { - throw RuntimeError("Wrong number of arguments for action GET"); - } - - if (args.size() == 0) { - } - - } - - else if (action == slsDetectorDefs::PUT_ACTION) { - if (1 && args.size() != 1) { - throw RuntimeError("Wrong number of arguments for action PUT"); - } - - if (args.size() == 1) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError("Could not convert argument 1 to int"); - } - } - - } - - else { - - throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions " - "are ['GET', 'PUT']"); - } - - // generate code for each action - if (action == slsDetectorDefs::GET_ACTION) { - if (args.size() == 0) { - auto t = det->getPower(defs::V_POWER_C, std::vector{det_id}); - os << OutString(t) << '\n'; - } - } - - if (action == slsDetectorDefs::PUT_ACTION) { - if (args.size() == 1) { - auto arg1 = StringTo(args[0]); - det->setPower(defs::V_POWER_C, arg1, std::vector{det_id}); - os << args.front() << '\n'; - } - } - - return os.str(); -} - -std::string Caller::v_chip(int action) { - - std::ostringstream os; - // print help - if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([n_value] - [Ctb] Power supply chip in mV. Do not use it unless you are completely sure you will not fry the board. )V0G0N" - << std::endl; - return os.str(); - } - - // check if action and arguments are valid - if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { - throw RuntimeError("Wrong number of arguments for action GET"); - } - - if (args.size() == 0) { - } - - } - - else if (action == slsDetectorDefs::PUT_ACTION) { - if (1 && args.size() != 1) { - throw RuntimeError("Wrong number of arguments for action PUT"); - } - - if (args.size() == 1) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError("Could not convert argument 1 to int"); - } - } - - } - - else { - - throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions " - "are ['GET', 'PUT']"); - } - - // generate code for each action - if (action == slsDetectorDefs::GET_ACTION) { - if (args.size() == 0) { - auto t = - det->getPower(defs::V_POWER_CHIP, std::vector{det_id}); - os << OutString(t) << '\n'; - } - } - - if (action == slsDetectorDefs::PUT_ACTION) { - if (args.size() == 1) { - auto arg1 = StringTo(args[0]); - det->setPower(defs::V_POWER_CHIP, arg1, std::vector{det_id}); - os << args.front() << '\n'; - } - } - - return os.str(); -} - -std::string Caller::v_d(int action) { - - std::ostringstream os; - // print help - if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([n_value] - [Ctb][Xilinx Ctb] Power supply d in mV. )V0G0N" - << std::endl; - return os.str(); - } - - // check if action and arguments are valid - if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { - throw RuntimeError("Wrong number of arguments for action GET"); - } - - if (args.size() == 0) { - } - - } - - else if (action == slsDetectorDefs::PUT_ACTION) { - if (1 && args.size() != 1) { - throw RuntimeError("Wrong number of arguments for action PUT"); - } - - if (args.size() == 1) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError("Could not convert argument 1 to int"); - } - } - - } - - else { - - throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions " - "are ['GET', 'PUT']"); - } - - // generate code for each action - if (action == slsDetectorDefs::GET_ACTION) { - if (args.size() == 0) { - auto t = det->getPower(defs::V_POWER_D, std::vector{det_id}); - os << OutString(t) << '\n'; - } - } - - if (action == slsDetectorDefs::PUT_ACTION) { - if (args.size() == 1) { - auto arg1 = StringTo(args[0]); - det->setPower(defs::V_POWER_D, arg1, std::vector{det_id}); - os << args.front() << '\n'; - } - } - - return os.str(); -} - -std::string Caller::v_io(int action) { - - std::ostringstream os; - // print help - if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([n_value] - [Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up). )V0G0N" - << std::endl; - return os.str(); - } - - // check if action and arguments are valid - if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { - throw RuntimeError("Wrong number of arguments for action GET"); - } - - if (args.size() == 0) { - } - - } - - else if (action == slsDetectorDefs::PUT_ACTION) { - if (1 && args.size() != 1) { - throw RuntimeError("Wrong number of arguments for action PUT"); - } - - if (args.size() == 1) { - try { - StringTo(args[0]); - } catch (...) { - throw RuntimeError("Could not convert argument 1 to int"); - } - } - - } - - else { - - throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions " - "are ['GET', 'PUT']"); - } - - // generate code for each action - if (action == slsDetectorDefs::GET_ACTION) { - if (args.size() == 0) { - auto t = det->getPower(defs::V_POWER_IO, std::vector{det_id}); - os << OutString(t) << '\n'; - } - } - - if (action == slsDetectorDefs::PUT_ACTION) { - if (args.size() == 1) { - auto arg1 = StringTo(args[0]); - det->setPower(defs::V_POWER_IO, arg1, std::vector{det_id}); - os << args.front() << '\n'; - } - } - - return os.str(); -} - std::string Caller::v_limit(int action) { std::ostringstream os; diff --git a/slsDetectorSoftware/src/Caller.h b/slsDetectorSoftware/src/Caller.h index 15a6db3d3..79ce07e33 100644 --- a/slsDetectorSoftware/src/Caller.h +++ b/slsDetectorSoftware/src/Caller.h @@ -358,12 +358,6 @@ class Caller { std::string updatekernel(int action); std::string updatemode(int action); std::string user(int action); - std::string v_a(int action); - std::string v_b(int action); - std::string v_c(int action); - std::string v_chip(int action); - std::string v_d(int action); - std::string v_io(int action); std::string v_limit(int action); std::string vchip_comp_adc(int action); std::string vchip_comp_fe(int action); @@ -396,6 +390,7 @@ class Caller { private: bool ReplaceIfDeprecated(std::string &command); + void SuggestIfRemoved(const std::string &command); using FunctionMap = std::map; using StringMap = std::map; Detector *ptr; // pointer to the detector that executes the command @@ -729,12 +724,6 @@ class Caller { {"updatekernel", &Caller::updatekernel}, {"updatemode", &Caller::updatemode}, {"user", &Caller::user}, - {"v_a", &Caller::v_a}, - {"v_b", &Caller::v_b}, - {"v_c", &Caller::v_c}, - {"v_chip", &Caller::v_chip}, - {"v_d", &Caller::v_d}, - {"v_io", &Caller::v_io}, {"v_limit", &Caller::v_limit}, {"vchip_comp_adc", &Caller::vchip_comp_adc}, {"vchip_comp_fe", &Caller::vchip_comp_fe}, @@ -902,6 +891,14 @@ class Caller { {"frameindex", "rx_frameindex"}, }; + + StringMap removed_functions{ + + {"v_a", "dac and power"}, {"v_b", "dac and power"}, + {"v_c", "dac and power"}, {"v_d", "dac and power"}, + {"v_io", "dac and power"}, {"v_chip", "dac"}, + + }; }; } // namespace sls \ No newline at end of file diff --git a/slsDetectorSoftware/src/CallerSpecial.cpp b/slsDetectorSoftware/src/CallerSpecial.cpp index 7b376ef31..5b73a1f80 100644 --- a/slsDetectorSoftware/src/CallerSpecial.cpp +++ b/slsDetectorSoftware/src/CallerSpecial.cpp @@ -25,6 +25,7 @@ void Caller::call(const std::string &command, int action, std::ostream &os, int receiver_id) { cmd = command; args = arguments; // copy args before replacing + SuggestIfRemoved(cmd); std::string temp; while (temp != cmd) { temp = cmd; @@ -66,6 +67,16 @@ bool Caller::ReplaceIfDeprecated(std::string &command) { return false; } +void Caller::SuggestIfRemoved(const std::string &command) { + auto r_it = removed_functions.find(command); + if (r_it != removed_functions.end()) { + std::ostringstream oss; + oss << command << " is removed and is no longer available. Please use: " + << r_it->second; + throw RuntimeError(oss.str()); + } +} + std::string Caller::list(int action) { if (action == defs::HELP_ACTION) { return "[deprecated(optional)]\n\tlists all available commands, list " diff --git a/slsDetectorSoftware/src/CtbConfig.cpp b/slsDetectorSoftware/src/CtbConfig.cpp index b0c8450fa..4c58b776d 100644 --- a/slsDetectorSoftware/src/CtbConfig.cpp +++ b/slsDetectorSoftware/src/CtbConfig.cpp @@ -80,12 +80,14 @@ CtbConfig::getNames(size_t expected_size, void CtbConfig::setDacName(size_t index, const std::string &name) { check_index(index, num_dacs, "DAC"); - std::vector powers = {"v_a", "v_b", "v_c", "v_d", "v_io", "va", "vb", "vc", "vd", "vio"}; + std::vector powers = {"v_a", "v_b", "v_c", "v_d", "v_io", + "va", "vb", "vc", "vd", "vio"}; std::string lower = name; std::transform(lower.begin(), lower.end(), lower.begin(), - [](unsigned char c){ return std::tolower(c); }); + [](unsigned char c) { return std::tolower(c); }); if (std::find(powers.begin(), powers.end(), lower) != powers.end()) { - throw RuntimeError("DAC name cannot be a power name (VA, VB, VC, VD, VIO, V_A, V_B, V_C, V_D, V_IO)"); + throw RuntimeError("DAC name cannot be a power name (VA, VB, VC, VD, " + "VIO, V_A, V_B, V_C, V_D, V_IO)"); } set_name(name, dacnames, index); } diff --git a/slsDetectorSoftware/src/inferAction.cpp b/slsDetectorSoftware/src/inferAction.cpp index 16ce05068..fb9f12ad5 100644 --- a/slsDetectorSoftware/src/inferAction.cpp +++ b/slsDetectorSoftware/src/inferAction.cpp @@ -4253,102 +4253,6 @@ int InferAction::user() { } } -int InferAction::v_a() { - - if (args.size() == 0) { - return slsDetectorDefs::GET_ACTION; - } - - if (args.size() == 1) { - return slsDetectorDefs::PUT_ACTION; - } - - else { - - throw RuntimeError("Could not infer action: Wrong number of arguments"); - } -} - -int InferAction::v_b() { - - if (args.size() == 0) { - return slsDetectorDefs::GET_ACTION; - } - - if (args.size() == 1) { - return slsDetectorDefs::PUT_ACTION; - } - - else { - - throw RuntimeError("Could not infer action: Wrong number of arguments"); - } -} - -int InferAction::v_c() { - - if (args.size() == 0) { - return slsDetectorDefs::GET_ACTION; - } - - if (args.size() == 1) { - return slsDetectorDefs::PUT_ACTION; - } - - else { - - throw RuntimeError("Could not infer action: Wrong number of arguments"); - } -} - -int InferAction::v_chip() { - - if (args.size() == 0) { - return slsDetectorDefs::GET_ACTION; - } - - if (args.size() == 1) { - return slsDetectorDefs::PUT_ACTION; - } - - else { - - throw RuntimeError("Could not infer action: Wrong number of arguments"); - } -} - -int InferAction::v_d() { - - if (args.size() == 0) { - return slsDetectorDefs::GET_ACTION; - } - - if (args.size() == 1) { - return slsDetectorDefs::PUT_ACTION; - } - - else { - - throw RuntimeError("Could not infer action: Wrong number of arguments"); - } -} - -int InferAction::v_io() { - - if (args.size() == 0) { - return slsDetectorDefs::GET_ACTION; - } - - if (args.size() == 1) { - return slsDetectorDefs::PUT_ACTION; - } - - else { - - throw RuntimeError("Could not infer action: Wrong number of arguments"); - } -} - int InferAction::v_limit() { if (args.size() == 0) { diff --git a/slsDetectorSoftware/src/inferAction.h b/slsDetectorSoftware/src/inferAction.h index 285ea6ee1..a190363a9 100644 --- a/slsDetectorSoftware/src/inferAction.h +++ b/slsDetectorSoftware/src/inferAction.h @@ -313,12 +313,6 @@ class InferAction { int updatekernel(); int updatemode(); int user(); - int v_a(); - int v_b(); - int v_c(); - int v_chip(); - int v_d(); - int v_io(); int v_limit(); int vchip_comp_adc(); int vchip_comp_fe(); @@ -654,12 +648,6 @@ class InferAction { {"updatekernel", &InferAction::updatekernel}, {"updatemode", &InferAction::updatemode}, {"user", &InferAction::user}, - {"v_a", &InferAction::v_a}, - {"v_b", &InferAction::v_b}, - {"v_c", &InferAction::v_c}, - {"v_chip", &InferAction::v_chip}, - {"v_d", &InferAction::v_d}, - {"v_io", &InferAction::v_io}, {"v_limit", &InferAction::v_limit}, {"vchip_comp_adc", &InferAction::vchip_comp_adc}, {"vchip_comp_fe", &InferAction::vchip_comp_fe}, diff --git a/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp b/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp index 52a6c90af..5c1cb5324 100644 --- a/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp +++ b/slsDetectorSoftware/tests/Caller/test-Caller-chiptestboard.cpp @@ -50,7 +50,8 @@ TEST_CASE("dacname", "[.detectorintegration]") { REQUIRE_THROWS(caller.call("dacname", {str_dac_index, "v_b"}, -1, PUT)); REQUIRE_THROWS(caller.call("dacname", {str_dac_index, "v_c"}, -1, PUT)); REQUIRE_THROWS(caller.call("dacname", {str_dac_index, "v_d"}, -1, PUT)); - REQUIRE_THROWS(caller.call("dacname", {str_dac_index, "v_io"}, -1, PUT)); + REQUIRE_THROWS( + caller.call("dacname", {str_dac_index, "v_io"}, -1, PUT)); det.setDacName(ind, prev); } else { @@ -503,89 +504,6 @@ TEST_CASE("dac", "[.detectorintegration][.dacs]") { det_type == defs::XILINX_CHIPTESTBOARD) { // normal dacs - for (int idac = 0; idac < 18; ++idac) { - SECTION("dac " + std::to_string(idac)) { - test_dac_caller(static_cast(idac), "dac", 0); - test_dac_caller(static_cast(idac), "dac", 1200); - test_dac_caller(static_cast(idac), "dac", 1200, true); - test_dac_caller(static_cast(idac), "dac", -100); - } - REQUIRE_THROWS( - caller.call("dac", {std::to_string(idac), "-2"}, -1, PUT)); - REQUIRE_THROWS( - caller.call("dac", {std::to_string(idac), "-1"}, -1, PUT)); - } - - // power dacs - if (det.isVirtualDetectorServer().tsquash("Inconsistent virtual servers")) { - std::vector names{"v_a", "v_b", "v_c", "v_d", "v_io"}; - std::vector indices{defs::V_POWER_A, defs::V_POWER_B, defs::V_POWER_C, defs::V_POWER_D, defs::V_POWER_IO}; - for (size_t iPower = 0; iPower < names.size(); ++iPower) { - auto prev_val = det.getDAC(indices[iPower]); - - // this is the first command touching power dacs, should not be - // -100 - if (det_type == defs::XILINX_CHIPTESTBOARD) { - REQUIRE(prev_val.any(-100) == false); - REQUIRE(prev_val.any(-1) == false); - } - - REQUIRE_THROWS(caller.call("dac", {names[iPower], "-2"}, -1, PUT)); - REQUIRE_THROWS(caller.call("dac", {names[iPower], "-100"}, -1, PUT)); - REQUIRE_THROWS(caller.call("dac", {names[iPower], "-1"}, -1, PUT)); - REQUIRE_THROWS(caller.call("dac", {names[iPower], "0"}, -1, PUT)); - REQUIRE_THROWS(caller.call("dac", {names[iPower], "4096"}, -1, PUT)); - // min - if (names[iPower] == "v_io") - REQUIRE_THROWS(caller.call("dac", {names[iPower], "1199", "mV"}, -1, PUT)); - else { - if (det_type == defs::XILINX_CHIPTESTBOARD) { - REQUIRE_THROWS( - caller.call("dac", {names[iPower], "1040", "mV"}, -1, PUT)); - } else { - REQUIRE_THROWS( - caller.call("dac", {names[iPower], "635", "mV"}, -1, PUT)); - } - } - // max - if (det_type == defs::XILINX_CHIPTESTBOARD) { - REQUIRE_THROWS(caller.call("dac", {names[iPower], "2662", "mV"}, -1, PUT)); - } else { - REQUIRE_THROWS(caller.call("dac", {names[iPower], "2469", "mV"}, -1, PUT)); - } - { - std::ostringstream oss; - caller.call("dac", {names[iPower], "800", "mV"}, -1, PUT, oss); - REQUIRE(oss.str() == "dac " + names[iPower] + " 800 mV\n"); - } - { - std::ostringstream oss1, oss2; - caller.call("dac", {names[iPower], "1200", "mV"}, -1, PUT, oss1); - REQUIRE(oss1.str() == "dac " + names[iPower] + " 1200 mV\n"); - caller.call("dac", {names[iPower], "1200", "mV"}, -1, GET, oss2); - REQUIRE(oss2.str() == "dac " + names[iPower] + " 1200 mV\n"); - } - { - std::ostringstream oss1, oss2; - caller.call("dac", {names[iPower], "1200"}, -1, PUT, oss1); - REQUIRE(oss1.str() == "dac " + names[iPower] + " 1200\n"); - caller.call("dac", {names[iPower], "1200"}, -1, GET, oss2); - REQUIRE(oss2.str() == "dac " + names[iPower] + " 1200\n"); - } - // Reset all dacs to previous value - for (int imod = 0; imod != det.size(); ++imod) { - det.setDAC(indices[iPower], prev_val[imod], false, {imod}); - } - } - } - - REQUIRE_THROWS(caller.call("dac", {"18"}, -1, GET)); - REQUIRE_THROWS(caller.call("dac", {"5", "4096"}, -1, PUT)); - if (det_type == defs::CHIPTESTBOARD) - REQUIRE_THROWS(caller.call("dac", {"5", "2501", "mV"}, -1, PUT)); - else - REQUIRE_THROWS(caller.call("dac", {"5", "2049", "mV"}, -1, PUT)); - // eiger // REQUIRE_THROWS(caller.call("dac", {"vthreshold"}, -1, GET)); // REQUIRE_THROWS(caller.call("dac", {"vsvp"}, -1, GET)); @@ -645,6 +563,107 @@ TEST_CASE("dac", "[.detectorintegration][.dacs]") { REQUIRE_THROWS(caller.call("dac", {"vb_cs"}, -1, GET)); REQUIRE_THROWS(caller.call("dac", {"vb_opa_fd"}, -1, GET)); REQUIRE_THROWS(caller.call("dac", {"vcom_adc2"}, -1, GET)); + + // ctb and xilinx + REQUIRE_THROWS(caller.call("dac", {"18"}, -1, GET)); + REQUIRE_THROWS(caller.call("dac", {"5", "4096"}, -1, PUT)); + if (det_type == defs::CHIPTESTBOARD) + REQUIRE_THROWS(caller.call("dac", {"5", "2501", "mV"}, -1, PUT)); + else + REQUIRE_THROWS(caller.call("dac", {"5", "2049", "mV"}, -1, PUT)); + + for (int idac = 0; idac < 18; ++idac) { + SECTION("dac " + std::to_string(idac)) { + test_dac_caller(static_cast(idac), "dac", 0); + test_dac_caller(static_cast(idac), "dac", 1200); + test_dac_caller(static_cast(idac), "dac", 1200, + true); + test_dac_caller(static_cast(idac), "dac", -100); + } + REQUIRE_THROWS( + caller.call("dac", {std::to_string(idac), "-2"}, -1, PUT)); + REQUIRE_THROWS( + caller.call("dac", {std::to_string(idac), "-1"}, -1, PUT)); + } + + // power dacs + if (det.isVirtualDetectorServer().tsquash( + "Inconsistent virtual servers")) { + std::vector names{"v_a", "v_b", "v_c", "v_d", "v_io"}; + std::vector indices{ + defs::V_POWER_A, defs::V_POWER_B, defs::V_POWER_C, + defs::V_POWER_D, defs::V_POWER_IO}; + for (size_t iPower = 0; iPower < names.size(); ++iPower) { + auto prev_val = det.getDAC(indices[iPower]); + + // this is the first command touching power dacs, should not be + // -100 + if (det_type == defs::XILINX_CHIPTESTBOARD) { + REQUIRE(prev_val.any(-100) == false); + REQUIRE(prev_val.any(-1) == false); + } + + REQUIRE_THROWS( + caller.call("dac", {names[iPower], "-2"}, -1, PUT)); + REQUIRE_THROWS( + caller.call("dac", {names[iPower], "-100"}, -1, PUT)); + REQUIRE_THROWS( + caller.call("dac", {names[iPower], "-1"}, -1, PUT)); + REQUIRE_THROWS( + caller.call("dac", {names[iPower], "0"}, -1, PUT)); + REQUIRE_THROWS( + caller.call("dac", {names[iPower], "4096"}, -1, PUT)); + // min + if (names[iPower] == "v_io") + REQUIRE_THROWS(caller.call( + "dac", {names[iPower], "1199", "mV"}, -1, PUT)); + else { + if (det_type == defs::XILINX_CHIPTESTBOARD) { + REQUIRE_THROWS(caller.call( + "dac", {names[iPower], "1040", "mV"}, -1, PUT)); + } else { + REQUIRE_THROWS(caller.call( + "dac", {names[iPower], "635", "mV"}, -1, PUT)); + } + } + // max + if (det_type == defs::XILINX_CHIPTESTBOARD) { + REQUIRE_THROWS(caller.call( + "dac", {names[iPower], "2662", "mV"}, -1, PUT)); + } else { + REQUIRE_THROWS(caller.call( + "dac", {names[iPower], "2469", "mV"}, -1, PUT)); + } + { + std::ostringstream oss; + caller.call("dac", {names[iPower], "800", "mV"}, -1, PUT, + oss); + REQUIRE(oss.str() == "dac " + names[iPower] + " 800 mV\n"); + } + { + std::ostringstream oss1, oss2; + caller.call("dac", {names[iPower], "1200", "mV"}, -1, PUT, + oss1); + REQUIRE(oss1.str() == + "dac " + names[iPower] + " 1200 mV\n"); + caller.call("dac", {names[iPower], "1200", "mV"}, -1, GET, + oss2); + REQUIRE(oss2.str() == + "dac " + names[iPower] + " 1200 mV\n"); + } + { + std::ostringstream oss1, oss2; + caller.call("dac", {names[iPower], "1200"}, -1, PUT, oss1); + REQUIRE(oss1.str() == "dac " + names[iPower] + " 1200\n"); + caller.call("dac", {names[iPower], "1200"}, -1, GET, oss2); + REQUIRE(oss2.str() == "dac " + names[iPower] + " 1200\n"); + } + // Reset all dacs to previous value + for (int imod = 0; imod != det.size(); ++imod) { + det.setDAC(indices[iPower], prev_val[imod], false, {imod}); + } + } + } } } @@ -1117,97 +1136,24 @@ TEST_CASE("dbitclk", "[.detectorintegration]") { TEST_CASE("v_abcd", "[.detectorintegration]") { Detector det; Caller caller(&det); - auto det_type = det.getDetectorType().squash(); - std::vector cmds{"v_a", "v_b", "v_c", "v_d"}; - std::vector indices{defs::V_POWER_A, defs::V_POWER_B, - defs::V_POWER_C, defs::V_POWER_D}; - - if (det.isVirtualDetectorServer().tsquash("Inconsistent virtual servers")) { - cmds.push_back("v_io"); - indices.push_back(defs::V_POWER_IO); - } + // removed in favor of "dac" and "power" commands + std::vector cmds{"v_a", "v_b", "v_c", "v_d", "v_io", "v_chip"}; + std::vector indices{defs::V_POWER_A, defs::V_POWER_B, + defs::V_POWER_C, defs::V_POWER_D, + defs::V_POWER_IO, defs::V_POWER_CHIP}; for (size_t i = 0; i < cmds.size(); ++i) { - if (det_type == defs::CHIPTESTBOARD || - det_type == defs::XILINX_CHIPTESTBOARD) { - auto prev_val = det.getPower(indices[i]); - // this is the first command touching power dacs, should not be - // -100 - if (det_type == defs::XILINX_CHIPTESTBOARD) { - REQUIRE(prev_val.any(-100) == false); - REQUIRE(prev_val.any(-1) == false); - } - REQUIRE_THROWS(caller.call(cmds[i], {"-2"}, -1, PUT)); - REQUIRE_THROWS(caller.call(cmds[i], {"-100"}, -1, PUT)); - REQUIRE_THROWS(caller.call(cmds[i], {"-1"}, -1, PUT)); - if (cmds[i] == "v_io") - REQUIRE_THROWS(caller.call(cmds[i], {"1199"}, -1, PUT)); // min - else { - if (det_type == defs::XILINX_CHIPTESTBOARD) { - REQUIRE_THROWS( - caller.call(cmds[i], {"1040"}, -1, PUT)); // min v_a - } else { - REQUIRE_THROWS( - caller.call(cmds[i], {"635"}, -1, PUT)); // min v_a - } - } - if (det_type == defs::XILINX_CHIPTESTBOARD) { - REQUIRE_THROWS(caller.call(cmds[i], {"2662"}, -1, PUT)); // max - } else { - REQUIRE_THROWS(caller.call(cmds[i], {"2469"}, -1, PUT)); // max - } - { - std::ostringstream oss; - caller.call(cmds[i], {"0"}, -1, PUT, oss); - REQUIRE(oss.str() == cmds[i] + " 0\n"); - } - { - std::ostringstream oss1, oss2; - caller.call(cmds[i], {"1200"}, -1, PUT, oss1); - REQUIRE(oss1.str() == cmds[i] + " 1200\n"); - caller.call(cmds[i], {}, -1, GET, oss2); - REQUIRE(oss2.str() == cmds[i] + " 1200\n"); - } - for (int imod = 0; imod != det.size(); ++imod) { - if (det_type == defs::XILINX_CHIPTESTBOARD && - prev_val[imod] == -100) { - prev_val[imod] = 0; - } - det.setPower(indices[i], prev_val[imod], {imod}); - } - - } else { - REQUIRE_THROWS(caller.call(cmds[i], {}, -1, GET)); + try { + caller.call(cmds[i], {}, -1, GET); + } catch (const std::exception &e) { + REQUIRE(std::string(e.what()).find( + "removed and is no longer available") != + std::string::npos); } } } -TEST_CASE("v_io", "[.detectorintegration]") { - Detector det; - Caller caller(&det); - auto det_type = det.getDetectorType().squash(); - if (det_type == defs::CHIPTESTBOARD || - det_type == defs::XILINX_CHIPTESTBOARD) { - // better not to play with setting it - REQUIRE_NOTHROW(caller.call("v_io", {}, -1, GET)); - } else { - REQUIRE_THROWS(caller.call("v_io", {}, -1, GET)); - } -} - -TEST_CASE("v_chip", "[.detectorintegration]") { - Detector det; - Caller caller(&det); - auto det_type = det.getDetectorType().squash(); - if (det_type == defs::CHIPTESTBOARD) { - // better not to play with setting it - REQUIRE_NOTHROW(caller.call("v_chip", {}, -1, GET)); - } else { - REQUIRE_THROWS(caller.call("v_chip", {}, -1, GET)); - } -} - TEST_CASE("vm_a", "[.detectorintegration]") { Detector det; Caller caller(&det); diff --git a/slsDetectorSoftware/tests/Caller/test-Caller-global.cpp b/slsDetectorSoftware/tests/Caller/test-Caller-global.cpp index ce7019637..e79e58673 100644 --- a/slsDetectorSoftware/tests/Caller/test-Caller-global.cpp +++ b/slsDetectorSoftware/tests/Caller/test-Caller-global.cpp @@ -49,7 +49,8 @@ void test_dac_caller(defs::dacIndex index, const std::string &dacname, if (mV) args.push_back("mV"); caller.call("dac", args, -1, PUT, oss); - REQUIRE(oss.str() == std::string("dac ") + dac + " " + value + (mV ? " mV\n" : "\n")); + REQUIRE(oss.str() == std::string("dac ") + dac + " " + value + + (mV ? " mV\n" : "\n")); } { std::ostringstream oss; @@ -57,7 +58,8 @@ void test_dac_caller(defs::dacIndex index, const std::string &dacname, if (mV) args.push_back("mV"); caller.call(dacname, args, -1, GET, oss); - REQUIRE(oss.str() == "dac " + dac + " " + value + (mV ? " mV\n" : "\n")); + REQUIRE(oss.str() == + "dac " + dac + " " + value + (mV ? " mV\n" : "\n")); } // Reset all dacs to previous value for (int i = 0; i != det.size(); ++i) { diff --git a/slsSupportLib/src/ToString.cpp b/slsSupportLib/src/ToString.cpp index 98790f7cd..bfd1220fb 100644 --- a/slsSupportLib/src/ToString.cpp +++ b/slsSupportLib/src/ToString.cpp @@ -508,6 +508,18 @@ std::string ToString(const defs::dacIndex s) { return std::string("vipre_cds"); case defs::IBIAS_SFP: return std::string("ibias_sfp"); + case defs::V_POWER_A: + return std::string("v_a"); + case defs::V_POWER_B: + return std::string("v_b"); + case defs::V_POWER_C: + return std::string("v_c"); + case defs::V_POWER_D: + return std::string("v_d"); + case defs::V_POWER_IO: + return std::string("v_io"); + case defs::V_POWER_CHIP: + return std::string("v_chip"); case defs::TRIMBIT_SCAN: return std::string("trimbits"); case defs::HIGH_VOLTAGE: @@ -989,6 +1001,18 @@ template <> defs::dacIndex StringTo(const std::string &s) { return defs::VIPRE_CDS; if (s == "ibias_sfp") return defs::IBIAS_SFP; + if (s == "v_a") + return defs::V_POWER_A; + if (s == "v_b") + return defs::V_POWER_B; + if (s == "v_c") + return defs::V_POWER_C; + if (s == "v_d") + return defs::V_POWER_D; + if (s == "v_io") + return defs::V_POWER_IO; + if (s == "v_chip") + return defs::V_POWER_CHIP; if (s == "trimbits") return defs::TRIMBIT_SCAN; if (s == "highvoltage")