Rework the LS-218 driver to make it flexible.

This commit is contained in:
Douglas Clowes
2014-06-25 12:19:35 +10:00
parent 648c8003b7
commit 2676ab9282
2 changed files with 75 additions and 72 deletions

View File

@@ -11,33 +11,28 @@ driver lakeshore_218 = {
var krdg = {
type = text;
read_command = "KRDG? 0";
read_function = read_temps;
value = "0,0,0,0,0,0,0,0";
}
}
group sensor = {
priv = user;
priv = user; mutable = true;
type = float;
mutable = true;
var ch1 = { type = float; units = 'K'; }
var ch2 = { type = float; units = 'K'; }
var ch3 = { type = float; units = 'K'; }
var ch4 = { type = float; units = 'K'; }
var ch5 = { type = float; units = 'K'; }
var ch6 = { type = float; units = 'K'; }
var ch7 = { type = float; units = 'K'; }
var ch8 = { type = float; units = 'K'; }
readable = 1;
fetch_function = getTemp;
var ch1 = { read_command = '0'; }
var ch2 = { read_command = '1'; }
var ch3 = { read_command = '2'; }
var ch4 = { read_command = '3'; }
var ch5 = { read_command = '4'; }
var ch6 = { read_command = '5'; }
var ch7 = { read_command = '6'; }
var ch8 = { read_command = '7'; }
}
code read_temps = {%%
set temps [split "${data}" ","]
hupdate ${tc_root}/sensor/ch1 [lindex ${temps} 0]
hupdate ${tc_root}/sensor/ch2 [lindex ${temps} 1]
hupdate ${tc_root}/sensor/ch3 [lindex ${temps} 2]
hupdate ${tc_root}/sensor/ch4 [lindex ${temps} 3]
hupdate ${tc_root}/sensor/ch5 [lindex ${temps} 4]
hupdate ${tc_root}/sensor/ch6 [lindex ${temps} 5]
hupdate ${tc_root}/sensor/ch7 [lindex ${temps} 6]
hupdate ${tc_root}/sensor/ch8 [lindex ${temps} 7]
code fetch_function getTemp = {%%
set temps [split "[hval ${tc_root}/krdg]" ","]
sct result [lindex ${temps} ${cmd_str}]
set cmd "@@NOSEND@@"
%%}
}