diff --git a/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl b/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl index 94b3597b..1c404db2 100644 --- a/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl +++ b/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl @@ -1,26 +1,49 @@ # Defines hashes which map SICS device object names to hipadaba paths InstallHdb +#Usage: xhmake /a/b spy none {type part} +proc xhmake {path priv dtype pKey pVal} { + global pathlist; + if {[info exists pathlist($path)] == 0} { + set basepath ""; + foreach p [split [string trimleft $path / ] / ] { + if {[info exists pathlist($basepath/$p)] == 1} { + append basepath /$p; + continue; + } + hmake $basepath/$p $priv $dtype; + hsetprop $basepath/$p $pKey $pVal; + set pathlist($basepath/$p) 1; + append basepath /$p; + } + } +} + hmake /commands spy none hsetprop /commands type commandset +set pathlist(/commands) 1 #TODO change this to hparts.tcl source $cfPath(hipadaba)/hpaths.tcl set instrument [string tolower [SplitReply [Instrument]] ] hmake /$instrument spy none hsetprop /$instrument type instrument +set pathlist(/$instrument) 1 # Generate hipadaba nodes for the paths in the hpaths file foreach hp $hpaths { hmake /$instrument/$hp spy none; hsetprop /$instrument/$hp type part; + set pathlist(/$instrument/$hp) 1; } #--- admin hmake /experiment user none +set pathlist(/experiment) 1 hattach /experiment title title hattach /experiment sample description hmake /experiment/user spy none hsetprop /experiment/user type part +set pathlist(/experiment/user) 1 hattach /experiment/user user name hattach /experiment/user email email hattach /experiment/user phone phone @@ -42,22 +65,17 @@ foreach motor [sicslist type motor] { foreach {type group} [split $mpart .] {}; set path $mot_Pdic($type); if {$group != ""} { - if {[info exists pathlist(/$instrument/$path/$group)] == 0} { - hmake /$instrument/$path/$group spy none; - hsetprop /$instrument/$path/$group type part; - set pathlist(/$instrument/$path/$group) 1; - } - hattach /$instrument/$path/$group $motor [SplitReply [$motor long_name]]; - } else { - hattach /$instrument/$path $motor [SplitReply [$motor long_name]]; - } + append path /$group; + } + xhmake /$instrument/$path spy none type part; + hattach /$instrument/$path $motor [SplitReply [$motor long_name]]; } #--- Configurable Virtual Motors foreach {obj name part master_obj} $cvirtmotor_hpath { set path /$instrument/$part hattach $path $obj $name - hchain $path/$name $path/$master_obj + sicspoll add $path/$name hdb 2 } #------------- scan command