Added configuration file changes from ics1-pelican

This commit is contained in:
Ferdi Franceschini
2013-04-20 17:53:17 +10:00
parent 1d7681e326
commit b98ff24528
3 changed files with 128 additions and 27 deletions

View File

@@ -15,9 +15,16 @@
#
# ----------------------------------------------------------------------------*/
proc debug_log {args} {
set d1 [clock format [clock seconds] -format %d%h%Y]
set fd [open "../log/ls218Temp$d1.log" a]
puts $fd "[clock format [clock seconds] -format "%D %T "] [string trim $args "{}"]"
close $fd
}
# Default temperature controller parameters
namespace eval ::scobj::ls218 {
#variable logString ""
}
############# Reading polled nodes ###################################
@@ -61,6 +68,8 @@ proc ::scobj::ls218::getValue {idx cmd chID nextState} {
# @param idx indicates which control loop or which input channel the command belongs to
# @return idle Always returns system state idle - command sequence completed.
proc ::scobj::ls218::rdValue {nodeName varName idx} {
#variable logString
if {[ catch {
set replyData [string trimright [sct result] " \r\n"]
set fields [split $replyData ,]
@@ -96,6 +105,7 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
}
}
"Celsius" { hset $nodeName [lindex $fields 0]
#append $logString " Celsius - $fields;"
set curValue [lindex $fields 0]
}
"CurveHd" { hset $nodeName/curve [lindex $fields 0]
@@ -145,6 +155,7 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
}
}
"Kelvin" { hset $nodeName $fields
#append $logString " Kelvin - $fields;"
set curValue $fields
}
"Linear" { hset $nodeName/varM [lindex $fields 0]
@@ -175,22 +186,29 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
# 5 32 temp overrange
# 6 64 units under range
# 7 128 untis over range
set curValue $fields
set field [string trimleft $fields 0]
if {[string length $field] == 0} {
set field 0
}
set stateString ""
set i [format %x $field]
set i [expr 0x$i >> 4]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $nodeName "temp underrange, " }
if {$bitValue == 1} { append $stateString "temp underrange; " }
set i [expr 0x$i >> 1]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $nodeName "temp overrange, " }
if {$bitValue == 1} { append $stateString "temp overrange; " }
set i [expr 0x$i >> 1]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $nodeName "units under range, " }
if {$bitValue == 1} { append $stateString "units under range; " }
set i [expr 0x$i >> 1]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $nodeName "untis over range" }
if {$bitValue == 1} { append $stateString "untis over range; " }
hset $nodeName $stateString
}
"SensorUnitValue" { hset $nodeName $fields
#append $logString " SensorUnitValue - $fields;"
set curValue $fields
}
"data" { hset $nodeName $fields
@@ -351,6 +369,8 @@ proc createParentHDBNode {hPath klass priv type control data} {
# @param tol temperature tolerance in Kelvin (typ. 1)
# @return nothing (well, the sct object)
proc ::scobj::ls218::mkLS218 {argList} {
#variable logString
if {[ catch {
foreach {k v} $argList {
set KEY [string toupper $k]
@@ -588,14 +608,14 @@ proc ::scobj::ls218::mkLS218 {argList} {
# @internal time internal in polling the nodes
# @return nothing (well, the sct object)
#::scobj::ls218::mkLS218 {
# name ls218
# IP 137.157.202.219
# PORT 4002
# tuning 1
# interval 5
# inputChan {1 2 3 4 5 6 7 8}
# outputChan {1 2}
# relayChan {1 2 3 4 5 6 7 8}
#}
::scobj::ls218::mkLS218 {
name ls218
IP 137.157.202.214
PORT 4002
tuning 1
interval 5
inputChan {1 2}
outputChan {}
relayChan {}
}