BUGFIX Forgot to actually send coil value when set.

Also cleared stale error messages.
This commit is contained in:
Ferdi Franceschini
2013-05-13 22:14:22 +10:00
parent b1597c96f3
commit b8d059c266

View File

@@ -6,6 +6,9 @@ namespace eval ::scobj::chopper {
# sicslist setatt disk_chopper long_name disk_chopper # sicslist setatt disk_chopper long_name disk_chopper
proc sndMBquery {rdScript cmd nextReq} { proc sndMBquery {rdScript cmd nextReq} {
if [hpropexists [sct] geterror] {
hdelprop [sct] geterror
}
set chN [ lindex [sct P_chAddress] [sct P_chIndex] ] set chN [ lindex [sct P_chAddress] [sct P_chIndex] ]
sct nextSndReq $nextReq sct nextSndReq $nextReq
sct send "$chN:$cmd" sct send "$chN:$cmd"
@@ -13,6 +16,12 @@ namespace eval ::scobj::chopper {
} }
proc sndMBset {root cmd} { 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] set val [sct target]
#TODO convert val to appropriate units, if [convfact] then val = val * [sct convfact] #TODO convert val to appropriate units, if [convfact] then val = val * [sct convfact]
sct send "$cmd:$val" sct send "$cmd:$val"
@@ -27,6 +36,10 @@ namespace eval ::scobj::chopper {
if {[string match "ASCERR:*" $val]} { if {[string match "ASCERR:*" $val]} {
sct geterror $val sct geterror $val
return idle return idle
} else {
if [hpropexists [sct] geterror] {
hdelprop [sct] geterror
}
} }
if {$val != $oldval} { if {$val != $oldval} {
sct update 1 sct update 1
@@ -48,12 +61,21 @@ namespace eval ::scobj::chopper {
set chIndex [sct P_chIndex] set chIndex [sct P_chIndex]
set currCh [ lindex [sct P_name] $chIndex ] set currCh [ lindex [sct P_name] $chIndex ]
set val [sct result] 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 cAddr [expr $coil - 1]
set coilPath $root/$currCh/$node set coilPath $root/$currCh/$node
set oldval [hgetpropval $coilPath P_oldval] set oldval [hgetpropval $coilPath P_oldval]
if {$val != $oldval} { if {$val != $oldval} {
hsetprop $coilPath P_oldval $val hsetprop $coilPath P_oldval $val
hset $coilPath $val
} }
return [sct nextSndReq] return [sct nextSndReq]
} }
@@ -68,10 +90,15 @@ namespace eval ::scobj::chopper {
sct geterror $values sct geterror $values
hset $chPath/device_error $values hset $chPath/device_error $values
return idle 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 { foreach n $nodes v $values {
set oldval [hval $chPath/$n] set oldval [hval $chPath/$n]
if {$v != $oldval} { if {$v != $oldval} {
@@ -98,9 +125,6 @@ namespace eval ::scobj::chopper {
hset $chPath/device_error $reply hset $chPath/device_error $reply
return idle return idle
} }
if {[hval $chPath/device_error] != ""} {
hset $chPath/device_error ""
}
sct_fermi queue $root progress read sct_fermi queue $root progress read
return idle return idle
} }