Add ;*IDN? after writes to get a response

r3231 | dcl | 2011-07-06 10:00:25 +1000 (Wed, 06 Jul 2011) | 1 line
This commit is contained in:
Douglas Clowes
2011-07-06 10:00:25 +10:00
parent a76803c242
commit cffc765197

View File

@@ -24,17 +24,27 @@ namespace eval ::scobj::k2700 {
debug_log "setParm root=$tc_root sct=[sct] cmd=$cmd target=[sct target]" debug_log "setParm root=$tc_root sct=[sct] cmd=$cmd target=[sct target]"
set par "[sct target]" set par "[sct target]"
sct send "$cmd $par" sct send "$cmd $par"
debug_log "setParm send: $cmd $par" debug_log "setParm send: $cmd $par;*IDN?"
return idle if {$par != [sct oldval]} {
sct oldval $par
sct update $par
sct utime readtime
debug_log "setParm new data for $tc_root [sct] result=$par"
}
return $nextState return $nextState
} }
proc setText {tc_root nextState cmd} { proc setText {tc_root nextState cmd} {
debug_log "setText root=$tc_root sct=[sct] cmd=$cmd target=[sct target]" debug_log "setText root=$tc_root sct=[sct] cmd=$cmd target=[sct target]"
set par "[sct target]" set par "[sct target]"
sct send "$cmd \"$par\"" sct send "$cmd \"$par\";*IDN?"
debug_log "setText send: $cmd \"$par\"" debug_log "setText send: $cmd \"$par\""
return idle if {$par != [sct oldval]} {
sct oldval $par
sct update $par
sct utime readtime
debug_log "setText new data for $tc_root [sct] result=$par"
}
return $nextState return $nextState
} }
@@ -42,9 +52,14 @@ namespace eval ::scobj::k2700 {
proc setValue {tc_root nextState cmd} { proc setValue {tc_root nextState cmd} {
debug_log "setValue root=$tc_root sct=[sct] cmd=$cmd target=[sct target]" debug_log "setValue root=$tc_root sct=[sct] cmd=$cmd target=[sct target]"
set par "[sct target]" set par "[sct target]"
sct send "$cmd $par" sct send "$cmd $par;*IDN?"
debug_log "setValue send: $cmd $par" debug_log "setValue send: $cmd $par"
return idle if {$par != [sct oldval]} {
sct oldval $par
sct update $par
sct utime readtime
debug_log "setValue new data for $tc_root [sct] result=$par"
}
return $nextState return $nextState
} }
@@ -143,21 +158,19 @@ debug_log "setPoint new data for $tc_root [sct] result=$par"
hdelprop [sct] geterror hdelprop [sct] geterror
} }
if {$my_state == "STATE_INIT"} { if {$my_state == "STATE_INIT"} {
set my_cmd "SYSTEM:PRESET" set my_cmd "SYSTEM:PRESET;*IDN?"
hsetprop $tc_root/device_state my_state "STATE_IDN" hsetprop $tc_root/device_state my_state "STATE_IDN"
#set nextState read set nextState read
set nextState idle
} elseif {$my_state == "STATE_IDN"} { } elseif {$my_state == "STATE_IDN"} {
set my_cmd "*IDN?" set my_cmd "*IDN?"
} elseif {$my_state == "STATE_CHNL_SET"} { } elseif {$my_state == "STATE_CHNL_SET"} {
set my_cmd "SENS:FUNC \"VOLTS:DC\"" set my_cmd "SENS:FUNC \"VOLTS:DC\";*IDN?"
set mmf [hval $tc_root/Control/MMF] set mmf [hval $tc_root/Control/MMF]
set mbf [hval $tc_root/Control/MBF] set mbf [hval $tc_root/Control/MBF]
set mun [hval $tc_root/Control/MUN] set mun [hval $tc_root/Control/MUN]
set my_cmd "CALC:FORM MXB;CALC:KMAT:MMF 1.0;CALC:KMAT:MBF 0.0;CALC:KMAT:MUN \"X\";CALC:STAT ON" set my_cmd "CALC:FORM MXB;CALC:KMAT:MMF 1.0;CALC:KMAT:MBF 0.0;CALC:KMAT:MUN \"X\";CALC:STAT ON"
hsetprop $tc_root/device_state my_state "STATE_CHNL_GET" hsetprop $tc_root/device_state my_state "STATE_CHNL_GET"
#set nextState read set nextState read
set nextState idle
} elseif {$my_state == "STATE_CHNL_GET"} { } elseif {$my_state == "STATE_CHNL_GET"} {
set my_cmd "CALC:STAT?" set my_cmd "CALC:STAT?"
} elseif {$my_state == "STATE_FIELD"} { } elseif {$my_state == "STATE_FIELD"} {
@@ -381,11 +394,11 @@ debug_log "Registering node $nodeName for write callback"
set scobj_hpath /sics/$tempobj set scobj_hpath /sics/$tempobj
# Group Node R W D type perm rdCmd rdFunc wrCmd wrFunc allowed # Group Node R W D type perm rdCmd rdFunc wrCmd wrFunc allowed
set deviceCommand {\ set deviceCommand {\
Control Math 0 1 0 text user {} {} {CALC:FORM} {setParm} {MXB}\ Control Math 0 1 0 text user {} {} {CALC1:FORM} {setParm} {MXB}\
Control MMF 0 1 0 float user {} {} {CALC:KMAT:MMF} {setValue} {}\ Control MMF 0 1 0 float user {} {} {CALC1:KMAT:MMF} {setValue} {}\
Control MBF 0 1 0 float user {} {} {CALC:KMAT:MBF} {setValue} {}\ Control MBF 0 1 0 float user {} {} {CALC1:KMAT:MBF} {setValue} {}\
Control MUN 0 1 0 text user {} {} {CALC:KMAT:MUN} {setText} {}\ Control MUN 0 1 0 text user {} {} {CALC1:KMAT:MUN} {setText} {}\
Control Stat 0 1 0 text user {} {} {CALC:STAT} {setParm} {ON,OFF}\ Control Stat 0 1 0 text user {} {} {CALC1:STAT} {setParm} {ON,OFF}\
Display Value 1 0 0 text internal {FETCH?} {rdValue} {} {} {}\ Display Value 1 0 0 text internal {FETCH?} {rdValue} {} {} {}\
{} Setpoint 0 0 0 text internal {} {} {} {} {}\ {} Setpoint 0 0 0 text internal {} {} {} {} {}\
Display X 0 0 0 text internal {} {} {} {} {}\ Display X 0 0 0 text internal {} {} {} {} {}\
@@ -419,9 +432,9 @@ debug_log "Registering node $nodeName for write callback"
hfactory $scobj_hpath/device_lasterror plain user text hfactory $scobj_hpath/device_lasterror plain user text
hset $scobj_hpath/device_lasterror "" hset $scobj_hpath/device_lasterror ""
# if {[SplitReply [environment_simulation]]=="false"} { if {[SplitReply [environment_simulation]]=="false"} {
# $sct_controller poll $scobj_hpath/device_state 1 halt read $sct_controller poll $scobj_hpath/device_state 1 halt read
# } }
hsetprop $scobj_hpath type part hsetprop $scobj_hpath type part
foreach snsr {Display} { foreach snsr {Display} {