nxscript.c SICS-295
Restored a modification made in revision 1.7 which was reverted during the PSI update (2/10/08) probably when investigating SICS-291 hmm_configuration_common_1.tcl Added hmm ratemap_xy_max_bin and ratemap_xy_total site_ansto/hardsup/sct_galilprot.c site_ansto/hardsup/makefile Started adding galil protocol for script-context controllers. sans/config/parameters/parameters.tcl SICS-180 BeamCenterY should have been BeamCenterZ r2742 | ffr | 2008-11-07 10:13:51 +1100 (Fri, 07 Nov 2008) | 13 lines
This commit is contained in:
committed by
Douglas Clowes
parent
a00b32dbe4
commit
283c7d56dc
28
nxscript.c
28
nxscript.c
@@ -668,6 +668,7 @@ static int listToArray(SicsInterp *pSics, char *list,
|
||||
return TCL_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
#define HANUM 3
|
||||
static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
int argc, char *argv[]){
|
||||
int start[NX_MAXRANK], size[NX_MAXRANK];
|
||||
@@ -675,6 +676,9 @@ static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
pHistMem mem = NULL;
|
||||
HistInt *histData = NULL;
|
||||
pSICSData data = NULL;
|
||||
char buffer[256];
|
||||
enum histargs {haStart, haLength, haBank};
|
||||
int i, haIndex, hpars[HANUM], haFirst=6;
|
||||
|
||||
if(argc < 6){
|
||||
SCWrite(pCon,"ERROR: insufficient number of arguments to putslab",
|
||||
@@ -705,12 +709,36 @@ static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self,
|
||||
*/
|
||||
mem = (pHistMem)FindCommandData(pSics,argv[5],"HistMem");
|
||||
if(mem != NULL){
|
||||
if (argc == 6) {
|
||||
histData = GetHistogramPointer(mem,pCon);
|
||||
} else if (argc > 6) {
|
||||
for (i=0, haIndex=haFirst; i < HANUM; i++, haIndex++) {
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics),argv[haIndex],&hpars[i]);
|
||||
if(status != TCL_OK){
|
||||
sprintf(buffer,"ERROR: failed to convert %s to integer",
|
||||
argv[haIndex]);
|
||||
SCWrite(pCon,buffer,eError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
histData = (HistInt *)malloc(hpars[haLength]*sizeof(HistInt));
|
||||
if(!histData){
|
||||
SCWrite(pCon,"ERROR: out of memory for reading histogram memory",
|
||||
eError);
|
||||
return;
|
||||
}
|
||||
memset(histData,0,hpars[haLength]*sizeof(HistInt));
|
||||
status = GetHistogramDirect(mem,pCon,hpars[haBank],
|
||||
hpars[haStart],hpars[haStart]+hpars[haLength],histData,
|
||||
hpars[haLength]*sizeof(HistInt));
|
||||
}
|
||||
if(histData){
|
||||
status = NXputslab(self->fileHandle, histData, start, size);
|
||||
if(status == NX_OK){
|
||||
written = 1;
|
||||
}
|
||||
if (argc > 6)
|
||||
free(histData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ SRC = .
|
||||
CC = gcc
|
||||
CFLAGS = -g -DLINUX $(DFORTIFY) -I$(SRC) -I../.. -Wall -Wno-unused
|
||||
|
||||
HOBJ= nhq200util.o itc4util.o lh45util.o lakeshore340util.o west4100util.o asynsrv_utility.o geterrno.o strjoin.o chopper.o modbustcp.o
|
||||
HOBJ= nhq200util.o itc4util.o lh45util.o lakeshore340util.o west4100util.o asynsrv_utility.o geterrno.o strjoin.o chopper.o modbustcp.o sct_galilprot.o
|
||||
|
||||
libhlib.a: $(HOBJ)
|
||||
rm -f libhlib.a
|
||||
|
||||
42
site_ansto/hardsup/sct_galilprot.c
Normal file
42
site_ansto/hardsup/sct_galilprot.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <errno.h>
|
||||
#include <ascon.h>
|
||||
#include <ascon.i>
|
||||
#include <dynstring.h>
|
||||
|
||||
int GalilProtHandler(Ascon *a) {
|
||||
int ret;
|
||||
char chr;
|
||||
|
||||
switch(a->state){
|
||||
case AsconReadStart:
|
||||
DynStringClear(a->rdBuffer);
|
||||
a->start = DoubleTime();
|
||||
ret = AsconReadChar(a->fd, &chr);
|
||||
switch (chr) {
|
||||
case ' ':
|
||||
a->state = AsconReading;
|
||||
break;
|
||||
case '?':
|
||||
AsconError(a, "Galil Error", errno);
|
||||
a->state == AsconReadDone;
|
||||
break;
|
||||
case ':':
|
||||
a->state == AsconReadDone;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return AsconStdHandler(a);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void AddGalilProtocoll(){
|
||||
AsconProtocol *prot = NULL;
|
||||
|
||||
prot = calloc(sizeof(AsconProtocol), 1);
|
||||
prot->name = strdup("galil");
|
||||
prot->init = AsconStdInit;
|
||||
prot->handler = GalilProtHandler;
|
||||
AsconInsertProtocol(prot);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
# $Revision: 1.42 $
|
||||
# $Date: 2008-10-27 04:55:41 $
|
||||
# $Revision: 1.43 $
|
||||
# $Date: 2008-11-06 23:13:50 $
|
||||
# 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
|
||||
@@ -1576,6 +1576,20 @@ sicslist setatt ::histogram_memory::time long_name time
|
||||
sicslist setatt ::histogram_memory::time mutable true
|
||||
sicslist setatt ::histogram_memory::time units seconds
|
||||
|
||||
::utility::macro::getset int ::histogram_memory::ratemap_xy_max_bin {} {
|
||||
return "ratemap_xy_max_bin = [lindex [hmm configure ratemap_xy_max_bin] 2]"
|
||||
}
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_max_bin klass detector
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_max_bin long_name max_binrate
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_max_bin mutable true
|
||||
|
||||
::utility::macro::getset int ::histogram_memory::ratemap_xy_total {} {
|
||||
return "ratemap_xy_total = [lindex [hmm configure ratemap_xy_total] 2]"
|
||||
}
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_total klass detector
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_total long_name total_maprate
|
||||
sicslist setatt ::histogram_memory::ratemap_xy_total mutable true
|
||||
|
||||
##
|
||||
# @brief Update the beam monitors when the histmem has finished counting.
|
||||
proc ::histogram_memory::countend_event {} {
|
||||
|
||||
@@ -65,7 +65,7 @@ foreach {var lname nxname units priv } {
|
||||
BSZmm BSZmm z mm user
|
||||
Transmission Transmission Transmission 1 user
|
||||
BeamCenterX BeamCenterX BeamCenterX mm user
|
||||
BeamCenterY BeamCenterY BeamCenterY mm user
|
||||
BeamCenterZ BeamCenterZ BeamCenterZ mm user
|
||||
} {
|
||||
::utility::mkVar $var float $priv $lname true parameter true true
|
||||
if {$units != 1} {
|
||||
|
||||
Reference in New Issue
Block a user