Updated julabo SCT template
This commit is contained in:
@@ -4,53 +4,45 @@
|
||||
#
|
||||
driver julabo_lh45_gen = {
|
||||
vendor = julabo; device = lh45; protocol = std;
|
||||
class = environment
|
||||
class = environment;
|
||||
simulation_group = environment_simulation
|
||||
add_args = '{sensor "bath"} {tol 5.0}';
|
||||
make_args = 'sensor tol';
|
||||
debug_threshold = 1;
|
||||
add_args = '{id 1} {ctrl_sensor "bath"} {tol 5.0}';
|
||||
make_args = 'id ctrl_sensor tol';
|
||||
protocol_args = '"\r"';
|
||||
#
|
||||
# Unnamed group has variables at device level
|
||||
#
|
||||
group = {
|
||||
priv = user
|
||||
type = float
|
||||
priv = user;
|
||||
type = float;
|
||||
readable = 1;
|
||||
var setpoint = {
|
||||
driveable = sensor/'value'
|
||||
readable = 1
|
||||
read_command = 'in_sp_00'
|
||||
write_function = setPoint
|
||||
write_command = 'out_sp_00'
|
||||
lowerlimit = 10
|
||||
upperlimit = 90
|
||||
tolerance = 2
|
||||
property 'units' = C;
|
||||
read_command = 'in_sp_00';
|
||||
permlink = 'T.SP01';
|
||||
writeable = 1; write_function = setPoint; write_command = 'out_sp_00';
|
||||
driveable = sensor/'value';
|
||||
lowerlimit = 10; upperlimit = 90; tolerance = '${tol}';
|
||||
}
|
||||
var overtemp_warnlimit = {
|
||||
readable = 1
|
||||
read_command = 'in_sp_03'
|
||||
#write_command = 'out_sp_03'
|
||||
read_command = 'in_sp_03';
|
||||
# writeable = 1; write_command = 'out_sp_03';
|
||||
}
|
||||
var subtemp_warnlimit = {
|
||||
readable = 1
|
||||
read_command = 'in_sp_04'
|
||||
#write_command = 'out_sp_04'
|
||||
read_command = 'in_sp_04';
|
||||
# writeable = 1; write_command = 'out_sp_04';
|
||||
}
|
||||
var heating_power_percent = {
|
||||
readable = 1
|
||||
read_command = 'in_pv_01';
|
||||
};
|
||||
var power = {
|
||||
readable = 1
|
||||
read_command = 'in_mode_05';
|
||||
writeable = 1;
|
||||
write_command = 'out_mode_05';
|
||||
};
|
||||
var lh45_state = {
|
||||
readable = 1
|
||||
type = text;
|
||||
read_command = 'status';
|
||||
fetch_function = getState
|
||||
read_function = rdState
|
||||
fetch_function = getState;
|
||||
read_function = rdState;
|
||||
}
|
||||
readable = 0;
|
||||
var lh45_lasterror = { type = text; }
|
||||
var remote_ctrl = { type = text; priv = spy; }
|
||||
}
|
||||
@@ -61,51 +53,94 @@ driver julabo_lh45_gen = {
|
||||
type = float;
|
||||
priv = internal;
|
||||
readable = 1;
|
||||
var 'value' = { read_command = 'in_pv_00'; units = 'C' };
|
||||
var bathtemp = { read_command = 'in_pv_00'; units = 'C' };
|
||||
property 'units' = 'C';
|
||||
var bathtemp = { read_function = rdSensor; read_command = 'in_pv_00'; property external = 0; };
|
||||
var external = { read_function = rdSensor; read_command = 'in_pv_02'; property external = 1; };
|
||||
readable = 0;
|
||||
var 'value' = { permlink = 'T.S01'; };
|
||||
var start_temperature = {};
|
||||
var end_temperature;
|
||||
};
|
||||
|
||||
group mode = {
|
||||
type = int;
|
||||
priv = user;
|
||||
readable = 1;
|
||||
writeable = 1;
|
||||
var on_else_off = { read_command = 'in_mode_05'; write_command = 'out_mode_05'; };
|
||||
var ext_else_bath = { read_command = 'in_mode_04'; write_command = 'out_mode_04'; };
|
||||
};
|
||||
#
|
||||
# Code lines start with '@' which is stripped before being emitted into generated driver
|
||||
# The code is emitted at the appropriate place in the given function
|
||||
#
|
||||
code read_function rdValue = {
|
||||
}
|
||||
code Write_function setPoint = {
|
||||
}
|
||||
code read_function rdSensor = {%%
|
||||
if { [string equal -length 6 [sct result] "---.--"] } {
|
||||
return ${nextState}
|
||||
}
|
||||
if { [hval ${tc_root}/mode/ext_else_bath] == [sct external] } {
|
||||
set target [pathname [sct]]/value
|
||||
set oldval [hgetpropval ${target} oldval]
|
||||
if {${data} != ${oldval} } {
|
||||
debug_log ${tc_root} 1 "[sct] changed ${target} to new:${data}, from old:${oldval}"
|
||||
hsetprop ${target} oldval ${data}
|
||||
hupdate ${target} ${data}
|
||||
hsetprop ${target} readtime [sct utime]
|
||||
}
|
||||
}
|
||||
%%}
|
||||
|
||||
code Write_function setPoint = {%%
|
||||
# Put a space between command and param
|
||||
set cmd "${cmd_str} ${par}"
|
||||
# Hack to get a response
|
||||
set cmd "${cmd}\r\nversion"
|
||||
%%}
|
||||
|
||||
code Write_function setValue = {%%
|
||||
# Put a space between command and param
|
||||
set cmd "${cmd_str} ${par}"
|
||||
# Hack to get a response
|
||||
set cmd "${cmd}\r\nversion"
|
||||
%%}
|
||||
#
|
||||
# This code is after database creation
|
||||
#
|
||||
code mkDriver = {
|
||||
@# TODO use the ${sensor} and ${tol} arguments
|
||||
}
|
||||
code mkDriver = {%%
|
||||
if { ${ctrl_sensor} == "external" } {
|
||||
hset ${scobj_hpath}/mode/ext_else_bath 1
|
||||
} else {
|
||||
hset ${scobj_hpath}/mode/ext_else_bath 0
|
||||
}
|
||||
hsetprop ${scobj_hpath}/setpoint tolerance ${tol}
|
||||
%%}
|
||||
|
||||
code read_function rdState = {
|
||||
@ if {${data} != [sct oldval]} {
|
||||
@ debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
@ sct oldval ${data}
|
||||
@ sct update ${data}
|
||||
@ sct utime readtime
|
||||
@ switch -- [lindex ${data} 0] {
|
||||
@ "00" {
|
||||
@ hset ${tc_root}/remote_ctrl False
|
||||
@ }
|
||||
@ "01" {
|
||||
@ hset ${tc_root}/remote_ctrl False
|
||||
@ }
|
||||
@ "02" {
|
||||
@ hset ${tc_root}/remote_ctrl True
|
||||
@ }
|
||||
@ "03" {
|
||||
@ hset ${tc_root}/remote_ctrl True
|
||||
@ }
|
||||
@ default {
|
||||
@ hset ${tc_root}/remote_ctrl UNKNOWN
|
||||
@ hset ${tc_root}/lh45_lasterror ${data}
|
||||
@ sct geterror ${data}
|
||||
@ }
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
code read_function rdState = {%%
|
||||
if {${data} != [sct oldval]} {
|
||||
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
switch -- [lindex ${data} 0] {
|
||||
"00" {
|
||||
hset ${tc_root}/remote_ctrl False
|
||||
}
|
||||
"01" {
|
||||
hset ${tc_root}/remote_ctrl False
|
||||
}
|
||||
"02" {
|
||||
hset ${tc_root}/remote_ctrl True
|
||||
}
|
||||
"03" {
|
||||
hset ${tc_root}/remote_ctrl True
|
||||
}
|
||||
default {
|
||||
hset ${tc_root}/remote_ctrl UNKNOWN
|
||||
hset ${tc_root}/lh45_lasterror ${data}
|
||||
sct geterror ${data}
|
||||
}
|
||||
}
|
||||
}
|
||||
%%}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user