initial commit
This commit is contained in:
54
tcl/drivers/ami136.tcl
Normal file
54
tcl/drivers/ami136.tcl
Normal file
@@ -0,0 +1,54 @@
|
||||
namespace eval ami136 {} {
|
||||
}
|
||||
|
||||
proc stdConfig::ami136 {{unit cm}} {
|
||||
controller std \r\n 10
|
||||
if {$unit ne "cm" && $unit ne "percent"} {
|
||||
error "illegal ami136 unit: $unit"
|
||||
}
|
||||
prop startcmd $unit
|
||||
|
||||
obj ami_level rd
|
||||
prop readcmd "level"
|
||||
prop update ami136::update
|
||||
prop last -2
|
||||
kids "LHe vessel" {
|
||||
node mode -int wr
|
||||
prop enum slow,fast
|
||||
prop write ami136::wrmode
|
||||
prop read ami136::rdmode
|
||||
}
|
||||
}
|
||||
|
||||
proc ami136::update {} {
|
||||
set res [sct result]
|
||||
# workaround for misreadings
|
||||
if {abs($res - [sct last]) < 0.5} {
|
||||
sct update $res
|
||||
}
|
||||
sct last $res
|
||||
return idle
|
||||
}
|
||||
|
||||
proc ami136::wrmode {} {
|
||||
if {[sct target]} {
|
||||
sct send "interval=0"
|
||||
} else {
|
||||
sct send "interval=10"
|
||||
}
|
||||
return stdSct::completeUpdate
|
||||
}
|
||||
|
||||
proc ami136::rdmode {} {
|
||||
sct send interval
|
||||
return ami136::updmode
|
||||
}
|
||||
|
||||
proc ami136::updmode {} {
|
||||
if {[sct result] < 0.25} {
|
||||
sct update 1
|
||||
} else {
|
||||
sct update 0
|
||||
}
|
||||
return idle
|
||||
}
|
||||
Reference in New Issue
Block a user