initial commit
This commit is contained in:
49
tcl/drivers/cemhack.tcl
Normal file
49
tcl/drivers/cemhack.tcl
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace eval cemhack {} {
|
||||
}
|
||||
|
||||
proc stdConfig::cemhack {bronkobj} {
|
||||
controller syncedprot
|
||||
|
||||
obj CEM_HACK rd
|
||||
prop read cemhack::read
|
||||
prop obj $bronkobj
|
||||
prop register_update 1
|
||||
|
||||
kids "CEM workaround" {
|
||||
node set par 0
|
||||
node prop par 5
|
||||
node offset par 2.5
|
||||
}
|
||||
}
|
||||
|
||||
proc cemhack::read {} {
|
||||
if {[sct register_update]} {
|
||||
on_update_call [sct obj] cemhack::update
|
||||
}
|
||||
sct register_update 1
|
||||
# cemhack::update will set this flag to 0
|
||||
return idle
|
||||
}
|
||||
|
||||
proc cemhack::update {} {
|
||||
sct on_update_call_cnt 5
|
||||
set t [sct value]
|
||||
sct register_update 0
|
||||
if {$t == 0} {
|
||||
set t [hval [sct]]
|
||||
} else {
|
||||
sct update $t
|
||||
}
|
||||
set soll [hval [sct]/set]
|
||||
set prop [hval [sct]/prop]
|
||||
set offset [hval [sct]/offset]
|
||||
set output [expr $offset + $prop * ($soll - $t)]
|
||||
if {$output > 100} {
|
||||
set output 100
|
||||
} elseif {$output < 0} {
|
||||
set output 0
|
||||
}
|
||||
hset [sct obj]/output $output
|
||||
return idle
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user