Add load_status, final_time and idle_temp as properties of profile

r3125 | dcl | 2011-05-04 16:33:42 +1000 (Wed, 04 May 2011) | 1 line
This commit is contained in:
Douglas Clowes
2011-05-04 16:33:42 +10:00
parent d275ce5509
commit 3be707a269

View File

@@ -467,20 +467,39 @@ debug_log "setPoint $cmd $par"
if {[file exists "[sct target]"] && [file readable "[sct target]"]} {
sct print "opening [file normalize "[sct target]"]"
set f [open "[sct target]"]
sct idle_temp "UNKNOWN"
sct final_time "UNKNOWN"
sct load_status "UNKNOWN"
set dec_temp "UNKNOWN"
set dec_time "UNKNOWN"
while {1} {
set line [gets $f]
if {[eof $f]} {
close $f
break
}
if {[string length $line] != 19} {
sct geterror "Profile error: $line"
sct print "Profile error: $line"
close $f
return idle
}
if {[string range $line 0 1] != "LT"} {
sct geterror "Profile error: $line"
sct print "Profile error: $line"
close $f
return idle
}
set rslt [scan $line "LT%2x%1s%6x%4x%4x" the_line the_type the_time the_valu the_ramp]
if {"$the_type" == "I"} {
set dec_temp [format "%.1f" [expr {0.1 * $the_valu}]]
}
set dec_time [expr {$the_time / 45.0}]
lappend lines $line
}
sct load_status "loading"
sct idle_temp $dec_temp
sct final_time $dec_time
sct profile "[join $lines " "]"
sct oldval [sct target]
sct update [sct target]
@@ -520,6 +539,7 @@ debug_log "setPoint $cmd $par"
sct index $my_index
if {$my_index > [llength $my_list]} {
sct index -1
sct load_status "loaded"
return "idle"
}
return "write"
@@ -858,6 +878,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable\
hset $scobj_hpath/emon/errhandler "pause"
hsetprop $scobj_hpath/profile index -1
hsetprop $scobj_hpath/profile load_status "UNKNOWN"
if {[SplitReply [environment_simulation]]=="false"} {
debug_log "Registering node $scobj_hpath/device_state for poll at 1 seconds"