From cafbd02b685aaba8af948426291f9ff7b22ca1f6 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Thu, 15 Aug 2013 08:04:15 +1000 Subject: [PATCH] Make sure that the command status transitions to IDLE if it was set to BUSY --- .../config/motors/sct_positmotor_common.tcl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/site_ansto/instrument/config/motors/sct_positmotor_common.tcl b/site_ansto/instrument/config/motors/sct_positmotor_common.tcl index 9337e85d..fbbf0579 100644 --- a/site_ansto/instrument/config/motors/sct_positmotor_common.tcl +++ b/site_ansto/instrument/config/motors/sct_positmotor_common.tcl @@ -19,6 +19,12 @@ if [ catch { } set path [sct] if {[hval $path/status] == "STOPPING"} { + hset $path/driving "false" + hset $path/status "IDLE" + } elseif { ([hval $path/driving] == "false") && ([hval $path/status] == "BUSY") } { + hset $path/driving "starting" + } elseif { ([hval $path/driving] == "starting") && ([hval $path/status] == "BUSY") } { + hset $path/driving "false" hset $path/status "IDLE" } return idle @@ -35,6 +41,7 @@ proc ::scobj::positmotor::reqVal {state motor} { # @brief Convert the target position to a motor position and drive the motor to the target. proc ::scobj::positmotor::setVal {ID2valXfn motor table} { set path [sct] + hdelprop $path error_in_::scobj::positmotor::setVal set pos [$ID2valXfn [sct target] $table] hset $path/status "BUSY" run $motor $pos @@ -73,6 +80,8 @@ proc mkPosit {sct_controller name type motor klass table} { hfactory /sics/$name/status plain spy text hset /sics/$name/status "IDLE" + hfactory /sics/$name/driving plain spy text + hset /sics/$name/driving "false" proc ${ns}::${motor}_MOTEND {} [subst -nocommands { if { [hval /sics/$name/status] == "BUSY"} { @@ -82,6 +91,12 @@ proc mkPosit {sct_controller name type motor klass table} { publish ${ns}::${motor}_MOTEND user scriptcallback connect $motor MOTEND ${ns}::${motor}_MOTEND + proc ${ns}::${motor}_MOTDRIVE {} [subst -nocommands { + hset /sics/$name/driving "true" + }] + publish ${ns}::${motor}_MOTDRIVE user + + scriptcallback connect $motor MOTORDRIVE ${ns}::${motor}_MOTDRIVE ::scobj::hinitprops $name $sct_controller poll /sics/$name 2 $sct_controller write /sics/$name