Update generated driver code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Generated driver for shutters
|
||||
# vim: tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::shutters {
|
||||
@@ -34,6 +34,7 @@ proc ::scobj::shutters::checkrange {tc_root} {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
@@ -50,8 +51,11 @@ proc ::scobj::shutters::getValue {tc_root nextState cmd_str} {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code goes here
|
||||
debug_log 1 "getValue sct send ${cmd}"
|
||||
sct send "${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -61,6 +65,7 @@ proc ::scobj::shutters::getValue {tc_root nextState cmd_str} {
|
||||
proc ::scobj::shutters::noResponse {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# hook code goes here
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -127,6 +132,7 @@ proc ::scobj::shutters::setValue {tc_root nextState cmd_str} {
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
@@ -273,10 +279,39 @@ proc add_shutters {name IP port} {
|
||||
}
|
||||
${ns}::debug_log 1 "mk_sct_shutters sct_${name} ${name}"
|
||||
${ns}::mk_sct_shutters sct_${name} ${name}
|
||||
close ${fd}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
puts stdout "file evaluation of sct_shutters.tcl"
|
||||
::scobj::shutters::debug_log 1 "file evaluation of sct_shutters.tcl"
|
||||
|
||||
proc ::scobj::shutters::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::shutters"
|
||||
${ns}::debug_log 1 "Processing Config"
|
||||
dict for {k v} $::config_dict {
|
||||
${ns}::debug_log 1 "Inspecting $k:$v"
|
||||
if { [dict exists $v "driver"] } {
|
||||
${ns}::debug_log 1 "Has driver [dict get $v driver]"
|
||||
if { [dict get $v "driver"] == "shutters" } {
|
||||
${ns}::debug_log 1 "Correct driver, enabled = [dict get $v enabled]"
|
||||
if { [dict get $v enabled] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
set name [dict get $v name]
|
||||
MakeAsyncProtocol ${name}_protocol
|
||||
MakeAsyncQueue ${name}_queue ${name}_protocol ${IP} ${PORT}
|
||||
add_shutters ${name} "aqadapter" ${name}_queue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::shutters::read_config
|
||||
} else {
|
||||
::scobj::shutters:debug_log 1 "No config dict"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Generated driver for tank
|
||||
# vim: tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::tank {
|
||||
@@ -34,6 +34,7 @@ proc ::scobj::tank::checkrange {tc_root} {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
@@ -50,8 +51,11 @@ proc ::scobj::tank::getValue {tc_root nextState cmd_str} {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code goes here
|
||||
debug_log 1 "getValue sct send ${cmd}"
|
||||
sct send "${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -61,6 +65,7 @@ proc ::scobj::tank::getValue {tc_root nextState cmd_str} {
|
||||
proc ::scobj::tank::noResponse {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# hook code goes here
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
@@ -124,6 +129,7 @@ proc ::scobj::tank::setValue {tc_root nextState cmd_str} {
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
@@ -160,7 +166,9 @@ proc ::scobj::tank::mk_sct_tank { sct_controller name } {
|
||||
hsetprop ${scobj_hpath}/limits/forward mutable false
|
||||
hsetprop ${scobj_hpath}/limits/forward nxsave true
|
||||
hsetprop ${scobj_hpath}/limits/forward oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/limits/forward sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/limits/forward type "part"
|
||||
hsetprop ${scobj_hpath}/limits/forward nxalias "${name}_limits_forward"
|
||||
|
||||
hfactory ${scobj_hpath}/limits/reverse plain user text
|
||||
hsetprop ${scobj_hpath}/limits/reverse read ${ns}::getValue ${scobj_hpath} read_switch {MG _LRH}
|
||||
@@ -170,7 +178,9 @@ proc ::scobj::tank::mk_sct_tank { sct_controller name } {
|
||||
hsetprop ${scobj_hpath}/limits/reverse mutable false
|
||||
hsetprop ${scobj_hpath}/limits/reverse nxsave true
|
||||
hsetprop ${scobj_hpath}/limits/reverse oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/limits/reverse sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/limits/reverse type "part"
|
||||
hsetprop ${scobj_hpath}/limits/reverse nxalias "${name}_limits_reverse"
|
||||
|
||||
if {[SplitReply [motor_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/limits/forward 1
|
||||
@@ -187,7 +197,9 @@ proc ::scobj::tank::mk_sct_tank { sct_controller name } {
|
||||
hsetprop ${scobj_hpath}/switches/forward mutable false
|
||||
hsetprop ${scobj_hpath}/switches/forward nxsave true
|
||||
hsetprop ${scobj_hpath}/switches/forward oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/switches/forward sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/switches/forward type "part"
|
||||
hsetprop ${scobj_hpath}/switches/forward nxalias "${name}_switches_forward"
|
||||
|
||||
hfactory ${scobj_hpath}/switches/reverse plain user text
|
||||
hsetprop ${scobj_hpath}/switches/reverse read ${ns}::getValue ${scobj_hpath} read_switch {MG @IN[6]}
|
||||
@@ -197,7 +209,9 @@ proc ::scobj::tank::mk_sct_tank { sct_controller name } {
|
||||
hsetprop ${scobj_hpath}/switches/reverse mutable false
|
||||
hsetprop ${scobj_hpath}/switches/reverse nxsave true
|
||||
hsetprop ${scobj_hpath}/switches/reverse oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/switches/reverse sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/switches/reverse type "part"
|
||||
hsetprop ${scobj_hpath}/switches/reverse nxalias "${name}_switches_reverse"
|
||||
|
||||
if {[SplitReply [motor_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/switches/forward 1
|
||||
@@ -230,10 +244,39 @@ proc add_tank {name IP port} {
|
||||
}
|
||||
${ns}::debug_log 1 "mk_sct_tank sct_${name} ${name}"
|
||||
${ns}::mk_sct_tank sct_${name} ${name}
|
||||
close ${fd}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
puts stdout "file evaluation of sct_tank.tcl"
|
||||
::scobj::tank::debug_log 1 "file evaluation of sct_tank.tcl"
|
||||
|
||||
proc ::scobj::tank::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::tank"
|
||||
${ns}::debug_log 1 "Processing Config"
|
||||
dict for {k v} $::config_dict {
|
||||
${ns}::debug_log 1 "Inspecting $k:$v"
|
||||
if { [dict exists $v "driver"] } {
|
||||
${ns}::debug_log 1 "Has driver [dict get $v driver]"
|
||||
if { [dict get $v "driver"] == "tank" } {
|
||||
${ns}::debug_log 1 "Correct driver, enabled = [dict get $v enabled]"
|
||||
if { [dict get $v enabled] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
set name [dict get $v name]
|
||||
MakeAsyncProtocol ${name}_protocol
|
||||
MakeAsyncQueue ${name}_queue ${name}_protocol ${IP} ${PORT}
|
||||
add_tank ${name} "aqadapter" ${name}_queue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::tank::read_config
|
||||
} else {
|
||||
::scobj::tank:debug_log 1 "No config dict"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user