Changes to Mercury driver

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

View File

@ -63,7 +63,7 @@ for i in range(8):
var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB5.P1:PRES:NICK'; read_function = rdText; } var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB5.P1:PRES:NICK'; read_function = rdText; }
var valve = { var valve = {
conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]'; conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]';
read_command = 'READ:DEV:DB4.G1:AUX:SIG:OPEN'; read_command = 'READ:DEV:DB4.G1:AUX:SIG:PERC';
} }
var setpoint = { var setpoint = {
conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]'; conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 4] 4]';
@ -80,7 +80,7 @@ for i in range(8):
var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB8.P1:PRES:NICK'; read_function = rdText; } var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB8.P1:PRES:NICK'; read_function = rdText; }
var valve = { var valve = {
conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]'; conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]';
read_command = 'READ:DEV:DB4.G1:AUX:SIG:OPEN'; read_command = 'READ:DEV:DB4.G1:AUX:SIG:PERC';
} }
var setpoint = { var setpoint = {
conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]'; conditional = '[string equal -nocase [string index ${cards} 3] V] && [string equal -nocase [string index ${assoc} 7] 4]';
@ -95,7 +95,7 @@ for i in range(8):
conditional = '[string equal -nocase [string index ${cards} 3] V]'; conditional = '[string equal -nocase [string index ${cards} 3] V]';
priv = user; type = float; priv = user; type = float;
var sensor = { var sensor = {
readable = 5; read_command = 'READ:DEV:DB4.G1:AUX:SIG:OPEN'; readable = 5; read_command = 'READ:DEV:DB4.G1:AUX:SIG:PERC';
} }
var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB4.G1:AUX:NICK'; read_function = rdText; } var nick = { type=text; readable = 15; read_command = 'READ:DEV:DB4.G1:AUX:NICK'; read_function = rdText; }
var setpoint = { var setpoint = {
@ -116,18 +116,17 @@ for i in range(8):
code read_function rdValue = { code read_function rdValue = {
@TCL @TCL
set value [lindex [split "${data}" ":"] end] set value [lindex [split "${data}" ":"] end]
if {[string equal -nocase [string index ${value} end] K]} { if {[string equal -nocase -length 3 ${value} NaN]} {
set value [string range ${value} 0 end-1]
}
if {[string equal -nocase ${value} NaN]} {
set value 0 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 set value 0
} }
if {![string is double ${value}]} { if {![string is digit [string index ${value} 0]]} {
set 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 scan ${value} "%g" data
@END @END
} }