- 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:
koennecke
2012-10-29 12:56:30 +00:00
parent 013c96526e
commit 28cea49d01
6 changed files with 53 additions and 26 deletions

View File

@ -97,25 +97,30 @@ static float calcCOG(HistInt *data, int length, int startPos)
static void printPeaks(SConnection *pCon, int peakList, static void printPeaks(SConnection *pCon, int peakList,
HistInt *data, int length) HistInt *data, int length)
{ {
int status, startPos, oldStartPos = 0; int status, startPos, oldStartPos = 0;
float cog; float cog;
pDynString buf; pDynString buf;
char buffer[512];
SCStartBuffering(pCon); buf = CreateDynString(256,256);
status = LLDnodePtr2First(peakList); if(buf == NULL){
while(status > 0){ SCWrite(pCon,"ERROR: out of memory printing peaks", eError);
LLDnodeDataTo(peakList,&startPos); return;
cog = calcCOG(data, length, startPos); }
startPos = (int)nintf(cog); status = LLDnodePtr2First(peakList);
if((startPos - oldStartPos) > 2){ while(status > 0){
SCPrintf(pCon,eValue,"%d,%d,%d", startPos - 5, startPos + 5, LLDnodeDataTo(peakList,&startPos);
startPos); cog = calcCOG(data, length, startPos);
oldStartPos = startPos; startPos = (int)nintf(cog);
} if((startPos - oldStartPos) > 2){
status = LLDnodePtr2Next(peakList); snprintf(buffer,512,"%d,%d,%d",startPos - 5, startPos + 5, startPos);
} DynStringConcatLine(buf,buffer);
buf = SCEndBuffering(pCon); oldStartPos = startPos;
SCWrite(pCon,GetCharArray(buf), eValue); }
status = LLDnodePtr2Next(peakList);
}
SCWrite(pCon,GetCharArray(buf), eValue);
DeleteDynString(buf);
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
static int CalcCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode, static int CalcCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,

View File

@ -24,6 +24,7 @@
#define RUNNING 1 #define RUNNING 1
#define WAITSTOP 2 #define WAITSTOP 2
#define WAITSLIT 3 #define WAITSLIT 3
#define WAITIDLE 4
/* ---------------------------- motor names --------------------*/ /* ---------------------------- motor names --------------------*/
#define A2 "a2rot" #define A2 "a2rot"
#define A2R "d2r" #define A2R "d2r"
@ -153,8 +154,11 @@ static long eigera2SetValue(void *data, SConnection *pCon, float val){
self = (eigera2)data; self = (eigera2)data;
if(self->state != IDLE){ if(self->state != IDLE){
SCWrite(pCon,"ERROR: Eiger A2 still busy...", eLogError); SCWrite(pCon,"WARNING: stopping busy A2", eLogError);
return HWFault; self->a2Target = val;
eigera2Halt(data);
self->state = WAITIDLE;
return OKOK;
} }
self->a2Target = val; self->a2Target = val;
setNewMotorTarget(self->motorList,A2,self->a2Target); setNewMotorTarget(self->motorList,A2,self->a2Target);
@ -204,6 +208,15 @@ static int eigera2CheckStatus(void *data, SConnection *pCon){
self = (eigera2)data; self = (eigera2)data;
switch(self->state){ 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 RUNNING:
case WAITSLIT: case WAITSLIT:
status = self->listDriv->CheckStatus(&self->motorList,pCon); status = self->listDriv->CheckStatus(&self->motorList,pCon);

View File

@ -155,7 +155,7 @@ static int JVLHandler(Ascon *a)
a->state = AsconWriteStart; a->state = AsconWriteStart;
return 1; return 1;
} }
if(time(NULL) > priv->start + 1){ if(time(NULL) > priv->start + a->timeout){
a->state = AsconReadDone; a->state = AsconReadDone;
DynStringConcat(a->rdBuffer,"timeout"); DynStringConcat(a->rdBuffer,"timeout");
return 1; return 1;
@ -211,7 +211,7 @@ static int JVLInit(Ascon * a, SConnection * con, int argc, char *argv[])
if (argc > 2) { if (argc > 2) {
a->timeout = atof(argv[2]); a->timeout = atof(argv[2]);
} else { } else {
a->timeout = 2.0; /* sec */ a->timeout = 1.0; /* sec */
} }
a->private = priv; a->private = priv;
a->killPrivate = free; a->killPrivate = free;

View File

@ -13,7 +13,7 @@ include ../sllinux_def
CC = gcc CC = gcc
CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I$(TCLINC) -Ihardsup \ 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 -Wall -Wno-unused -Wunused-value -Wno-comment -Wno-switch -Werror
EXTRA=nintf.o EXTRA=nintf.o

View File

@ -229,7 +229,7 @@ static void handleReply(Ascon * a)
clearSICSData(pHttp->binData); clearSICSData(pHttp->binData);
dataPtr = getSICSDataPointer(pHttp->binData, 0, len); dataPtr = getSICSDataPointer(pHttp->binData, 0, len);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
dataPtr[i] = htonl(hmData[i]); dataPtr[i] = ntohl(hmData[i]);
} }
assignSICSType(pHttp->binData, 0, len, INTTYPE); assignSICSType(pHttp->binData, 0, len, INTTYPE);
DynStringClear(a->rdBuffer); DynStringClear(a->rdBuffer);
@ -250,7 +250,7 @@ static void handleReply(Ascon * a)
pHttp->node->value.arrayLength = len; pHttp->node->value.arrayLength = len;
} }
for(i = 0; i < len; i++){ 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); NotifyHipadabaPar(pHttp->node,NULL);
DynStringClear(a->rdBuffer); DynStringClear(a->rdBuffer);

View File

@ -1315,6 +1315,7 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData,
int i, status, iPtr, iTas; int i, status, iPtr, iTas;
time_t iDate; time_t iDate;
struct tm *psTime; struct tm *psTime;
float ach;
/* /*
check authorization check authorization
@ -1456,6 +1457,14 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData,
SCWrite(pCon, pLine, eLog); SCWrite(pCon, pLine, eLog);
} }
/*
check ACH
*/
ach = readDrivable("ach",pCon);
if(ach < .05) {
SCWrite(pCon,"WARNING: Analyser is flat",eWarning);
}
/* /*
set our scan functions set our scan functions
*/ */