diff --git a/site_ansto/instrument/config/environment/temperature/sct_rvasm2.tcl b/site_ansto/instrument/config/environment/temperature/sct_rvasm2.tcl index 312e4046..242347d6 100644 --- a/site_ansto/instrument/config/environment/temperature/sct_rvasm2.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_rvasm2.tcl @@ -56,6 +56,11 @@ debug_log "rdValue [sct] [sct result]" proc setTemp {tc_root nextState cmd} { debug_log "setTemp $tc_root $nextState $cmd [sct]=[sct target] [hget [sct]]" + if {[sct writestatus] == "start"} { + # Called by drive adapter + hset $tc_root/status "busy" + hsetprop $tc_root/setpoint driving 1 + } # ANSTO special temperature set temp [expr {10.0 * [sct target]}] set cmd "STT[format %04X [expr {int($temp)}]]" @@ -65,7 +70,7 @@ debug_log "rdValue [sct] [sct result]" } proc rdTemp {tc_root} { -debug_log "rdTemp [sct] [sct result]" + debug_log "rdTemp [sct] [sct result]" set data [sct result] switch -glob -- $data { "ASCERR:*" { @@ -108,6 +113,7 @@ debug_log "rdTemp [sct] [sct result]" sct utime readtime debug_log "update result data=$data, oldval=[sct oldval]" } + # TODO handle end of drive command } } } @@ -526,7 +532,12 @@ debug_log "setPoint $cmd $par" sct load_status "loading" sct idle_temp $dec_temp sct final_time $dec_time - sct profile "[join $lines " "]" + sct max_index [llength $lines] + for {set line_no 0} {$line_no < [llength $lines]} {incr line_no} { + set name profile_line_[format "%03d" $line_no] + set profile_line [lindex $lines $line_no] + sct $name $profile_line + } sct oldval [sct target] sct update [sct target] sct utime readtime @@ -537,8 +548,8 @@ debug_log "setPoint $cmd $par" } sct send "RTC" } else { - set my_list [split [sct profile] " "] - set my_item [lindex $my_list $my_index] + set name profile_line_[format "%03d" $my_index] + set my_item "[set $name]" sct send "$my_item" } return $nextState @@ -560,10 +571,9 @@ debug_log "setPoint $cmd $par" # TODO Check response to LT... sct print "LT=>[sct result]" } - set my_list [split [sct profile] " "] set my_index [expr {$my_index + 1}] sct index $my_index - if {$my_index > [llength $my_list]} { + if {$my_index >= [sct max_index]} { sct index -1 sct load_status "loaded" return "idle" @@ -697,7 +707,7 @@ debug_log "chkWrite new data for $tc_root [sct] result=$data" # Check that the sensor is reading within tolerance of the setpoint. # Return 1 or 0 if it is or is not, respectively. proc checktol {tc_root currtime timecheck} { -debug_log "checktol $tc_root $currtime $timecheck" + debug_log "checktol $tc_root $currtime $timecheck" set temp [hval $tc_root/sensor/value] set lotemp [hval $tc_root/subtemp_warnlimit] set hitemp [hval $tc_root/overtemp_warnlimit] @@ -719,7 +729,9 @@ debug_log "checktol $tc_root $currtime $timecheck" # NOTE: The drive adapter initially sets the writestatus to "start" and will # only call this when writestatus!="start" proc drivestatus {tc_root} { + debug_log "drivestatus $tc_root driving=[sct driving]" if {[sct driving]} { + # TODO handle end of drive command return busy } else { sct print "drivestatus: idle"