- Removed SCStart/EndBuffering as far as possible and fixed an issue with
the capture command in that it not put resluts into the Tcl interpreter. This broke scriptcontext scripts in complicated situations. - Resolved some issues with the TAS calculation and negative scattering sense. - Fixed a bug which did not reset the state to idle after checking reachability in confvirtualmot.c
This commit is contained in:
43
autowin.c
43
autowin.c
@ -97,25 +97,30 @@ static float calcCOG(HistInt *data, int length, int startPos)
|
||||
static void printPeaks(SConnection *pCon, int peakList,
|
||||
HistInt *data, int length)
|
||||
{
|
||||
int status, startPos, oldStartPos = 0;
|
||||
float cog;
|
||||
pDynString buf;
|
||||
|
||||
SCStartBuffering(pCon);
|
||||
status = LLDnodePtr2First(peakList);
|
||||
while(status > 0){
|
||||
LLDnodeDataTo(peakList,&startPos);
|
||||
cog = calcCOG(data, length, startPos);
|
||||
startPos = (int)nintf(cog);
|
||||
if((startPos - oldStartPos) > 2){
|
||||
SCPrintf(pCon,eValue,"%d,%d,%d", startPos - 5, startPos + 5,
|
||||
startPos);
|
||||
oldStartPos = startPos;
|
||||
}
|
||||
status = LLDnodePtr2Next(peakList);
|
||||
}
|
||||
buf = SCEndBuffering(pCon);
|
||||
SCWrite(pCon,GetCharArray(buf), eValue);
|
||||
int status, startPos, oldStartPos = 0;
|
||||
float cog;
|
||||
pDynString buf;
|
||||
char buffer[512];
|
||||
|
||||
buf = CreateDynString(256,256);
|
||||
if(buf == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory printing peaks", eError);
|
||||
return;
|
||||
}
|
||||
status = LLDnodePtr2First(peakList);
|
||||
while(status > 0){
|
||||
LLDnodeDataTo(peakList,&startPos);
|
||||
cog = calcCOG(data, length, startPos);
|
||||
startPos = (int)nintf(cog);
|
||||
if((startPos - oldStartPos) > 2){
|
||||
snprintf(buffer,512,"%d,%d,%d",startPos - 5, startPos + 5, startPos);
|
||||
DynStringConcatLine(buf,buffer);
|
||||
oldStartPos = startPos;
|
||||
}
|
||||
status = LLDnodePtr2Next(peakList);
|
||||
}
|
||||
SCWrite(pCon,GetCharArray(buf), eValue);
|
||||
DeleteDynString(buf);
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int CalcCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
|
||||
|
17
eigera2.c
17
eigera2.c
@ -24,6 +24,7 @@
|
||||
#define RUNNING 1
|
||||
#define WAITSTOP 2
|
||||
#define WAITSLIT 3
|
||||
#define WAITIDLE 4
|
||||
/* ---------------------------- motor names --------------------*/
|
||||
#define A2 "a2rot"
|
||||
#define A2R "d2r"
|
||||
@ -153,8 +154,11 @@ static long eigera2SetValue(void *data, SConnection *pCon, float val){
|
||||
self = (eigera2)data;
|
||||
|
||||
if(self->state != IDLE){
|
||||
SCWrite(pCon,"ERROR: Eiger A2 still busy...", eLogError);
|
||||
return HWFault;
|
||||
SCWrite(pCon,"WARNING: stopping busy A2", eLogError);
|
||||
self->a2Target = val;
|
||||
eigera2Halt(data);
|
||||
self->state = WAITIDLE;
|
||||
return OKOK;
|
||||
}
|
||||
self->a2Target = val;
|
||||
setNewMotorTarget(self->motorList,A2,self->a2Target);
|
||||
@ -204,6 +208,15 @@ static int eigera2CheckStatus(void *data, SConnection *pCon){
|
||||
self = (eigera2)data;
|
||||
|
||||
switch(self->state){
|
||||
case WAITIDLE:
|
||||
status = self->listDriv->CheckStatus(&self->motorList,pCon);
|
||||
if(status == HWFault || status == HWIdle){
|
||||
self->state = IDLE;
|
||||
eigera2SetValue(data,pCon, self->a2Target);
|
||||
} else {
|
||||
return status;
|
||||
}
|
||||
break;
|
||||
case RUNNING:
|
||||
case WAITSLIT:
|
||||
status = self->listDriv->CheckStatus(&self->motorList,pCon);
|
||||
|
@ -155,7 +155,7 @@ static int JVLHandler(Ascon *a)
|
||||
a->state = AsconWriteStart;
|
||||
return 1;
|
||||
}
|
||||
if(time(NULL) > priv->start + 1){
|
||||
if(time(NULL) > priv->start + a->timeout){
|
||||
a->state = AsconReadDone;
|
||||
DynStringConcat(a->rdBuffer,"timeout");
|
||||
return 1;
|
||||
@ -211,7 +211,7 @@ static int JVLInit(Ascon * a, SConnection * con, int argc, char *argv[])
|
||||
if (argc > 2) {
|
||||
a->timeout = atof(argv[2]);
|
||||
} else {
|
||||
a->timeout = 2.0; /* sec */
|
||||
a->timeout = 1.0; /* sec */
|
||||
}
|
||||
a->private = priv;
|
||||
a->killPrivate = free;
|
||||
|
@ -13,7 +13,7 @@ include ../sllinux_def
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I$(TCLINC) -Ihardsup \
|
||||
-I.. -I. -MMD -DCYGNUS -DNONINTF -g $(DFORTIFY) -p \
|
||||
-I.. -I. -MMD -DCYGNUS -DNONINTF -g $(DFORTIFY) \
|
||||
-Wall -Wno-unused -Wunused-value -Wno-comment -Wno-switch -Werror
|
||||
|
||||
EXTRA=nintf.o
|
||||
|
@ -229,7 +229,7 @@ static void handleReply(Ascon * a)
|
||||
clearSICSData(pHttp->binData);
|
||||
dataPtr = getSICSDataPointer(pHttp->binData, 0, len);
|
||||
for (i = 0; i < len; i++) {
|
||||
dataPtr[i] = htonl(hmData[i]);
|
||||
dataPtr[i] = ntohl(hmData[i]);
|
||||
}
|
||||
assignSICSType(pHttp->binData, 0, len, INTTYPE);
|
||||
DynStringClear(a->rdBuffer);
|
||||
@ -250,7 +250,7 @@ static void handleReply(Ascon * a)
|
||||
pHttp->node->value.arrayLength = len;
|
||||
}
|
||||
for(i = 0; i < len; i++){
|
||||
pHttp->node->value.v.intArray[i] = htonl(hmData[i]);
|
||||
pHttp->node->value.v.intArray[i] = ntohl(hmData[i]);
|
||||
}
|
||||
NotifyHipadabaPar(pHttp->node,NULL);
|
||||
DynStringClear(a->rdBuffer);
|
||||
|
@ -1315,6 +1315,7 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int i, status, iPtr, iTas;
|
||||
time_t iDate;
|
||||
struct tm *psTime;
|
||||
float ach;
|
||||
|
||||
/*
|
||||
check authorization
|
||||
@ -1456,6 +1457,14 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCWrite(pCon, pLine, eLog);
|
||||
}
|
||||
|
||||
/*
|
||||
check ACH
|
||||
*/
|
||||
ach = readDrivable("ach",pCon);
|
||||
if(ach < .05) {
|
||||
SCWrite(pCon,"WARNING: Analyser is flat",eWarning);
|
||||
}
|
||||
|
||||
/*
|
||||
set our scan functions
|
||||
*/
|
||||
|
Reference in New Issue
Block a user