selrs now reports status of shutters when called without arguments.

This commit is contained in:
Ferdi Franceschini
2015-02-06 14:31:19 +11:00
parent f1eb273db6
commit e45edb3913
2 changed files with 36 additions and 4 deletions

View File

@ -104,11 +104,27 @@ driver shutters = {
code postamble = {
@ variable rough_slits_enabled 0
@ variable rough_slits_cb_pending 0
@ proc selrs {slit {cb_timeout 60}} {
@ proc selrs {args} {
@ variable rough_slits_enabled
@ variable rough_slits_cb_pending
@ set usage_msg "Valid arguments are 40 or 100 or use 'reset' to terminate a previous selrs call"
@ set usage_msg "Valid arguments are 40 or 100 or use 'reset' to terminate a previous selrs call. Without argurments selrs reports current positions."
@ set catch_status [ catch {
@ switch [llength $args] {
@ 0 {
@ clientput [hlist -val /sics/shutters]
@ return
@ }
@ 1 {
@ set slit $args
@ set cb_timeout 60
@ }
@ 2 {
@ foreach {slit cb_timeout} $args {}
@ }
@ default {
@ error "[info level 0]: $usage_msg"
@ }
@ }
@ if {$slit == "help"} {
@ clientput "Usage: $usage_msg"
@ return

View File

@ -363,11 +363,27 @@ namespace eval ::scobj::shutters {
# postamble hook code starts
variable rough_slits_enabled 0
variable rough_slits_cb_pending 0
proc selrs {slit {cb_timeout 60}} {
proc selrs {args} {
variable rough_slits_enabled
variable rough_slits_cb_pending
set usage_msg "Valid arguments are 40 or 100 or use 'reset' to terminate a previous selrs call"
set usage_msg "Valid arguments are 40 or 100 or use 'reset' to terminate a previous selrs call. Without argurments selrs reports current positions."
set catch_status [ catch {
switch [llength $args] {
0 {
clientput [hlist -val /sics/shutters]
return
}
1 {
set slit $args
set cb_timeout 60
}
2 {
foreach {slit cb_timeout} $args {}
}
default {
error "[info level 0]: $usage_msg"
}
}
if {$slit == "help"} {
clientput "Usage: $usage_msg"
return