55 lines
1.7 KiB
Tcl
55 lines
1.7 KiB
Tcl
#--------------------------------------------------------------------------
|
|
# A count command for DMC
|
|
# All arguments are optional. The current values will be used if not
|
|
# specified
|
|
# Dr. Mark Koennecke, Juli 1997
|
|
#--------------------------------------------------------------------------
|
|
proc SplitReply { text } {
|
|
set l [split $text =]
|
|
return [lindex $l 1]
|
|
}
|
|
#--------------------------------------------------------------------------
|
|
proc count { {mode NULL } { preset NULL } } {
|
|
starttime [sicstime]
|
|
catch {temperature log clear} msg
|
|
#----- deal with mode
|
|
set mode2 [string toupper $mode]
|
|
set mode3 [string trim $mode2]
|
|
set mc [string index $mode2 0]
|
|
if { [string compare $mc T] == 0 } {
|
|
banana CountMode Timer
|
|
} elseif { [string compare $mc M] == 0 } {
|
|
banana CountMode Monitor
|
|
}
|
|
#------ deal with preset
|
|
if { [string compare $preset NULL] != 0 } {
|
|
banana preset $preset
|
|
}
|
|
#------ prepare a count message
|
|
set a [banana preset]
|
|
set aa [SplitReply $a]
|
|
set b [banana CountMode]
|
|
set bb [SplitReply $b]
|
|
ClientPut [format " Starting counting in %s mode with a preset of %s" \
|
|
$bb $aa]
|
|
#------- count
|
|
banana InitVal 0
|
|
wait 1
|
|
banana count
|
|
set ret [catch {Success} msg]
|
|
#------- StoreData
|
|
StoreData
|
|
if { $ret != 0 } {
|
|
error [format "Counting ended with error"]
|
|
}
|
|
}
|
|
#---------------- Repeat -----------------------------------------------
|
|
proc repeat { num {mode NULL} {preset NULL} } {
|
|
for { set i 0 } { $i < $num } { incr i } {
|
|
set ret [catch {count $mode $preset} msg]
|
|
if {$ret != 0} {
|
|
error "Counting ended with error"
|
|
}
|
|
}
|
|
}
|