Allow ASCII CSV profile input
In the format <type>,<time>,<value>,<ramp> r3126 | dcl | 2011-05-06 12:34:08 +1000 (Fri, 06 May 2011) | 4 lines
This commit is contained in:
@@ -478,6 +478,32 @@ debug_log "setPoint $cmd $par"
|
||||
close $f
|
||||
break
|
||||
}
|
||||
set parts [split $line ","]
|
||||
if {[llength $parts] == 4} {
|
||||
set the_type [string toupper [lindex $parts 0]]
|
||||
set the_time [lindex $parts 1]
|
||||
set the_valu [lindex $parts 2]
|
||||
set the_ramp [lindex $parts 3]
|
||||
if {$the_type == "I"} {
|
||||
set the_valu [expr {round($the_valu * 10.0)}]
|
||||
set the_ramp [expr {round($the_ramp * 10.0)}]
|
||||
} 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)}]
|
||||
} else {
|
||||
sct geterror "Profile error: $line"
|
||||
sct print "Profile error: $line"
|
||||
close $f
|
||||
return idle
|
||||
}
|
||||
set the_line [format "%02X" [llength $lines]]
|
||||
set the_time [format "%06X" [expr {round($the_time * 45.0)}]]
|
||||
set the_valu [format "%04X" $the_valu]
|
||||
set the_ramp [string range [format "%04X" $the_ramp] end-3 end]
|
||||
set old_line $line
|
||||
set line "LT${the_line}${the_type}${the_time}${the_valu}${the_ramp}"
|
||||
}
|
||||
if {[string length $line] != 19} {
|
||||
sct geterror "Profile error: $line"
|
||||
sct print "Profile error: $line"
|
||||
|
||||
Reference in New Issue
Block a user