tweak spacing and code, generate new drivers

This commit is contained in:
Douglas Clowes
2014-04-14 13:40:56 +10:00
parent 53d6274e7d
commit 87bf23eb6e
3 changed files with 36 additions and 50 deletions

View File

@@ -127,6 +127,7 @@ driver hiden_xcs = {
@ } else {
@ sct geterror "Syntax error in: '${data}'"
@ }
}
code read_function read_twelve = {
@ if { [string equal -nocase -length 5 "${data}" "AOUT ="] } {
@@ -150,6 +151,7 @@ driver hiden_xcs = {
@ sct geterror "Syntax error in: '${data}'"
@ }
}
code read_function read_sixteen = {
@ if { [string equal -nocase -length 5 "${data}" "AIN ="] } {
@ set result [scan "${data}" "AIN = %d OK" val]
@@ -172,6 +174,7 @@ driver hiden_xcs = {
@ sct geterror "Syntax error in: '${data}'"
@ }
}
code read_function read_all_data = {
@ if { [string equal -nocase -length 2 "${data}" "A "] } {
@ set data_list [split [string range "${data}" 2 end-3] ',']
@@ -182,15 +185,16 @@ driver hiden_xcs = {
@ hupdate ${tc_root}/flow2 [expr [lindex ${data_list} 4] / [hval ${tc_root}/gas_factor]]
@ hupdate ${tc_root}/flow3 [expr [lindex ${data_list} 5] / [hval ${tc_root}/gas_factor]]
@ } else {
@ sct geterror "Syntax error (Result=${result}) in: '${data}'"
@ sct geterror "Syntax error (not 8) for read_all_data in: '${data}'"
@ }
@ } else {
@ sct geterror "Syntax error for read_all_data in: '${data}'"
@ sct geterror "Syntax error (not A) for read_all_data in: '${data}'"
@ }
@ if { [hpropexists [sct] target] } {
@ set pid [pid_humidity ${tc_root} [sct target] ${data}]
@ }
}
}
code pid_function pid_humidity = {
@ set path [pathname [sct]]
@ set sign 1
@@ -206,23 +210,12 @@ driver hiden_xcs = {
@ }
@ }
}
code fetch_function fetch_flow = {
@ set data 0.0
@ set targets 0.0
@ set path [pathname [sct]]
@ foreach node [list flow1 flow2] {
@ set data [expr ${data} + [hval ${path}/${node}]]
@ }
@ sct result ${data}
@ foreach node [list analog/sp1 analog/sp2] {
@ set targets [expr ${targets} + [hval ${path}/${node}]]
@ }
@ sct targets ${targets}
@ if { [hpropexists [sct] target] } {
@ set pid [pid_flow ${tc_root} [sct target] ${data}]
@ }
@# cut this function short
@ return ${nextState}
@ if { [hpropexists [sct] target] } {
@ set pid [pid_flow ${tc_root} [sct target] ${data}]
@ }
@ set cmd "@@NOSEND@@"
}
code pid_function pid_flow = {
@ set path [pathname [sct]]
@@ -236,6 +229,7 @@ driver hiden_xcs = {
@ }
@ }
}
code write_function write_digital = {
}
code write_function write_twelve = {
@@ -264,6 +258,7 @@ driver hiden_xcs = {
@ set par [expr int(${base} + (4095.0 * ${par} / ${span}))]
@ set cmd "${cmd_str}${par}"
}
code write_function write_flow = {
@ if { [hpropexists ${tc_root}/humidity target] } {
@ set humidity_target [hgetpropval ${tc_root}/humidity target]
@@ -276,6 +271,7 @@ driver hiden_xcs = {
@ hset ${tc_root}/analog/sp2 ${flow2_target}
@ set cmd "@@NOSEND@@"
}
code write_function write_humidity = {
@ if { [hpropexists ${tc_root}/flow target] } {
@ set flow_target [hgetpropval ${tc_root}/flow target]
@@ -288,6 +284,7 @@ driver hiden_xcs = {
@ hset ${tc_root}/analog/sp2 ${flow2_target}
@ set cmd "@@NOSEND@@"
}
code write_function no_op = {
@ set cmd "@@NOSEND@@"
}
@@ -296,6 +293,7 @@ driver hiden_xcs = {
#
code mkDriver = {
}
code chkrange_function = {
@ # hooked
}