Start of sct generator description file for Julabo LH45

This commit is contained in:
Douglas Clowes
2014-02-03 10:57:41 +11:00
parent a2120c79e8
commit 964d218a20

View File

@ -0,0 +1,112 @@
#
# Simple driver generator for the Julabo LH45
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
#
driver julabo_lh45_gen = {
usecreatenode = false
vendor = julabo; device = lh45; protocol = std;
class = environment
simulation_group = environment_simulation
add_args = '{sensor "bath"} {tol 5.0}';
make_args = 'sensor tol';
protocol_args = '"\r"';
#
# Unnamed group has variables at device level
#
group = {
priv = user
type = float
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
}
var overtemp_warnlimit = {
readable = 1
read_command = 'in_sp_03'
#write_command = 'out_sp_03'
}
var subtemp_warnlimit = {
readable = 1
read_command = 'in_sp_04'
#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
read_command = 'status';
fetch_function = getState
read_function = rdState
}
var lh45_lasterror = { type = text; }
var remote_ctrl = { type = text; priv = spy; }
}
#
# The named group is at the device level, variables below that
#
group sensor = {
type = float;
priv = internal;
readable = 1;
var 'value' = { read_command = 'in_pv_00'; units = 'C' };
var bathtemp = { read_command = 'in_pv_00'; units = 'C' };
};
#
# 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 = {
}
#
# This code is after database creation
#
code mkDriver = {
@# TODO use the ${sensor} and ${tol} arguments
}
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}
@ }
@ }
@ }
}
};