Added frame source option to histmem.

Allow forcing of frame source to internal (useful for scans on Platypus)

r2257 | ffr | 2007-11-09 17:09:36 +1100 (Fri, 09 Nov 2007) | 3 lines
This commit is contained in:
Ferdi Franceschini
2007-11-09 17:09:36 +11:00
committed by Douglas Clowes
parent 21796674c3
commit b07f75f756

View File

@@ -1,5 +1,5 @@
# $Revision: 1.26 $
# $Date: 2007-11-08 21:34:17 $
# $Revision: 1.27 $
# $Date: 2007-11-09 06:09:36 $
# Author: Ferdi Franceschini
# Based on the examples in the hs_test.tcl sample configuration by Mark Lesha.
# http://gumtree.ansto.gov.au:9080/nbicms/bragg-systems/histogram-server/hs_test.tcl/view
@@ -932,7 +932,54 @@ proc ::histogram_memory::configure_dims {} {
}
}
}
##
# @brief If set to true then the frame_source will always be set to INTERNAL.
#
# @see ::histogram_memory::set_frame_source
proc ::histogram_memory::frame_source_always_internal {args} {
variable fs_always_internal
if {$args == ""} {
return $fs_always_internal
}
set flag [lindex $args 0]
if {[string is boolean $flag] == 0} {
return -code error "$args must be a boolean"
} else {
set fs_always_internal $flag
}
}
publish ::histogram_memory::frame_source_always_internal mugger
##
# @brief Return the last frame source which SICS attempted to set
proc ::histogram_memory::get_frame_source {} {
if [::histogram_memory::frame_source_always_internal] {
clientput "WARNING: The frame source is set to always_internal" value
clientput "Use ::histogram_memory::frame_source_always_internal <true/false> to change this." value
return INTERNAL
} else {
return [SplitReply [hmm configure fat_frame_source]]
}
}
##
# @brief Sets the histogram memory frame source to the given value.
#
# @param srce EXTERNAL or INTERNAL
# @param always_internal true or false (optional) (default false)
proc ::histogram_memory::set_frame_source {srce} {
if [ catch {
if [::histogram_memory::frame_source_always_internal] {
clientput "WARNING: The frame source is set to always_internal" value
clientput "Use ::histogram_memory::frame_source_always_internal <true/false> to change this." value
hmm configure fat_frame_source INTERNAL
} else {
hmm configure fat_frame_source $srce
}
::histogram_memory::stop
hmm init
} errmsg ] {
return -code error $errmsg
}
}
##
# @brief Return the last frame frequency which SICS attempted to set
proc ::histogram_memory::get_frame_freq {} {
@@ -973,10 +1020,10 @@ proc ::histogram_memory::set_frame_freq {freq {frame_source EXTERNAL}} {
clientput "WARNING: A histmem frame frequency of zero was requested, setting frequency to 50Hz instead" value
clientput "WARNING: You must provide an external oscillator" value
}
hmm configure fat_frame_source $zf_frame_source
::histogram_memory::set_frame_source $zf_frame_source
set newfreq 50
} else {
hmm configure fat_frame_source [string toupper $frame_source]
::histogram_memory::set_frame_source [string toupper $frame_source]
::set newfreq $freq
}
if [ catch {
@@ -1020,6 +1067,7 @@ proc ::histogram_memory::_initialize {} {
hmm configure statuscheck false
OAT_TABLE -init
OAT_TABLE -set T_MIN 0
::histogram_memory::frame_source_always_internal false
::histogram_memory::set_frame_freq 50
::histogram_memory::count_method unlimited
::histogram_memory::count_size 0
@@ -1197,9 +1245,10 @@ namespace eval ::histogram_memory {
##
# @brief Convenience command providing user interface to histogram control
#
# @param cmd is one of start, stop, pause, mode, preset, loadconf
# @param cmd is one of start, stop, pause, mode, preset, fsrce, status, loadconf
# @param args is an optional list of arguments for the given command
proc _histmem {cmd args} {
set reply ""
if [ catch {
switch $cmd {
"start" {
@@ -1213,27 +1262,34 @@ namespace eval ::histogram_memory {
}
"mode" {
if {$args == ""} {
return [::histogram_memory::count_method ]
set reply [::histogram_memory::count_method ]
} else {
eval "::histogram_memory::count_method $args"
}
}
"preset" {
if {$args == ""} {
return [::histogram_memory::count_size ]
set reply [::histogram_memory::count_size ]
} else {
eval "::histogram_memory::count_size $args"
}
}
"freq" {
if {$args == ""} {
return [::histogram_memory::get_frame_freq ]
set reply [::histogram_memory::get_frame_freq ]
} else {
eval "::histogram_memory::set_frame_freq $args"
}
}
"fsrce" {
if {$args == ""} {
set reply [::histogram_memory::get_frame_source ]
} else {
eval "::histogram_memory::set_frame_source $args"
}
}
"status" {
return [::histogram_memory::status]
set reply [::histogram_memory::status]
}
"loadconf" {
# Loads configuration tables (OAT, FAT, ...) to histogram server
@@ -1244,10 +1300,13 @@ namespace eval ::histogram_memory {
}
}
default {
error "Available commands are, start stop pause mode preset freq status loadconf"
error "Available commands are, start stop pause mode preset freq fsrce status loadconf"
}
}
} errmsg ] {
return -code error $errmsg
}
if {$reply != ""} {
clientput $reply value
}
}