reset error message on good read and adjust code indent
r3026 | dcl | 2010-09-14 11:34:59 +1000 (Tue, 14 Sep 2010) | 2 lines
This commit is contained in:
@@ -75,6 +75,9 @@ debug_log "rdValue $tc_root ITC503-a result=$data"
|
||||
set rslt [scan $data %f data]
|
||||
debug_log "rdValue $tc_root ITC503-b result=$data"
|
||||
}
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
if {$data != [sct oldval]} {
|
||||
sct oldval $data
|
||||
sct update $data
|
||||
@@ -235,48 +238,48 @@ debug_log "rdState $tc_root status($rslt)= X$the_x A$the_a C$the_c S[format %02d
|
||||
hsetprop $tc_root/itc500_state my_state "STATE_X"
|
||||
}
|
||||
if { $nextState == "" } {
|
||||
set my_status "[SplitReply [hgetprop $tc_root/itc500_state my_status]]"
|
||||
set my_status "[SplitReply [hgetprop $tc_root/itc500_state my_status]]"
|
||||
debug_log "rdState my_status=$my_status"
|
||||
set rslt [scan $my_status "X%dA%dC%dS%dH%dL%d" the_x the_a the_c the_s the_h the_l]
|
||||
set rslt [scan $my_status "X%dA%dC%dS%dH%dL%d" the_x the_a the_c the_s the_h the_l]
|
||||
debug_log "rdState $tc_root status($rslt)= X$the_x A$the_a C$the_c S[format %02d $the_s] H$the_h L$the_l"
|
||||
set my_driving [SplitReply [hgetprop $tc_root/setpoint driving]]
|
||||
set my_driving [SplitReply [hgetprop $tc_root/setpoint driving]]
|
||||
debug_log "rdState $tc_root: driving=$my_driving"
|
||||
if {[ catch {
|
||||
set val "[hval $tc_root/setpoint]"
|
||||
} message ]} {
|
||||
set val 0
|
||||
if {[ catch {
|
||||
set val "[hval $tc_root/setpoint]"
|
||||
} message ]} {
|
||||
set val 0
|
||||
debug_log "rdState $tc_root: setpoint=failure"
|
||||
}
|
||||
}
|
||||
debug_log "rdState $tc_root: setpoint=$val"
|
||||
if {[hpropexists $tc_root/setpoint target]} {
|
||||
set tgt [SplitReply [hgetprop $tc_root/setpoint target]]
|
||||
if {[hpropexists $tc_root/setpoint target]} {
|
||||
set tgt [SplitReply [hgetprop $tc_root/setpoint target]]
|
||||
debug_log "rdState $tc_root: target=$tgt"
|
||||
} else {
|
||||
hsetprop $tc_root/setpoint target $val
|
||||
set tgt [SplitReply [hgetprop $tc_root/setpoint target]]
|
||||
} else {
|
||||
hsetprop $tc_root/setpoint target $val
|
||||
set tgt [SplitReply [hgetprop $tc_root/setpoint target]]
|
||||
debug_log "rdState $tc_root: initialised target to: target=$tgt"
|
||||
}
|
||||
if {$my_driving > 0} {
|
||||
if {[hval $tc_root/control_sensor] == "3"} {
|
||||
set temp [hval $tc_root/sensor3/value]
|
||||
} elseif {[hval $tc_root/control_sensor] == "2"} {
|
||||
set temp [hval $tc_root/sensor2/value]
|
||||
} else {
|
||||
set temp [hval $tc_root/sensor/value]
|
||||
}
|
||||
set tol [hval $tc_root/tolerance]
|
||||
set lotemp [expr {$tgt - $tol}]
|
||||
set hitemp [expr {$tgt + $tol}]
|
||||
if {$my_driving > 0} {
|
||||
if {[hval $tc_root/control_sensor] == "3"} {
|
||||
set temp [hval $tc_root/sensor3/value]
|
||||
} elseif {[hval $tc_root/control_sensor] == "2"} {
|
||||
set temp [hval $tc_root/sensor2/value]
|
||||
} else {
|
||||
set temp [hval $tc_root/sensor/value]
|
||||
}
|
||||
set tol [hval $tc_root/tolerance]
|
||||
set lotemp [expr {$tgt - $tol}]
|
||||
set hitemp [expr {$tgt + $tol}]
|
||||
debug_log "rdState driving $tc_root until $temp in ($lotemp, $hitemp)"
|
||||
if {$temp < $lotemp} {
|
||||
} elseif {$temp > $hitemp} {
|
||||
} else {
|
||||
hset $tc_root/status "idle"
|
||||
hsetprop $tc_root/setpoint driving 0
|
||||
if {$temp < $lotemp} {
|
||||
} elseif {$temp > $hitemp} {
|
||||
} else {
|
||||
hset $tc_root/status "idle"
|
||||
hsetprop $tc_root/setpoint driving 0
|
||||
debug_log "rdState driving $tc_root finished at $temp in ($lotemp, $hitemp)"
|
||||
}
|
||||
}
|
||||
}
|
||||
set nextState idle
|
||||
set nextState idle
|
||||
}
|
||||
} catch_message ]} {
|
||||
debug_log "rdState error: $catch_message"
|
||||
|
||||
Reference in New Issue
Block a user