Hide hmm objects from gumtree control view.

Improve feedback.

r2233 | ffr | 2007-11-06 14:43:46 +1100 (Tue, 06 Nov 2007) | 3 lines
This commit is contained in:
Ferdi Franceschini
2007-11-06 14:43:46 +11:00
committed by Douglas Clowes
parent ebf70bfe5c
commit 2853f0ae66

View File

@@ -1,5 +1,5 @@
# $Revision: 1.23 $
# $Date: 2007-11-05 02:17:36 $
# $Revision: 1.24 $
# $Date: 2007-11-06 03:43:46 $
# 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
@@ -59,7 +59,7 @@ namespace eval histogram_memory {
::utility::mkVar detector_active_width_mm Float user active_width true detector true true
sicslist setatt detector_active_width_mm units mm
::utility::mkVar hmm_user_configpath Text manager user_configpath false detector true false
::utility::mkVar hmm_user_configpath Text manager user_configpath false detector false false
hmm_user_configpath ../user_config/hmm
::utility::mkVar hmm_mode Text user mode true detector true true
::utility::mkVar _hmm_vert_axis Text user vert_axis true detector false true
@@ -238,7 +238,7 @@ namespace eval histogram_memory {
sicslist setatt ::histogram_memory::save privilege internal;
foreach hm_obj [sicslist type histmem] {
set_sicsobj_atts $hm_obj detector @none $hm_obj true true;
set_sicsobj_atts $hm_obj detector @none $hm_obj false true;
sicslist setatt $hm_obj privilege user
sicslist setatt $hm_obj kind hobj
sicslist setatt $hm_obj nxsave false
@@ -844,8 +844,8 @@ proc ::histogram_memory::configure_server {instdef} {
}
# TODO Set current oat table after uploading proposed oat_table
proc ::histogram_memory::upload_config {filler_defaults} {
::histogram_memory::filler_defaults $filler_defaults
#XXX ::histogram_memory::setup
if [ catch {
::histogram_memory::filler_defaults $filler_defaults
hmm stop
hmm configure init 1
hmm init
@@ -859,7 +859,11 @@ proc ::histogram_memory::upload_config {filler_defaults} {
hmm configure statuscheck true
hmm stop
hmm configure statuscheck false
::histogram_memory::configure_dims
::histogram_memory::configure_dims
}] {
return -code error $::errorInfo
}
clientput "histmem configuration uploaded"
}
@@ -929,6 +933,12 @@ proc ::histogram_memory::configure_dims {} {
}
}
##
# @brief Return the last frame frequency which SICS attempted to set
proc ::histogram_memory::get_frame_freq {} {
return [SplitReply [hmm configure fat_frame_frequency]]
}
##
# @brief Sets the histogram memory frame frequency to the given value.
#
@@ -938,8 +948,9 @@ proc ::histogram_memory::configure_dims {} {
# If freq=0 then it sets the frequency to 50Hz with an internal frame source. This is useful
# if you are setting the frequency from a chopper which is stopped.
proc ::histogram_memory::set_frame_freq {freq {frame_source INTERNAL}} {
if {$freq < 0} {
return -code error "Frequency must not be negative"
variable state
if {[string is double $freq] == 0 || $freq < 0} {
return -code error "Frequency must be a non-negative floating point number"
}
#TODO Add tolerance parameters to choppercontroller
if {abs($freq - 0) <= [expr {2.0/60.0}]} {
@@ -991,12 +1002,16 @@ proc ::histogram_memory::_initialize {} {
OAT_TABLE -init
OAT_TABLE -set T_MIN 0
::histogram_memory::set_frame_freq 50
::histogram_memory::count_method unlimited
::histogram_memory::count_size 0
FAT_TABLE -init SIZE_PERIOD_MAX 125000000
hmm configure hmDataPath ../HMData
hmm configure hmconfigscript $configuration
if [ catch {
::histogram_memory::configure_dims
} ] {clientput $::errorInfo}
::histogram_memory::configure_dims
} ] {
clientput $::errorInfo
}
}
Publish ::histogram_memory::set_oat_offset user
@@ -1028,9 +1043,10 @@ proc ::histogram_memory::post_count {} {}
if [catch {hmc start 1000000000 timer pause 1}] {
return -code error $::errorInfo
}
clientput "histmem started" value
if {$blocking == "block"} {
blockctr count 0
::histogram_memory::stop
::histogram_memory::pause
}
}
@@ -1042,6 +1058,7 @@ proc ::histogram_memory::post_count {} {}
hmm configure statuscheck true
hmm stop
hmm configure statuscheck false
clientput "histmem stopped" value
} errmsg ] {
return -code error $errmsg
}
@@ -1053,6 +1070,7 @@ proc ::histogram_memory::post_count {} {}
if [ catch {
hmm pause
::histogram_memory::post_count
clientput "histmem paused" value
} errmsg ] {
return -code error $errmsg
}
@@ -1060,34 +1078,84 @@ proc ::histogram_memory::post_count {} {}
##
# @brief Choose method for controlling acquisition duration.
proc ::histogram_memory::count_method {method} {
set modes [list time monitor unlimited period count frame]
#
# @param method Set histmem mode or return current mode if blank
proc ::histogram_memory::count_method {{method ""}} {
set modes [list time monitor unlimited period count frame]
if {$method==""} {
return [SplitReply [hmm_mode]]
} else {
if {[lsearch $modes $method] == -1} {
return -code error "Count mode, $method, must be one of $modes"
}
hmm configure FAT_COUNT_METHOD $method
hmm init 0
hmm init
if [ catch {
hmm configure FAT_COUNT_METHOD $method
hmm init 0
hmm init
hmm_mode $method
}] {
return -code error $::errorInfo
}
}
}
##
# @brief Count until the preset count size has been reached.
#
# @param preset: The interpretation of the preset depends on the count method.
# @see count_method
proc ::histogram_memory::count_size {preset} {
hmm configure FAT_COUNT_SIZE [expr {100.0 * $preset}]
hmm init 0
hmm init
proc ::histogram_memory::count_size {{preset ""}} {
variable state
if {$preset == ""} {
return $state(preset)
} else {
if {[string is double $preset] == 0 || $preset < 0} {
return -code error "The preset must be a non-negative floating point number"
}
if [ catch {
hmm configure FAT_COUNT_SIZE [expr {100.0 * $preset}]
hmm init 0
hmm init
set state(preset) $preset
}] {
return -code error $::errorInfo
}
}
}
##
# @brief Check histogram memory status
#
# @return Stopped, Paused, Started, or raises a Tcl error
proc ::histogram_memory::status {} {
if [ catch {
set reply [SplitReply [hmm configure daq]]
} ] {
return -code error $::errorInfo
} else {
return $reply
}
}
##
# @brief Set stop condition for histogram memory
#
# @param condition
proc ::histogram_memory::stop_condition {condition} {
array set count_stop {immediate IMMEDIATE period AT_END_OF_PERIOD}
hmm configure FAT_COUNT_STOP $count_stop($condition)
hmm init 0
hmm init
variable state
array set count_stop {immediate IMMEDIATE period AT_END_OF_PERIOD}
if [ catch {
if {$condition == ""} {
return $state(stop_cond)
} else {
hmm configure FAT_COUNT_STOP $count_stop($condition)
hmm init 0
hmm init
set state(stop_cond) $condition
}
}] {
return -code error $::errorInfo
}
}
namespace eval ::histogram_memory {
#TODO Create GumTree commands to setup, start and stop the histmem
@@ -1125,13 +1193,28 @@ namespace eval ::histogram_memory {
::histogram_memory::pause
}
"mode" {
eval "::histogram_memory::count_method $args"
if {$args == ""} {
return [::histogram_memory::count_method ]
} else {
eval "::histogram_memory::count_method $args"
}
}
"preset" {
eval "::histogram_memory::count_size $args"
if {$args == ""} {
return [::histogram_memory::count_size ]
} else {
eval "::histogram_memory::count_size $args"
}
}
"setfreq" {
eval "::histogram_memory::set_frame_freq $args"
"freq" {
if {$args == ""} {
return [::histogram_memory::get_frame_freq ]
} else {
eval "::histogram_memory::set_frame_freq $args"
}
}
"status" {
return [::histogram_memory::status]
}
"loadconf" {
# Loads configuration tables (OAT, FAT, ...) to histogram server
@@ -1142,7 +1225,7 @@ namespace eval ::histogram_memory {
}
}
default {
error "Available commands are, start stop pause mode preset setfreq loadconf"
error "Available commands are, start stop pause mode preset freq status loadconf"
}
}
} errmsg ] {