Add huber asyncprotocol and make huber_ap and omron_ap to remove name conflicts

This commit is contained in:
Douglas Clowes
2014-06-23 12:47:33 +10:00
parent 565ba9d10d
commit 6b18de0a03
7 changed files with 144 additions and 21 deletions

View File

@@ -53,16 +53,16 @@ driver huber_pilot = {
}
code getValue = {%%
set cmd "\{M${cmd_str}****"
set cmd "M${cmd_str}****"
%%}
code rdStatus = {%%
if {[string length ${data}] < 8} {
if {[string length ${data}] < 7} {
sct geterror "rdValue short response ${data}"
} elseif { ![string equal -nocase [string range ${data} 1 1] "S"] } {
} elseif { ![string equal -nocase [string range ${data} 0 0] "S"] } {
sct geterror "rdValue syntax error ${data}"
} else {
set resp [scan [string range ${data} 4 end] "%x" val]
set resp [scan [string range ${data} 3 end] "%x" val]
if { ${resp} < 1 } {
sct geterror "rdValue scan error ${data}"
} else {
@@ -72,12 +72,12 @@ driver huber_pilot = {
%%}
code rdTemp = {%%
if {[string length ${data}] < 8} {
if {[string length ${data}] < 7} {
sct geterror "rdValue short response ${data}"
} elseif { ![string equal -nocase [string range ${data} 1 1] "S"] } {
} elseif { ![string equal -nocase [string range ${data} 0 0] "S"] } {
sct geterror "rdValue syntax error ${data}"
} else {
set resp [scan [string range ${data} 4 end] "%x" val]
set resp [scan [string range ${data} 3 end] "%x" val]
if { ${resp} < 1 } {
sct geterror "rdValue scan error ${data}"
} else {
@@ -95,7 +95,7 @@ driver huber_pilot = {
code setValue = {%%
set param [expr { round(100.0 * [sct target]) }]
set param [string range [format "%04X" ${param}] end-3 end]
set cmd "\{M${cmd_str}${param}"
set cmd "M${cmd_str}${param}"
%%}
}

View File

@@ -126,7 +126,7 @@ proc ::scobj::huber_pilot::getValue {tc_root nextState cmd_str} {
}
set cmd "${cmd_str}"
# getValue hook code starts
set cmd "\{M${cmd_str}****"
set cmd "M${cmd_str}****"
# getValue hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
@@ -178,12 +178,12 @@ proc ::scobj::huber_pilot::rdStatus {tc_root} {
error "[sct geterror]"
}
# rdStatus hook code starts
if {[string length ${data}] < 8} {
if {[string length ${data}] < 7} {
sct geterror "rdValue short response ${data}"
} elseif { ![string equal -nocase [string range ${data} 1 1] "S"] } {
} elseif { ![string equal -nocase [string range ${data} 0 0] "S"] } {
sct geterror "rdValue syntax error ${data}"
} else {
set resp [scan [string range ${data} 4 end] "%x" val]
set resp [scan [string range ${data} 3 end] "%x" val]
if { ${resp} < 1 } {
sct geterror "rdValue scan error ${data}"
} else {
@@ -221,12 +221,12 @@ proc ::scobj::huber_pilot::rdTemp {tc_root} {
error "[sct geterror]"
}
# rdTemp hook code starts
if {[string length ${data}] < 8} {
if {[string length ${data}] < 7} {
sct geterror "rdValue short response ${data}"
} elseif { ![string equal -nocase [string range ${data} 1 1] "S"] } {
} elseif { ![string equal -nocase [string range ${data} 0 0] "S"] } {
sct geterror "rdValue syntax error ${data}"
} else {
set resp [scan [string range ${data} 4 end] "%x" val]
set resp [scan [string range ${data} 3 end] "%x" val]
if { ${resp} < 1 } {
sct geterror "rdValue scan error ${data}"
} else {
@@ -267,7 +267,7 @@ proc ::scobj::huber_pilot::setValue {tc_root nextState cmd_str} {
# setValue hook code starts
set param [expr { round(100.0 * [sct target]) }]
set param [string range [format "%04X" ${param}] end-3 end]
set cmd "\{M${cmd_str}${param}"
set cmd "M${cmd_str}${param}"
# setValue hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"