Regen SCT drivers

This commit is contained in:
Douglas Clowes
2014-09-29 16:48:19 +10:00
parent f86dc33081
commit 3ad3bf3524
20 changed files with 639 additions and 200 deletions

View File

@@ -86,7 +86,12 @@ proc ::scobj::mercury_valve::checkstatus {tc_root} {
# checkstatus hook code goes here
if {[sct driving]} {
set sp "[sct target]"
set pv "[hval ${tc_root}/[sct driveable]]"
if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
set pv "${sp}"
hset ${tc_root}/[sct driveable] ${sp}
}
set pv "[hval ${tc_root}/[sct driveable]]"
}
if { abs(${pv} - ${sp}) <= [sct tolerance] } {
if { [hpropexists [sct] settle_time] } {
if { [hpropexists [sct] settle_time_start] } {
@@ -256,9 +261,10 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name device_class simulat
set scobj_hpath /sics/${name}
# Start of named group: Valve
hfactory ${scobj_hpath}/Valve plain spy none
# Start of var: sensor
hfactory ${scobj_hpath}/Valve/sensor plain user float
hsetprop ${scobj_hpath}/Valve/sensor read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:OPEN}
hsetprop ${scobj_hpath}/Valve/sensor rdValue ${ns}::rdValue ${scobj_hpath}
@@ -276,11 +282,13 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name device_class simulat
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/Valve/sensor 5
hsetprop ${scobj_hpath}/%s simulated false
} else {
::scobj::mercury_valve::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_valve"
hsetprop ${scobj_hpath}/%s simulated true
}
# Start of var: setpoint
hfactory ${scobj_hpath}/Valve/setpoint plain user float
hsetprop ${scobj_hpath}/Valve/setpoint write ${ns}::setValve ${scobj_hpath} noResponse {SET:DEV:DB4.G1:AUX:SIG:OPEN:}
hsetprop ${scobj_hpath}/Valve/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
@@ -308,12 +316,15 @@ proc ::scobj::mercury_valve::mkDriver { sct_controller name device_class simulat
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} write ${scobj_hpath}/Valve/setpoint
hsetprop ${scobj_hpath}/%s simulated false
} else {
::scobj::mercury_valve::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for mercury_valve"
hsetprop ${scobj_hpath}/%s simulated true
}
hsetprop ${scobj_hpath}/Valve data "true"
hsetprop ${scobj_hpath}/Valve klass "@none"
hsetprop ${scobj_hpath}/Valve type "part"
# End of named group: Valve
ansto_makesctdrive ${name}_Valve_setpoint ${scobj_hpath}/Valve/setpoint ${scobj_hpath}/Valve/sensor ${sct_controller}
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true