Files
sics/site_ansto/instrument/bilby/config/chopper/chopper.tcl
Ferdi Franceschini 79cedd58dc Fix return value for simulated t0_chopper_id.
Also save value as an array, this is useful when testing the code.
2014-06-17 12:30:54 +10:00

39 lines
1.2 KiB
Tcl

namespace eval chopper {
variable sim_mode [SplitReply [chopper_simulation]]
set t0_chopper_id_simvar 1
}
if {$sim_mode == false} {
MakeAsyncProtocol std
MakeAsyncQueue chopsel std chopsel1-bilby 30000
}
::utility::macro::getset int t0_chopper_id {args} {
variable sim_mode [SplitReply [chopper_simulation]]
if {$sim_mode == false} {
if {$args == ""} {
chopsel send {get master chopper}
return "t0_chopper_id = [SplitReply [chopsel send {get master chopper}]]"
} else {
chopsel send "get master chopper"
chopsel send "enable chopper selection"
chopsel send "set master chopper=$args"
chopsel send "disable chopper selection"
}
} else {
if {$args == ""} {
if {$::chopper::t0_chopper_id_simvar < 1 || $::chopper::t0_chopper_id_simvar > 4} {
return -code error "Your simulated chopper returned an error"
} else {
return "t0_chopper_id = $::chopper::t0_chopper_id_simvar"
}
} else {
set ::chopper::t0_chopper_id_simvar $args
}
}
}
sicslist setatt t0_chopper_id klass NXdisk_chopper
sicslist setatt t0_chopper_id long_name t0_chopper_id
sicslist setatt t0_chopper_id mutable true