diff --git a/site_ansto/instrument/util/utility.tcl b/site_ansto/instrument/util/utility.tcl index 594785e0..04032f36 100644 --- a/site_ansto/instrument/util/utility.tcl +++ b/site_ansto/instrument/util/utility.tcl @@ -917,6 +917,27 @@ proc handle_exception {status message args} { } } +proc hupdateif {path new_value {cmp_format ""}} { + if { ${cmp_format} == "" } { + if { [hpropexists ${path} compare_format] } { + set compare_format [hgetpropval ${path} compare_format] + } else { + set compare_format "" + } + } else { + set compare_format ${cmp_format} + } + if { ${compare_format} == "" } { + if { [hval ${path}] != ${new_value} } { + hupdate ${path} ${new_value} + } + } else { + if { [format ${compare_format} [hval ${path}]] != [format ${compare_format} ${new_value}] } { + hupdate ${path} ${new_value} + } + } +} + namespace import ::utility::*; Publish getinfo spy Publish setpos user