- Fixed a normalisation problem in diffscan when the first value

did not have enough counts
- Reduced polling frequency in emon
- Fixed a scriptcontext bug which would cause it to dump core in SctTransact
  on interrupts
- Fixed an issue with missing <nl> at the end of batch files
- Added a feature which does not call halt when counting stops in hmcontrol.c
  This is necessary for the BOA CCD
- Initalized doNotFree properly in hipadaba.c
- Added the travelling salesman reflection measurement algorithm
- Added another component to amorset
- Removed old SicsWait from nserver.c
- Added a means to nxscript to write 16 bit data for BOA
- Modified tasub to accept a drivabel as a motor and not only a motor.
  This became necessary to make EIGER work as A2 on EIGER is a virtual
  motor
This commit is contained in:
koennecke
2011-09-23 07:55:49 +00:00
parent 92c0e928a7
commit 3ab4bcdfb9
13 changed files with 107 additions and 78 deletions

View File

@ -7,21 +7,22 @@
Mark Koennecke, October 2005
-----------------------------------------------------------------------*/
#ifndef AMORCOMP
#define AMORCOMP
#include <stdio.h>
#include <sics.h>
typedef struct {
int activeFlag; /* component present */
double markOffset; /* offset mark to real */
double scaleOffset; /* offset of the scale */
double readPosition; /* the position as read */
} amorComp, *pamorComp;
#ifndef AMORCOMP
#define AMORCOMP
#include <stdio.h>
#include <sics.h>
typedef struct {
int activeFlag; /* component present */
double markOffset; /* offset mark to real */
double scaleOffset; /* offset of the scale */
double readPosition; /* the position as read */
} amorComp, *pamorComp;
/*----------------------------------------------------------------------*/
double calcCompPosition(pamorComp comp);
int handleCompCommand(pamorComp comp, SConnection * pCon,
int argc, char *argv[]);
int saveAmorComp(FILE * fd, char *name, char *compname, pamorComp comp);
#endif
double calcCompPosition(pamorComp comp);
int handleCompCommand(pamorComp comp, SConnection *pCon,
int argc, char *argv[]);
int saveAmorComp(FILE *fd, char *name, char *compname, pamorComp comp);
#endif

View File

@ -9,16 +9,18 @@
#ifndef AMORDRIVE
#define AMORDRIVE
typedef struct {
pObjectDescriptor pDes;
pIDrivable pDriv;
pamorSet mama;
int type;
typedef struct{
pObjectDescriptor pDes;
pIDrivable pDriv;
pamorSet mama;
int type;
} amorDrive, *pamorDrive;
/*-----------------------------------------------------------------*/
pamorDrive makeAmorDrive(pamorSet papa, int type);
void killAmorDrive(void *data);
int AmorDriveAction(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[]);
int AmorDriveAction(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]);
#endif

View File

@ -10,6 +10,10 @@
Commented support for slit 5 away as this is gone now
Mark Koennecke, March 2009
Added elliptic guide,
Mark Koennecke, August 2011
--------------------------------------------------------------------*/
#include <stdlib.h>
#include <assert.h>
@ -152,9 +156,6 @@ static int calcAmorSettings(pamorSet self, SConnection * pCon)
}
}
/*
* slit 5
*/
@ -227,6 +228,7 @@ static int calcAmorSettings(pamorSet self, SConnection * pCon)
addMotorToList(self->driveList, "d4b", val);
}
}
printMotorList(self->driveList,pCon);
LLDdelete(readList);
self->mustDrive = 0;
@ -452,6 +454,7 @@ static int amorSetSave(void *data, char *name, FILE * fd)
saveAmorComp(fd, name, "slit3", &self->D3);
saveAmorComp(fd, name, "sample", &self->S);
saveAmorComp(fd, name, "slit4", &self->D4);
saveAmorComp(fd, name, "lens", &self->EL);
/*
saveAmorComp(fd, name, "slit5", &self->D5);
*/
@ -513,7 +516,7 @@ static void killAmorSet(void *data)
free(self);
}
/*-------------------------------------------------------------------*/
/*---------------------------------------------------------------*/
static int testRequiredMotors(SConnection * pCon)
{
char motList[][20] = { "soz", "com",
@ -529,7 +532,7 @@ static int testRequiredMotors(SConnection * pCon)
char pBueffel[132];
for (i = 0; i < 15; i++) {
for(i = 0; i < 15; i++) {
pMot = NULL;
pMot = FindMotor(pServ->pSics, motList[i]);
if (pMot == NULL) {
@ -614,6 +617,8 @@ static pamorComp locateComponent(pamorSet self, char *name)
return &self->D2;
} else if (strcmp(name, "slit3") == 0) {
return &self->D3;
} else if (strcmp(name, "lens") == 0) {
return &self->EL;
} else if (strcmp(name, "sample") == 0) {
return &self->S;
} else if (strcmp(name, "slit4") == 0) {

View File

@ -13,40 +13,42 @@
#include "amorcomp.h"
typedef struct {
pObjectDescriptor pDes;
pIDrivable pDriv;
pIDrivable listDrive;
amorComp chopper;
amorComp M;
amorComp DS;
amorComp D1;
amorComp D2;
amorComp D3;
amorComp S;
amorComp D4;
amorComp A;
amorComp D5;
amorComp D;
double targetm2t;
double targets2t;
double targetath;
double actualm2t;
double actuals2t;
double actualath;
int mustDrive;
int mustRecalculate;
int driveList;
double dspar;
double detectoroffset;
int verbose;
} amorSet, *pamorSet;
pObjectDescriptor pDes;
pIDrivable pDriv;
pIDrivable listDrive;
amorComp chopper;
amorComp M;
amorComp DS;
amorComp D1;
amorComp D2;
amorComp D3;
amorComp EL;
amorComp S;
amorComp D4;
amorComp A;
amorComp D5;
amorComp D;
double targetm2t;
double targets2t;
double targetath;
double actualm2t;
double actuals2t;
double actualath;
int mustDrive;
int mustRecalculate;
int driveList;
double dspar;
double detectoroffset;
int verbose;
}amorSet, *pamorSet;
/*--------------------------------------------------------------------*/
int AmorSetFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[]);
int AmorSetAction(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[]);
/*============ helper functions for the virtual motors ===============*/
int AmorSetFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]);
int AmorSetAction(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]);
/*============ helper functions for the virtual motors ===============*/
void amorSetMotor(pamorSet amor, int type, double value);
double amorGetMotor(pamorSet amor, SConnection * pCon, int type);
double amorGetMotor(pamorSet amor, SConnection *pCon, int type);
#endif

View File

@ -42,7 +42,7 @@ $\langle$amorcompint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@int handleCompCommand(pamorComp comp, SConnection *pCon, @\\
\mbox{}\verb@ int argc, char *argv[]);@\\
\mbox{}\verb@int saveAmorComp(FILE *fd, char *name, char *compname, pamorComp comp); @\\
\mbox{}\verb@@$\diamond$
\mbox{}\verb@@$\Diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
@ -73,6 +73,7 @@ $\langle$amorsetint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ amorComp D1;@\\
\mbox{}\verb@ amorComp D2;@\\
\mbox{}\verb@ amorComp D3;@\\
\mbox{}\verb@ amorComp EL;@\\
\mbox{}\verb@ amorComp S;@\\
\mbox{}\verb@ amorComp D4;@\\
\mbox{}\verb@ amorComp A;@\\
@ -99,7 +100,7 @@ $\langle$amorsetint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@/*============ helper functions for the virtual motors ===============*/ @\\
\mbox{}\verb@void amorSetMotor(pamorSet amor, int type, double value);@\\
\mbox{}\verb@double amorGetMotor(pamorSet amor, SConnection *pCon, int type);@\\
\mbox{}\verb@@$\diamond$
\mbox{}\verb@@$\Diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
@ -126,7 +127,7 @@ $\langle$amordriveint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@void killAmorDrive(void *data);@\\
\mbox{}\verb@int AmorDriveAction(SConnection *pCon, SicsInterp *pSics, void *pData,@\\
\mbox{}\verb@ int argc, char *argv[]);@\\
\mbox{}\verb@@$\diamond$
\mbox{}\verb@@$\Diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
@ -156,7 +157,7 @@ $\langle$amordriveint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@@$\langle$amorsetint {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@\\
\mbox{}\verb@@$\diamond$
\mbox{}\verb@@$\Diamond$
\end{list}
\vspace{-2ex}
\end{minipage}\\[4ex]
@ -182,7 +183,7 @@ $\langle$amordriveint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ @$\langle$amorcompint {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@ #endif@\\
\mbox{}\verb@ @\\
\mbox{}\verb@@$\diamond$
\mbox{}\verb@@$\Diamond$
\end{list}
\vspace{-2ex}
\end{minipage}\\[4ex]
@ -205,7 +206,7 @@ $\langle$amordriveint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@@$\langle$amordriveint {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@\\
\mbox{}\verb@ @$\diamond$
\mbox{}\verb@ @$\Diamond$
\end{list}
\vspace{-2ex}
\end{minipage}\\[4ex]

View File

@ -56,6 +56,7 @@ typedef struct {
amorComp D1;
amorComp D2;
amorComp D3;
amorComp EL;
amorComp S;
amorComp D4;
amorComp A;

View File

@ -77,7 +77,7 @@ typedef struct __MoDriv {
#define BADCOUNT -15
/*-------------------------------------------------------------------
This reruns the command when an emergency stop has been detected.
This ougth to fix the problem that there is still another *ES in the
This ought to fix the problem that there is still another *ES in the
line even after releasing the emergency stop button
--------------------------------------------------------------------*/
static int transactEL734(prs232 self, void *send, int sendLen,
@ -93,8 +93,8 @@ static int transactEL734(prs232 self, void *send, int sendLen,
oldTimeout = getRS232Timeout(self);
setRS232Timeout(self, 0);
if (availableRS232(self)) {
len = sizeof(rubbish);
readRS232(self, rubbish, &len);
len = sizeof(rubbish);
readRS232(self, rubbish, &len);
}
setRS232Timeout(self, oldTimeout);
@ -102,15 +102,17 @@ static int transactEL734(prs232 self, void *send, int sendLen,
/*
Actually do something. Some controllers send one erroneus *ES when the
emergency stop had been released. Therefore we believe an emergency stop
message only at the second try. This is the logic below.
message only at the second try. This is the logic below. Some also send
more \r\n style rubbish on emergency stops too. This is what we try to
read away in the while loop below too.
*/
status = transactRS232(self, send, sendLen, reply, replylen);
if (status >= 1) {
pReply = (char *) reply;
if (strstr(pReply, "*ES") != NULL) {
if (availableRS232(self)) {
len = replylen;
readRS232TillTerm(self, reply, &len);
while(availableRS232(self)) {
len = sizeof(rubbish);
readRS232(self, rubbish, &len);
}
status = transactRS232(self, send, sendLen, reply, replylen);
if (status >= 1) {

View File

@ -539,6 +539,8 @@ static int EL737FixIt(struct __COUNTER *self, int iCode)
return COREDO;
break;
case TOMANYCOUNTS:
return COREDO;
break;
case SYSERROR:
return COTERM;
break;

View File

@ -23,7 +23,7 @@ OBJ=psi.o buffer.o ruli.o sps.o pimotor.o charbychar.o\
dgrambroadcast.o sinq.o tabledrive.o julcho.o sinqhttpopt.o\
ritastorage.o poldizug.o audinelib.o delcam.o el737hpdrivsps.o \
rebin.o sanslirebin.o lmd200.o slsvme.o julprot.o sinqhttpprot.o \
pmacprot.o pfeifferprot.o termprot.o phytron.o autowin.o
pmacprot.o pfeifferprot.o termprot.o phytron.o autowin.o eigera2.o
.SECONDARY.: sanslirebin.c

View File

@ -280,7 +280,13 @@ static int ParSaveAll(void *object, char *name, FILE * fil)
ParBegin();
ctx->saveFile = fil;
assert(0 == strcasecmp(o->name, name));
/*
* Markus: why is this? This killed SICS unexpectedly once for me.
* And it is not required: the code can work even if name and o->name
* do not match.
*
* assert(0 == strcasecmp(o->name, name));
*/
if (o->creationCmd) {
fprintf(fil, "%s\n", o->creationCmd);
}

View File

@ -7,7 +7,7 @@
Uwe Filges, November 2001
Various edits, added rotaion_speed_targtes, Mark Koennecke, 2011
Various edits, added rotation_speed_targets, Mark Koennecke, 2011
----------------------------------------------------------------------------*/
#include <stdlib.h>
#include <assert.h>
@ -500,6 +500,10 @@ static void PoldiUpdate(pPolterdi self, SConnection * pCon)
asctime(localtime(&zeit)));
SCWrite(pCon, pBueffel, eWarning);
}
SNXFormatTime(pBueffel, sizeof(pBueffel));
NXDputalias(hfil, hdict, "eend", pBueffel);
/*
write time binning
*/

1
psi.c
View File

@ -124,6 +124,7 @@ static void AddPsiCommands(SicsInterp * pInter)
SCMD("MakeTRICSSupport", MakeTricsSupport);
SCMD("PolterInstall", PolterInstall);
SCMD("SerialInit", SerialInit);
SCMD("MakeEiger", InitEiger);
PCMD("cnvrt", CnvrtAction);
/*
SCMD("MakeDifrac",MakeDifrac);

View File

@ -253,6 +253,8 @@ static void handleReply(Ascon * a)
pHttp->node->value.v.intArray[i] = htonl(hmData[i]);
}
NotifyHipadabaPar(pHttp->node,NULL);
DynStringClear(a->rdBuffer);
DynStringCopy(a->rdBuffer, "NODEDATA");
/*
path = GetHipadabaPath(pHttp->node);
if(path != NULL){