initial commit
This commit is contained in:
97
tcl/drivers/cp2800.tcl
Normal file
97
tcl/drivers/cp2800.tcl
Normal file
@ -0,0 +1,97 @@
|
||||
namespace eval cp2800 {} {
|
||||
}
|
||||
|
||||
proc stdConfig::cp2800 {} {
|
||||
controller bin sycon-crc 10
|
||||
prop startcmd "int 99 hex 2b 0d 00 / skip4 int4 crc"
|
||||
prop read cp2800::read
|
||||
|
||||
obj BIN wr
|
||||
prop hash 5f95
|
||||
prop label "compressor is running"
|
||||
# checkbox
|
||||
prop enum 1
|
||||
prop write cp2800::switch
|
||||
prop mmreset cp2800::mmreset
|
||||
poll 5 read mmreset
|
||||
kids "cp2800 monitor values" {
|
||||
cp2800_node comp_running_hrs 454c [expr 1/60.0]
|
||||
prop fmt %.1f
|
||||
|
||||
cp2800_node cpu_t 3574
|
||||
|
||||
cp2800_node motor_current_a 638b 1.0
|
||||
|
||||
cp2800_temp inp_water_t 0
|
||||
cp2800_temp out_water_t 1
|
||||
cp2800_temp helium_t 2
|
||||
cp2800_temp oil_t 3
|
||||
|
||||
cp2800_press high_side_p 0
|
||||
cp2800_node high_side_p_avg 7e90
|
||||
|
||||
cp2800_press low_side_p 0
|
||||
cp2800_node low_side_p_avg bb94
|
||||
|
||||
cp2800_node high_side_delta_p_avg 319c
|
||||
|
||||
cp2800_node high_side_bounce 66fa
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
proc stdConfig::cp2800_node {name hash {fact 0.1}} {
|
||||
node $name rd
|
||||
prop hash $hash
|
||||
if {$fact eq "0.1"} {
|
||||
prop fmt "%.1f"
|
||||
}
|
||||
prop fact $fact
|
||||
}
|
||||
|
||||
proc stdConfig::cp2800_temp {name index} {
|
||||
cp2800_node $name "0d8f $index"
|
||||
cp2800_node ${name}_min "6e58 $index"
|
||||
cp2800_node ${name}_max "8a1c $index"
|
||||
}
|
||||
|
||||
proc stdConfig::cp2800_press {name index} {
|
||||
cp2800_node $name "aa50 $index"
|
||||
cp2800_node ${name}_min "5e0b $index"
|
||||
cp2800_node ${name}_max "7a62 $index"
|
||||
}
|
||||
|
||||
proc cp2800::read {} {
|
||||
set i 0
|
||||
scan [sct hash] "%x %d" hash i
|
||||
sct send "int 99 int2 $hash int1 $i / skip4 int4 crc"
|
||||
return cp2800::update
|
||||
}
|
||||
|
||||
proc cp2800::update {} {
|
||||
set res [lindex [split [sct result]] 0]
|
||||
sct update [expr [silent 1 sct fact] * $res]
|
||||
return idle
|
||||
}
|
||||
|
||||
proc cp2800::switch {} {
|
||||
if {[sct target] eq "1"} {
|
||||
scan d501 "%x" hash
|
||||
sct send "int 97 int2 $hash int1 0 int4 1 / crc "
|
||||
sct print "start compressor"
|
||||
sct update 1
|
||||
} else {
|
||||
scan c598 "%x" hash
|
||||
sct send "int 97 int2 $hash int1 0 int4 0 / crc "
|
||||
sct print "stop compressor"
|
||||
sct update 0
|
||||
}
|
||||
return stdSct::complete
|
||||
}
|
||||
|
||||
proc cp2800::mmreset {} {
|
||||
scan d3db "%x" hash
|
||||
sct send "int 97 int2 $hash int1 0 int4 1 / crc "
|
||||
return stdSct::complete
|
||||
}
|
||||
|
Reference in New Issue
Block a user