From b8d059c266c69b8f01cfadc398915c5b5f77672d Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Mon, 13 May 2013 22:14:22 +1000 Subject: [PATCH] BUGFIX Forgot to actually send coil value when set. Also cleared stale error messages. --- .../config/chopper/sct_fermichopper.tcl | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/site_ansto/instrument/pelican/config/chopper/sct_fermichopper.tcl b/site_ansto/instrument/pelican/config/chopper/sct_fermichopper.tcl index c61840da..baa6458d 100644 --- a/site_ansto/instrument/pelican/config/chopper/sct_fermichopper.tcl +++ b/site_ansto/instrument/pelican/config/chopper/sct_fermichopper.tcl @@ -6,6 +6,9 @@ namespace eval ::scobj::chopper { # sicslist setatt disk_chopper long_name disk_chopper proc sndMBquery {rdScript cmd nextReq} { + if [hpropexists [sct] geterror] { + hdelprop [sct] geterror + } set chN [ lindex [sct P_chAddress] [sct P_chIndex] ] sct nextSndReq $nextReq sct send "$chN:$cmd" @@ -13,6 +16,12 @@ namespace eval ::scobj::chopper { } proc sndMBset {root cmd} { + if [hpropexists [sct] geterror] { + hdelprop [sct] geterror + } + if {[hval $root/control/device_error] != ""} { + hset $root/control/device_error "" + } set val [sct target] #TODO convert val to appropriate units, if [convfact] then val = val * [sct convfact] sct send "$cmd:$val" @@ -27,6 +36,10 @@ namespace eval ::scobj::chopper { if {[string match "ASCERR:*" $val]} { sct geterror $val return idle + } else { + if [hpropexists [sct] geterror] { + hdelprop [sct] geterror + } } if {$val != $oldval} { sct update 1 @@ -48,12 +61,21 @@ namespace eval ::scobj::chopper { set chIndex [sct P_chIndex] set currCh [ lindex [sct P_name] $chIndex ] set val [sct result] + if {[string match "ASCERR:*" $val]} { + sct geterror $val + return idle + } else { + if [hpropexists [sct] geterror] { + hdelprop [sct] geterror + } + } set cAddr [expr $coil - 1] set coilPath $root/$currCh/$node set oldval [hgetpropval $coilPath P_oldval] if {$val != $oldval} { hsetprop $coilPath P_oldval $val + hset $coilPath $val } return [sct nextSndReq] } @@ -68,10 +90,15 @@ namespace eval ::scobj::chopper { sct geterror $values hset $chPath/device_error $values return idle + } else { + if [hpropexists [sct] geterror] { + hdelprop [sct] geterror + } + if {[hval $chPath/device_error] != ""} { + hset $chPath/device_error "" + } } - if {[hval $chPath/device_error] != ""} { - hset $chPath/device_error "" - } + foreach n $nodes v $values { set oldval [hval $chPath/$n] if {$v != $oldval} { @@ -98,9 +125,6 @@ namespace eval ::scobj::chopper { hset $chPath/device_error $reply return idle } - if {[hval $chPath/device_error] != ""} { - hset $chPath/device_error "" - } sct_fermi queue $root progress read return idle }