From b136700f3919cd0df939e95f4f5af6b2060da477 Mon Sep 17 00:00:00 2001 From: koennecke Date: Fri, 30 Oct 2009 13:53:26 +0000 Subject: [PATCH] - Fixed a bug in el737sec which made scans fail badly - Enhanced phytron driver with another parameter --- tcl/el737sec.tcl | 14 +++++++++++++- tcl/hdbutil.tcl | 7 +++++-- tcl/phytron.tcl | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/tcl/el737sec.tcl b/tcl/el737sec.tcl index 0d7280ad..47515450 100644 --- a/tcl/el737sec.tcl +++ b/tcl/el737sec.tcl @@ -172,6 +172,16 @@ proc el737readvalues {} { sct send RA return el737val } +#-------------------------------------------------- +proc swapFirst {l} { + set m1 [lindex $l 0] + set cts [lindex $l 1] + lappend res $cts $m1 + for {set i 2} {$i < [llength $l]} {incr i} { + lappend res [lindex $l $i] + } + return $res +} #--------------------------------------------------- # There are two types of reponses to the RA command: # the old form with 5 values and the new one @@ -189,12 +199,14 @@ proc el737val {} { set root [sctroot] if {[llength $l] > 5} { set l2 [lrange $l 1 end] + set l2 [swapFirst $l2] hupdate ${root}/values [join $l2] set time [lindex $l 0] hupdate ${root}/time $time } else { set last [expr [llength $l] - 1] set l2 [lrange $l 0 $last] + set l2 [swapFirst $l2] hupdate ${root}/values [join $l2] set time [lindex $l $last] hupdate ${root}/time $time @@ -295,7 +307,7 @@ proc MakeSecEL737 {name netaddr} { $conname write $path hsetprop $path read el737threshread hsetprop $path el737thresh el737thresh - $conname poll $path 60 +# $conname poll $path 60 $conname debug -1 diff --git a/tcl/hdbutil.tcl b/tcl/hdbutil.tcl index 8c02e7b6..6091852e 100644 --- a/tcl/hdbutil.tcl +++ b/tcl/hdbutil.tcl @@ -565,7 +565,7 @@ proc makestdadmin {} { hdbReadOnly int hsetprop /instrument/experiment/datafilenumber priv internal hfactory /instrument/experiment/batchpath script "exe batchpath" \ - "exe batchpath" text + hdbbatchpath text hsetprop /instrument/experiment/batchpath priv user sicspoll add /instrument/experiment/batchpath hdb 60 sicspoll add /instrument/experiment/datafilenumber hdb 60 @@ -700,7 +700,10 @@ proc makemumo {rootpath mumoname} { #----------------------------------------------------------------- proc hdbbatchpath {pathstring} { exe batchpath $pathstring - hupdate /instrument/commands/batch/execute/file/values + catch {hupdate /instrument/commands/batch/execute/file/values} + catch {hupdate /instrument/commands/batch/batchpath} + catch {hupdate /instrument/experiment/batchpath} + catch {hupdate /batch/bufferlist} } #------------------------------------------------------------------ proc makeexe {} { diff --git a/tcl/phytron.tcl b/tcl/phytron.tcl index 8759fdf5..042821ba 100644 --- a/tcl/phytron.tcl +++ b/tcl/phytron.tcl @@ -38,6 +38,10 @@ # sendstatus - rcvstatus - statpos # # Mark Koennecke, June 2009 +# +# Added code to switch a brake on for schneider_m2 +# +# Mark Koennecke, September 2009 #------------------------------------------------------------------------- namespace eval phytron {} @@ -207,3 +211,42 @@ proc phytron::make {name axis controller lowlim upperlim} { hupdate /sics/${name}/status idle $controller queue /sics/${name}/hardposition progress read } +#=============================================================================================== +# At MORPHEUS there is a special table where one motor needs a brake. This requires a digital I/O +# to be disabled before driving and enabled after driving. The code below adds this feature to +# a phytron motor +#----------------------------------------------------------------------------------------------- +proc phytron::openset {out} { + sct send [format "0A%dS" $out] + return openans +} +#---------------------------------------------------------------------------------------------- +proc phytron::openans {axis name} { + after 100 + return [phytron::setpos $axis $name] +} +#---------------------------------------------------------------------------------------------- +proc phytron::outsend {axis out} { + set data [phytron::check] + if {[string first ACKE $data] >= 0} { + sct update error + clientput "Electronics error" + return idle + } + sct send [format "0A%dR" $out] + return outend +} +#---------------------------------------------------------------------------------------------- +proc phytron::outend {} { + sct update idle + return idle +} +#---------------------------------------------------------------------------------------------- +proc phytron::configureM2 {motor axis out} { + set path /sics/${motor} + hsetprop $path/hardposition write phytron::openset $out + hsetprop $path/hardposition openans phytron::openans $axis $motor + + hsetprop $path/status statend phytron::outsend $axis $out + hsetprop $path/status outend phytron::outend +}