- Fixed a bug in el737sec which made scans fail badly

- Enhanced phytron driver with another parameter
This commit is contained in:
koennecke
2009-10-30 13:53:26 +00:00
parent 91aa9c538c
commit b136700f39
3 changed files with 61 additions and 3 deletions

View File

@ -172,6 +172,16 @@ proc el737readvalues {} {
sct send RA sct send RA
return el737val 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: # There are two types of reponses to the RA command:
# the old form with 5 values and the new one # the old form with 5 values and the new one
@ -189,12 +199,14 @@ proc el737val {} {
set root [sctroot] set root [sctroot]
if {[llength $l] > 5} { if {[llength $l] > 5} {
set l2 [lrange $l 1 end] set l2 [lrange $l 1 end]
set l2 [swapFirst $l2]
hupdate ${root}/values [join $l2] hupdate ${root}/values [join $l2]
set time [lindex $l 0] set time [lindex $l 0]
hupdate ${root}/time $time hupdate ${root}/time $time
} else { } else {
set last [expr [llength $l] - 1] set last [expr [llength $l] - 1]
set l2 [lrange $l 0 $last] set l2 [lrange $l 0 $last]
set l2 [swapFirst $l2]
hupdate ${root}/values [join $l2] hupdate ${root}/values [join $l2]
set time [lindex $l $last] set time [lindex $l $last]
hupdate ${root}/time $time hupdate ${root}/time $time
@ -295,7 +307,7 @@ proc MakeSecEL737 {name netaddr} {
$conname write $path $conname write $path
hsetprop $path read el737threshread hsetprop $path read el737threshread
hsetprop $path el737thresh el737thresh hsetprop $path el737thresh el737thresh
$conname poll $path 60 # $conname poll $path 60
$conname debug -1 $conname debug -1

View File

@ -565,7 +565,7 @@ proc makestdadmin {} {
hdbReadOnly int hdbReadOnly int
hsetprop /instrument/experiment/datafilenumber priv internal hsetprop /instrument/experiment/datafilenumber priv internal
hfactory /instrument/experiment/batchpath script "exe batchpath" \ hfactory /instrument/experiment/batchpath script "exe batchpath" \
"exe batchpath" text hdbbatchpath text
hsetprop /instrument/experiment/batchpath priv user hsetprop /instrument/experiment/batchpath priv user
sicspoll add /instrument/experiment/batchpath hdb 60 sicspoll add /instrument/experiment/batchpath hdb 60
sicspoll add /instrument/experiment/datafilenumber hdb 60 sicspoll add /instrument/experiment/datafilenumber hdb 60
@ -700,7 +700,10 @@ proc makemumo {rootpath mumoname} {
#----------------------------------------------------------------- #-----------------------------------------------------------------
proc hdbbatchpath {pathstring} { proc hdbbatchpath {pathstring} {
exe batchpath $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 {} { proc makeexe {} {

View File

@ -38,6 +38,10 @@
# sendstatus - rcvstatus - statpos # sendstatus - rcvstatus - statpos
# #
# Mark Koennecke, June 2009 # Mark Koennecke, June 2009
#
# Added code to switch a brake on for schneider_m2
#
# Mark Koennecke, September 2009
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
namespace eval phytron {} namespace eval phytron {}
@ -207,3 +211,42 @@ proc phytron::make {name axis controller lowlim upperlim} {
hupdate /sics/${name}/status idle hupdate /sics/${name}/status idle
$controller queue /sics/${name}/hardposition progress read $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
}