Add fields to 3He driver

This commit is contained in:
Douglas Clowes
2014-10-27 14:35:16 +11:00
parent 1b7eddc015
commit 62481b76c5

View File

@ -15,6 +15,11 @@ driver he3_polanal = {
check_function = chkWrite;
allowed = "+,-,0"
}
var Amplitude = { type = text; }
var Freq = { type = text; units = 'Hertz'; }
var Phase = { type = text; units = 'Degree'; }
var Time2 = { type = text; units = 'Second'; }
var Field = { type = text; units = 'Oersted'; }
}
group analyser = {
var spin = {
@ -27,9 +32,14 @@ driver he3_polanal = {
check_function = chkWrite;
allowed = "+,-,0"
}
var Amplitude = { type = text; }
var Freq = { type = text; units = 'Hertz'; }
var Phase = { type = text; units = 'Degree'; }
var Time2 = { type = text; units = 'Second'; }
var Field = { type = text; units = 'Oersted'; }
}
code chkWrite = {%%
rdValue ${tc_root}
[namespace current]::rdValue ${tc_root}
%%}
code rdValue = {%%
@ -40,7 +50,7 @@ driver he3_polanal = {
}
set my_name [basename [pathname [sct]]]
if {![string equal -nocase "[lindex ${dlist} 0]" "${my_name}"]} {
error "[lindex ${dlist} 0] is not ${my_name}"
error "[lindex ${dlist} 0] is not my name (${my_name})"
}
if {[string match "*Not Active*" "${data}"]} {
set data 0
@ -50,6 +60,26 @@ driver he3_polanal = {
} else {
set data [lindex ${dlist} 1]
}
set path [pathname [sct]]
if {[llength ${dlist}] > 2} {
set new_value [lindex ${dlist} 2]
if { "${new_value}" == "NaN" } {
set new_value 0
}
hupdateif ${path}/Amplitude "${new_value}"
}
if {[llength ${dlist}] > 3} {
hupdateif ${path}/Freq "[lindex ${dlist} 3]"
}
if {[llength ${dlist}] > 4} {
hupdateif ${path}/Phase "[lindex ${dlist} 4]"
}
if {[llength ${dlist}] > 5} {
hupdateif ${path}/Time2 "[lindex ${dlist} 5]"
}
if {[llength ${dlist}] > 6} {
hupdateif ${path}/Field "[lindex ${dlist} 6]"
}
%%}
code setValue = {%%