Files
sea/tcl/drivers/vaisala.tcl
2022-08-18 15:04:28 +02:00

36 lines
828 B
Tcl

# horst T controller for humidity cell
# serial settings: 9600 baud/8 bits/parity even/1 stop
# special binary protocol, byte order is inversed! (float3 means byte 0 is at position 3)
namespace eval vaisala {} {
}
proc stdConfig::vaisala {{label ""} {temp_path "/t"}} {
if {$label eq ""} {
variable name
set label $name
}
controller std "\r\n"
prop startcmd "vers"
obj Vaisala_hmt330 rd
prop readcmd "send"
prop update vaisala::update
kids $label {
node tpath -text par $temp_path
node td upd
#node tdf upd :# taupunkt ueber eis
}
}
proc vaisala::update {} {
lassign [sct result] td tdf
updateval [sct]/td $td
# updateval [sct]/tdf $tdf
set p0 [hcell::psat $td]
set p1 [hcell::psat [hvali [hval [sct]/tpath]]]
sct update [expr min(120., 100.0 * $p0 / $p1)]
return idle
}