Adjust ramp rate to 1/45 instead of 1/32 and calculate ramp anyway

r3130 | dcl | 2011-05-11 10:11:50 +1000 (Wed, 11 May 2011) | 1 line
This commit is contained in:
Douglas Clowes
2011-05-11 10:11:50 +10:00
parent 4303047433
commit c62f3dd24b

View File

@@ -496,7 +496,7 @@ debug_log "setPoint $cmd $par"
} elseif {$the_type == "S"} {
} elseif {$the_type == "T"} {
set the_valu [expr {round($the_valu * 10.0)}]
set the_ramp [expr {round($the_ramp * 10.0 /32 * 32768)}]
set the_ramp [expr {round($the_ramp * 10.0 /45 * 32768)}]
} else {
sct geterror "Profile error: $line"
sct print "Profile error: $line"
@@ -532,7 +532,39 @@ debug_log "setPoint $cmd $par"
sct load_status "loading"
sct idle_temp $dec_temp
sct final_time $dec_time
sct max_index [llength $lines]
sct profile_line_count [llength $lines]
set last_temp_index -1
for {set line_no 0} {$line_no < [llength $lines]} {incr line_no} {
set this_line [lindex $lines $line_no]
if {[string index $this_line 4] == "T"} {
sct print "Examining $this_line"
if {$last_temp_index >= 0} {
set last_line [lindex $lines $last_temp_index]
scan [string range $last_line 5 18] "%06x%04x%04x" last_time last_temp last_ramp
if {$last_ramp > 0x7FFF} {
set last_ramp [expr {$last_ramp - 0x10000}]
}
sct print "Last: time=[format "%6d" $last_time], temp=[format "%4d" $last_temp], ramp=$last_ramp"
scan [string range $this_line 5 18] "%06x%04x%04x" this_time this_temp this_ramp
if {$this_ramp > 0x7FFF} {
set this_ramp [expr {$this_ramp - 0x10000}]
}
sct print "This: time=[format "%6d" $this_time], temp=[format "%4d" $this_temp], ramp=$this_ramp"
if {($this_time != $last_time) && ($this_temp != $last_temp)} {
set the_ramp [expr {round(32768.0 * ($this_temp - $last_temp) / ($this_time - $last_time))}]
if {$the_ramp != $last_ramp} {
sct print "Changing Ramp from $last_ramp to $the_ramp"
set the_ramp [string range [format "%04X" $the_ramp] end-3 end]
set new_line "[string range $last_line 0 14]${the_ramp}"
lset lines $last_temp_index $new_line
} else {
sct print "Leaving Ramp from $last_ramp as $the_ramp"
}
}
}
set last_temp_index $line_no
}
}
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]
@@ -549,7 +581,7 @@ debug_log "setPoint $cmd $par"
sct send "RTC"
} else {
set name profile_line_[format "%03d" $my_index]
set my_item "[set $name]"
set my_item "[sct $name]"
sct send "$my_item"
}
return $nextState
@@ -573,7 +605,7 @@ debug_log "setPoint $cmd $par"
}
set my_index [expr {$my_index + 1}]
sct index $my_index
if {$my_index >= [sct max_index]} {
if {$my_index >= [sct profile_line_count]} {
sct index -1
sct load_status "loaded"
return "idle"