diff --git a/amorcomp.h b/amorcomp.h index dbe1163..0b697f5 100644 --- a/amorcomp.h +++ b/amorcomp.h @@ -7,21 +7,22 @@ Mark Koennecke, October 2005 -----------------------------------------------------------------------*/ -#ifndef AMORCOMP -#define AMORCOMP -#include -#include - -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 + #include + + 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 + diff --git a/amordrive.h b/amordrive.h index 1800605..0172471 100644 --- a/amordrive.h +++ b/amordrive.h @@ -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 + + diff --git a/amorset.c b/amorset.c index 7a3392d..9f1478b 100644 --- a/amorset.c +++ b/amorset.c @@ -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 #include @@ -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) { diff --git a/amorset.h b/amorset.h index f03b7c1..78e3450 100644 --- a/amorset.h +++ b/amorset.h @@ -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 + diff --git a/amorset.tex b/amorset.tex index d575d02..b259c04 100644 --- a/amorset.tex +++ b/amorset.tex @@ -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] diff --git a/amorset.w b/amorset.w index e9e6ff3..14c2666 100644 --- a/amorset.w +++ b/amorset.w @@ -56,6 +56,7 @@ typedef struct { amorComp D1; amorComp D2; amorComp D3; + amorComp EL; amorComp S; amorComp D4; amorComp A; diff --git a/el734hp.c b/el734hp.c index 9c923d7..89cf58e 100644 --- a/el734hp.c +++ b/el734hp.c @@ -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) { diff --git a/el737hpdriv.c b/el737hpdriv.c index e360a62..1f83030 100644 --- a/el737hpdriv.c +++ b/el737hpdriv.c @@ -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; diff --git a/make_gen b/make_gen index 0092e0d..95742bc 100644 --- a/make_gen +++ b/make_gen @@ -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 diff --git a/pardef.c b/pardef.c index 1f64012..f434caa 100644 --- a/pardef.c +++ b/pardef.c @@ -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); } diff --git a/polterwrite.c b/polterwrite.c index cb6d8be..d0509ec 100644 --- a/polterwrite.c +++ b/polterwrite.c @@ -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 #include @@ -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 */ diff --git a/psi.c b/psi.c index e039068..9d5880e 100644 --- a/psi.c +++ b/psi.c @@ -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); diff --git a/sinqhttpopt.c b/sinqhttpopt.c index cc10c95..a7b545f 100644 --- a/sinqhttpopt.c +++ b/sinqhttpopt.c @@ -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){