add drivers from l_samenv@samenv
This commit is contained in:
52
tcl/drivers/luft.tcl
Normal file
52
tcl/drivers/luft.tcl
Normal file
@ -0,0 +1,52 @@
|
||||
namespace eval luft {} {
|
||||
}
|
||||
|
||||
proc stdConfig::luft {label} {
|
||||
controller syncedprot
|
||||
|
||||
pollperiod 10 10
|
||||
|
||||
obj LUFT upd
|
||||
kids "luft monitor $label" {
|
||||
node confirm wr -text -spy
|
||||
prop write luft::writeCf
|
||||
prop read luft::readCf
|
||||
prop timeout [expr [clock seconds] + 600]
|
||||
}
|
||||
}
|
||||
|
||||
proc luft::set_error {errtxt} {
|
||||
updateval [sct parent]/status $errtxt
|
||||
if {$errtxt eq ""} {
|
||||
catch {hdelprop [sct parent] geterror}
|
||||
catch {hdelprop [sct] geterror}
|
||||
} else {
|
||||
updateerror [sct parent]/status $errtxt 1
|
||||
}
|
||||
}
|
||||
|
||||
proc luft::readCf {} {
|
||||
if {[clock seconds] > [sct timeout]} {
|
||||
luft::set_error "luft monitor off"
|
||||
}
|
||||
return idle
|
||||
}
|
||||
|
||||
proc luft::writeCf {} {
|
||||
sct cnt 0
|
||||
set errtxt [lassign [sct target] timeout val]
|
||||
if {[silent 0 sct verbose]} {
|
||||
clientput [sct target]
|
||||
}
|
||||
if {$errtxt eq ""} {
|
||||
updateval [sct parent] $val
|
||||
# sct print [sct]=$val
|
||||
luft::set_error ""
|
||||
} else {
|
||||
luft::set_error "epics error: $val $errtxt"
|
||||
}
|
||||
if {[scan [lindex [sct target] 0] %d period]} {
|
||||
sct timeout [expr [clock seconds] + $period + 10]
|
||||
}
|
||||
return idle
|
||||
}
|
Reference in New Issue
Block a user