Updated from ics2-pelican.

This commit is contained in:
Ferdi Franceschini
2013-11-23 11:49:28 +11:00
committed by Ferdi Franceschini
parent 7b814089ff
commit 472ca4f9d9
3 changed files with 103 additions and 106 deletions

View File

@@ -78,11 +78,9 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
set replyData [string trimright [sct result] " \r\n"]
if {[string first "ASCERR" $replyData] != -1} {
#broadcast "Error in LS218 Response: ASCERR:"
sct geterror $replyData
return -code error "Error in LS218 Response: $replyData"
} elseif {[string length $replyData] < 1} {
#broadcast "Error in LS218 Response: no message returned from device"
return -code error "Error in LS218: no message returned from device"
} else {
set fields [split $replyData ,]
@@ -119,7 +117,6 @@ 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]
@@ -193,33 +190,34 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
}
}
"mnmxValue" { hset $nodeName "[lindex $fields 0] , [lindex $fields 1]"}
"status" { hset $nodeName ""
"status" {
# RDGST? chID Reads input status returns an integer with the following meaning
# Bit Weighting StatusIndicator
# 4 16 temp underrange
# 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 str ""
set i [format %x $field]
set i [expr 0x$i >> 4]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $stateString "temp underrange; " }
if {$bitValue == 1} { append str "temp underrange, " }
set i [expr 0x$i >> 1]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $stateString "temp overrange; " }
if {$bitValue == 1} { append str "temp overrange, " }
set i [expr 0x$i >> 1]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $stateString "units under range; " }
if {$bitValue == 1} { append str "units under range, " }
set i [expr 0x$i >> 1]
set bitValue [expr 0x$i & 0x01]
if {$bitValue == 1} { append $stateString "untis over range; " }
hset $nodeName $stateString
if {$bitValue == 1} { append str "untis over range" }
hset $nodeName $str
}
"SensorUnitValue" { hset $nodeName $fields
#append $logString " SensorUnitValue - $fields;"
@@ -350,7 +348,7 @@ proc createNode {scobj_hpath idx sct_controller cmdGroup varName readable pollEn
if {$pollEnabled == 1} {
if {[SplitReply [environment_simulation]]=="false"} {
# puts "enabling polling for $nodeName"
$sct_controller poll $nodeName
$sct_controller poll $nodeName 3
}
}
} message ]} {
@@ -622,14 +620,16 @@ proc ::scobj::ls218::mkLS218 {argList} {
# @internal time internal in polling the nodes
# @return nothing (well, the sct object)
MakeAsyncProtocol std
MakeAsyncQueue ls218 std 137.157.202.214 4002
::scobj::ls218::mkLS218 {
name ls218
IP 137.157.202.214
PORT 4002
IP aqadapter
PORT ls218
tuning 1
interval 5
inputChan {1 2}
outputChan {}
relayChan {}
inputChan {1 2 3 4 5 6 7 8}
outputChan {1 2}
relayChan {1 2 3 4 5 6 7 8}
}