Bilby Script Context drivers for galil-attached devices
This commit is contained in:
70
site_ansto/instrument/bilby/config/motors/tank.sct
Normal file
70
site_ansto/instrument/bilby/config/motors/tank.sct
Normal file
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# Simple driver generator for the non-motor galil controls on mc8
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
#
|
||||
driver tank = {
|
||||
usecreatenode = false
|
||||
vendor = galil; device = mc8; protocol = dmc2280;
|
||||
class = instrument
|
||||
simulation_group = motor_simulation
|
||||
#
|
||||
# Unnamed group has variables at device level
|
||||
#
|
||||
#
|
||||
# The named group is at the device level, variables below that
|
||||
#
|
||||
group switches = {
|
||||
type = text;
|
||||
priv = user;
|
||||
readable = 1;
|
||||
read_function = read_switch;
|
||||
var forward = {
|
||||
read_command = 'MG @IN[5]'
|
||||
}
|
||||
var reverse = {
|
||||
read_command = 'MG @IN[6]'
|
||||
}
|
||||
};
|
||||
group limits = {
|
||||
type = text;
|
||||
priv = user;
|
||||
readable = 1;
|
||||
read_function = read_switch;
|
||||
var forward = {
|
||||
read_command = 'MG _LFH'
|
||||
}
|
||||
var reverse = {
|
||||
read_command = 'MG _LRH'
|
||||
}
|
||||
};
|
||||
|
||||
#
|
||||
# Code lines start with '@' which is stripped before being emitted
|
||||
# The code is emitted at the appropriate place in the given function
|
||||
#
|
||||
code read_function read_switch = {
|
||||
@ if { [string equal -nocase -length 1 "${data}" "?"] } {
|
||||
@ sct geterror "Galil error in: '${data}'"
|
||||
@ } else {
|
||||
@ set data_list [split [string trim "${data}"]]
|
||||
@ if { [llength ${data_list}] > 1 && [lindex ${data_list} end] == ":" } {
|
||||
@ set data_list [lrange ${data_list} 0 0]
|
||||
@ }
|
||||
@ if { [llength ${data_list}] == 1 } {
|
||||
@ set left [expr [lindex ${data_list} 0]]
|
||||
@ if { ${left} == 1 } { # open
|
||||
@ set data "open"
|
||||
@ } else { # closed
|
||||
@ set data "closed"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error in: '${data}'=>'${data_list}'"
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
#
|
||||
# This code is after database creation
|
||||
#
|
||||
code mkDriver = {
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user