Regen of Mercury driver

This commit is contained in:
Douglas Clowes
2014-11-20 17:37:58 +11:00
parent 7960bab345
commit de766e465e

View File

@ -225,18 +225,17 @@ proc ::scobj::oxford_mercury::rdValue {tc_root} {
}
# rdValue hook code starts
set value [lindex [split "${data}" ":"] end]
if {[string equal -nocase [string index ${value} end] K]} {
set value [string range ${value} 0 end-1]
}
if {[string equal -nocase ${value} NaN]} {
if {[string equal -nocase -length 3 ${value} NaN]} {
set value 0
}
if {[string equal -nocase ${value} inf] || [string equal -nocase ${value} -inf]} {
if {[string equal -nocase -length 3 ${value} inf] || [string equal -nocase -length 4 ${value} -inf]} {
set value 0
}
if {![string is double ${value}]} {
if {![string is digit [string index ${value} 0]]} {
set value 0
}
debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]"
debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} data=${data} value=${value}"
scan ${value} "%g" data
# rdValue hook code ends
if { [hpropexists [sct] geterror] } {
@ -507,7 +506,7 @@ proc ::scobj::oxford_mercury::mkDriver { sct_controller name device_class simula
if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]} {
hfactory ${scobj_hpath}/Pres5/valve plain user float
hsetprop ${scobj_hpath}/Pres5/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:OPEN}
hsetprop ${scobj_hpath}/Pres5/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC}
hsetprop ${scobj_hpath}/Pres5/valve rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/Pres5/valve control true
hsetprop ${scobj_hpath}/Pres5/valve data true
@ -624,7 +623,7 @@ proc ::scobj::oxford_mercury::mkDriver { sct_controller name device_class simula
if {[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]} {
hfactory ${scobj_hpath}/Pres8/valve plain user float
hsetprop ${scobj_hpath}/Pres8/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:OPEN}
hsetprop ${scobj_hpath}/Pres8/valve read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC}
hsetprop ${scobj_hpath}/Pres8/valve rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/Pres8/valve control true
hsetprop ${scobj_hpath}/Pres8/valve data true
@ -1384,7 +1383,7 @@ proc ::scobj::oxford_mercury::mkDriver { sct_controller name device_class simula
}
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 read ${ns}::getValue ${scobj_hpath} rdValue {READ:DEV:DB4.G1:AUX:SIG:PERC}
hsetprop ${scobj_hpath}/Valve/sensor rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/Valve/sensor control true
hsetprop ${scobj_hpath}/Valve/sensor data true