Add ";*IDN?" in SetValue and setPoint functions (after commands that don't elicit a response) to force a response that avoids the timeout and reconnect sequence that gives problems on the LS336
r3259 | dcl | 2011-10-18 16:13:01 +1100 (Tue, 18 Oct 2011) | 1 line
This commit is contained in:
@@ -149,7 +149,6 @@ debug_log "chkWrite new data for $tc_root [sct] result=\"$data\""
|
||||
sct utime readtime
|
||||
debug_log "wrRun new data for $tc_root [sct] data=$data"
|
||||
}
|
||||
set dev [getDev $tc_root]
|
||||
debug_log "wrRun send: *RUN"
|
||||
sct send "*RUN"
|
||||
debug_log "status: busy"
|
||||
@@ -169,30 +168,27 @@ debug_log "chkWrite new data for $tc_root [sct] result=\"$data\""
|
||||
debug_log "ValidateResponse $tc_root failure"
|
||||
}
|
||||
if {[string equal -nocase -length 7 $data "ASCERR:"]} {
|
||||
set rslt [list 0 "$data" ]
|
||||
debug_log "ValidateResponse: $rslt"
|
||||
return $rslt
|
||||
set rslt [list 0 "$data" "XX" "XX"]
|
||||
} elseif {[string equal -nocase -length 1 $data "?"]} {
|
||||
set rslt [list 0 "$data" ]
|
||||
debug_log "ValidateResponse: $rslt"
|
||||
return $rslt
|
||||
set rslt [list 0 "$data" "XX" "XX"]
|
||||
} elseif {![string equal -nocase -length 1 $data "\002"]} {
|
||||
set rslt [list 0 "$data" "XX" "XX"]
|
||||
} else {
|
||||
if {[string equal -nocase -length 1 $data "\002"]} {
|
||||
set data [string range $data 1 end]
|
||||
}
|
||||
set addr [string range $data 0 2]
|
||||
set data [string range $data 1 end]
|
||||
sct result $data
|
||||
set addr [string range $data 0 1]
|
||||
if {[string equal -length 1 $addr "0"]} {
|
||||
set addr [string range $addr 1 end]
|
||||
}
|
||||
set stat [string range $data 2 3]
|
||||
set stat [string range $data 2 2]
|
||||
set data [string range $data 3 end]
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set rslt [list 1 "$data" "$addr" "$stat"]
|
||||
debug_log "ValidateResponse: $rslt"
|
||||
return $rslt
|
||||
}
|
||||
debug_log "ValidateResponse: $rslt"
|
||||
return $rslt
|
||||
}
|
||||
|
||||
proc rdRat {tc_root} {
|
||||
@@ -556,39 +552,28 @@ debug_log "Registering node $nodeName for write callback"
|
||||
set scobj_hpath /sics/$tempobj
|
||||
|
||||
set deviceCommand {\
|
||||
Pump0 Run 0 1 1 1 1 text user {} {} {RUN} {wrRun} {}\
|
||||
Pump0 Cld 0 1 1 1 0 text user {} {} {CLD} {wrCld} {}\
|
||||
Pump0 Out 0 1 1 1 0 text user {} {} {OUT} {wrOut} {}\
|
||||
Pump0 Rat 1 1 1 1 0 text user {RAT} {rdRat} {RAT} {wrRat} {}\
|
||||
Pump0 Vol 1 1 1 1 0 text user {VOL} {rdVol} {VOL} {wrVol} {}\
|
||||
Pump0 Dir 1 1 1 1 0 text user {DIR} {rdDir} {DIR} {wrDir} {}\
|
||||
Pump0 Buz 1 1 1 1 0 text user {BUZ} {rdBuz} {BUZ} {wrBuz} {}\
|
||||
Pump0 Dis 1 0 1 1 0 text internal {DIS} {rdDis} {} {} {}\
|
||||
Pump0 In2 1 0 1 1 0 text internal {IN2} {rdInp} {} {} {}\
|
||||
Pump0 In3 1 0 1 1 0 text internal {IN3} {rdInp} {} {} {}\
|
||||
Pump0 In4 1 0 1 1 0 text internal {IN4} {rdInp} {} {} {}\
|
||||
Pump0 In6 1 0 1 1 0 text internal {IN6} {rdInp} {} {} {}\
|
||||
Pump0 Ver 1 0 1 1 0 text internal {VER} {rdVer} {} {} {}\
|
||||
Pump1 Run 0 1 1 1 1 text user {} {} {RUN} {wrRun} {}\
|
||||
Pump1 Cld 0 1 1 1 0 text user {} {} {CLD} {wrCld} {}\
|
||||
Pump1 Out 0 1 1 1 0 text user {} {} {OUT} {wrOut} {}\
|
||||
Pump1 Rat 1 1 1 1 0 text user {RAT} {rdRat} {RAT} {wrRat} {}\
|
||||
Pump1 Vol 1 1 1 1 0 text user {VOL} {rdVol} {VOL} {wrVol} {}\
|
||||
Pump1 Dir 1 1 1 1 0 text user {DIR} {rdDir} {DIR} {wrDir} {}\
|
||||
Pump1 Buz 1 1 1 1 0 text user {BUZ} {rdBuz} {BUZ} {wrBuz} {}\
|
||||
Pump1 Dis 1 0 1 1 0 text internal {DIS} {rdDis} {} {} {}\
|
||||
Pump1 In2 1 0 1 1 0 text internal {IN2} {rdInp} {} {} {}\
|
||||
Pump1 In3 1 0 1 1 0 text internal {IN3} {rdInp} {} {} {}\
|
||||
Pump1 In4 1 0 1 1 0 text internal {IN4} {rdInp} {} {} {}\
|
||||
Pump1 In6 1 0 1 1 0 text internal {IN6} {rdInp} {} {} {}\
|
||||
Pump1 Ver 1 0 1 1 0 text internal {VER} {rdVer} {} {} {}\
|
||||
Pump Run 0 1 1 1 1 text user {} {} {RUN} {wrRun} {}\
|
||||
Pump Cld 0 1 1 1 0 text user {} {} {CLD} {wrCld} {}\
|
||||
Pump Out 0 1 1 1 0 text user {} {} {OUT} {wrOut} {}\
|
||||
Pump Rat 1 1 1 1 0 text user {RAT} {rdRat} {RAT} {wrRat} {}\
|
||||
Pump Vol 1 1 1 1 0 text user {VOL} {rdVol} {VOL} {wrVol} {}\
|
||||
Pump Dir 1 1 1 1 0 text user {DIR} {rdDir} {DIR} {wrDir} {}\
|
||||
Pump Buz 1 1 1 1 0 text user {BUZ} {rdBuz} {BUZ} {wrBuz} {}\
|
||||
Pump Dis 1 0 1 1 0 text internal {DIS} {rdDis} {} {} {}\
|
||||
Pump In2 1 0 1 1 0 text internal {IN2} {rdInp} {} {} {}\
|
||||
Pump In3 1 0 1 1 0 text internal {IN3} {rdInp} {} {} {}\
|
||||
Pump In4 1 0 1 1 0 text internal {IN4} {rdInp} {} {} {}\
|
||||
Pump In6 1 0 1 1 0 text internal {IN6} {rdInp} {} {} {}\
|
||||
Pump Ver 1 0 1 1 0 text internal {VER} {rdVer} {} {} {}\
|
||||
}
|
||||
|
||||
hfactory $scobj_hpath/Pump0 plain spy none
|
||||
hfactory $scobj_hpath/Pump1 plain spy none
|
||||
|
||||
foreach {cmdGroup varName readable writable nexus gumtree drivable dataType permission rdCmd rdFunc wrCmd wrFunc allowedValues} $deviceCommand {
|
||||
createNode $scobj_hpath $sct_controller $cmdGroup $varName $readable $writable $nexus $gumtree $drivable $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc $allowedValues $klass
|
||||
set num_pumps 2
|
||||
for {set i 0} { i < $num_pumps } { incr i } {
|
||||
set cmdGroup "Pump[set i]"
|
||||
hfactory $scobj_hpath/[set cmdGroup] plain spy none
|
||||
foreach {cmdGroup varName readable writable nexus gumtree drivable dataType permission rdCmd rdFunc wrCmd wrFunc allowedValues} $deviceCommand {
|
||||
createNode $scobj_hpath $sct_controller $cmdGroup $varName $readable $writable $nexus $gumtree $drivable $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc $allowedValues $klass
|
||||
}
|
||||
}
|
||||
|
||||
hfactory $scobj_hpath/status plain spy text
|
||||
|
||||
@@ -733,7 +733,7 @@ proc setValue {tc_root nextState cmd {idx ""}} {
|
||||
set par [sct target]
|
||||
}
|
||||
# Talking to a pseudo-node (no equivalent command in the device communication)
|
||||
sct send "$cmd$par"
|
||||
sct send "$cmd$par;*IDN?"
|
||||
} message ]} {
|
||||
return -code error "in setValue: $message."
|
||||
}
|
||||
@@ -800,7 +800,7 @@ proc setPoint {tc_root nextState cmd whichCtrlLoop} {
|
||||
hsetprop $nodename driving 1
|
||||
}
|
||||
#puts "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
|
||||
sct send "$cmd$par"
|
||||
sct send "$cmd$par;*IDN?"
|
||||
} message ]} {
|
||||
return -code error "in setPoint: $message."
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ proc setValue {tc_root nextState cmd {idx ""}} {
|
||||
}
|
||||
set ::scobj::ls340::ls340_lastWriteCmd "$cmd$par"
|
||||
# Talking to a pseudo-node (no equivalent command in the device communication)
|
||||
sct send "$cmd$par"
|
||||
sct send "$cmd$par;*IDN?"
|
||||
} message ]} {
|
||||
return -code error "in setValue: $message. While sending command: $::scobj::ls340::ls340_lastWriteCmd"
|
||||
}
|
||||
@@ -912,7 +912,7 @@ proc setPoint {tc_root nextState cmd whichCtrlLoop} {
|
||||
hsetprop $nodename driving 1
|
||||
}
|
||||
#puts "setPoint(wrStatus=$wrStatus): sct send $cmd$par"
|
||||
sct send "$cmd$par"
|
||||
sct send "$cmd$par;*IDN?"
|
||||
} message ]} {
|
||||
return -code error "in setPoint: $message. Last write command: $::scobj::ls340::ls340_lastWriteCmd"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user