Files
sics/site_ansto/instrument/config/commands/commands_common.tcl
Ferdi Franceschini 348bd3aed1 SICS-46
commands_common.tcl
Added ::motor::go_home command to run motors to their home positions.

hrpd,hipd,rsd,sans,reflectometer/commands.tcl
Initilise ::motor::is_homing_list for the ::motor::go_hom command

util/command.tcl
Allow an empty parameter list

server_config.tcl
Call the "commands" initilisation function on server init

motor_asim.c
Added the "home" parameter so we can test the go_home command

r2677 | ffr | 2008-08-14 15:00:18 +1000 (Thu, 14 Aug 2008) | 17 lines
2012-11-15 13:41:09 +11:00

112 lines
3.1 KiB
Tcl

##
# @file Definition of common command node procs.
################################################################################
namespace eval commands { }
# SCAN COMMANDS
namespace eval scan {
command hdb_bmonscan {
text=drivable scan_variable
float scan_start
float scan_increment
int NP
text=monitor,timer mode
float preset
int=0,2 channel
} {
bmonscan clear
# bmonscan configure script
bmonscan add $scan_variable $scan_start $scan_increment
bmonscan setchannel $channel;
set status [catch {bmonscan run $NP $mode $preset} msg]
# bmonscan configure soft
if {$status == 0} {
return $msg
} else {
return -code error "ERROR [info level 0]"
}
}
::scan::hdb_bmonscan -addfb text mode float preset float scan_variable_value int scanpoint int counts text status
::scan::hdb_bmonscan -set feedback status IDLE
command hdb_hmscan {
text=drivable scan_variable
float scan_start
float scan_increment
int NP
text=monitor,timer mode
float preset
int=0,2 channel
} {
hmscan clear
hmscan add $scan_variable $scan_start $scan_increment
hmscan setchannel $channel;
set status [catch {hmscan run $NP $mode $preset} msg]
if {$status == 0} {
return $msg
} else {
return -code error "ERROR [info level 0]"
}
}
::scan::hdb_hmscan -addfb text mode float preset float scan_variable_value int scanpoint int counts text status
::scan::hdb_hmscan -set feedback status IDLE
}
sicslist setatt ::scan::hdb_bmonscan long_name bmonscan
sicslist setatt ::scan::hdb_hmscan long_name hmscan
################################################################################
################################################################################
# MONITOR COMMANDS
namespace eval monitor {
command count {
text=timer,monitor mode
float preset
} {
::monitor::count -set feedback status BUSY
bm setmode $mode
bm count $preset
::monitor::count -set feedback counts [SplitReply [bm getcounts]];
::monitor::count -set feedback status IDLE
}
::monitor::count -addfb int counts text status
::monitor::count -set feedback status IDLE
}
################################################################################
proc ::commands::ic_initialize {} {
# Generate the following commands,
# ::motor::go_home
namespace eval ::motor {
set NS [uplevel namespace current]
if {[info exists is_homing_list] == 0} {
return -code error "ERROR: Instrument specific command config must set ${NS}::is_homing_list\n"
}
command go_home "text=$is_homing_list motors" {
# Instrument specific command configurations must define
# ::motor::is_homing_list, this is a possibly empty comma separated list
# of motors which are safe to send to home
variable is_homing_list
if {$motors == ""} {return}
set motlist [split $motors ,]
if {[setdiff $motlist [split $is_homing_list , ]] != ""} {
return -code error "ERROR: You can only \"home\" a subset of $is_homing_list"
}
foreach motor $motlist {
lappend runargs $motor [SplitReply [$motor home]]
}
eval "run $runargs"
}
}
}