diff --git a/el734driv.c b/el734driv.c index 195f79e..d12ed9c 100644 --- a/el734driv.c +++ b/el734driv.c @@ -256,10 +256,12 @@ strcat(pBuffer,"EL734__FORCED_CLOSED"); break; case EL734__BAD_STP: - strcat(pBuffer,"EL734__BAD_STP"); + strcat(pBuffer, + "The motor is switched off at the motor controller"); break; case EL734__EMERG_STOP: - strcat(pBuffer,"EL734__EMERG_STOP"); + strcat(pBuffer, + "Emergency stop button depressed, please release"); break; case EL734__NOT_OPEN: strcat(pBuffer,"EL734__NOT_OPEN"); diff --git a/el734hp.c b/el734hp.c index 5f9aa37..d7d3f9a 100644 --- a/el734hp.c +++ b/el734hp.c @@ -269,10 +269,10 @@ static void EL734Error(void *pData, int *iCode, char *error, int errLen){ strncpy(error,"Unknown error condition",errLen); break; case BADSTP: - strncpy(error,"Motor is stopped",errLen); + strncpy(error,"Motor is switeched off at motor controller",errLen); break; case BADEMERG: - strncpy(error,"Emergency stop is engaged",errLen); + strncpy(error,"Emergency stop is engaged, please release",errLen); break; case LOWLIM: strncpy(error,"Crashed into lower limit switch",errLen); diff --git a/el737driv.c b/el737driv.c index 923227f..92f5aa5 100644 --- a/el737driv.c +++ b/el737driv.c @@ -17,6 +17,8 @@ #include "hardsup/sinq_prototypes.h" #include "hardsup/el737_def.h" #include "hardsup/el737fix.h" + +#define BADTRANGE -117766 /*----------------------------- EL737 ------------------------------------*/ typedef struct { char *host; @@ -122,6 +124,11 @@ } else if(self->eMode == eTimer) { + if(self->fPreset < .1 || self->fPreset > 200000) + { + self->iErrorCode = BADTRANGE; + return HWFault; + } iRet = EL737_StartTime(&pEL737->pData,self->fPreset,&iRS); if(iRet == 1) { @@ -368,7 +375,15 @@ *iCode = self->iErrorCode; self->iErrorCode = 0; return 1; - } + } + else if(self->iErrorCode == BADTRANGE) + { + strncpy(error,"preset time out of range",iErrLen); + *iCode = self->iErrorCode; + self->iErrorCode = 0; + return 1; + } + EL737_ErrInfo(&pErr,&iC1,&iC2, &iC3); EL737Error2Text(pBueffel,iC1); @@ -437,6 +452,7 @@ case EL737__BAD_NOT_BCD: case UNKNOWNPAR: case BADCOUNTER: + case BADTRANGE: return COTERM; break; case EL737__FORCED_CLOSED: diff --git a/el737hpdriv.c b/el737hpdriv.c index a64f696..f952112 100644 --- a/el737hpdriv.c +++ b/el737hpdriv.c @@ -21,6 +21,7 @@ #define STATSEND 0 #define STATRECEIVE 2 +#define BADTRANGE -117766 /*----------------------------------------------------------------------- our own data struture ------------------------------------------------------------------------*/ @@ -212,7 +213,7 @@ static int updateMonitors(struct __COUNTER *self){ if(self->eMode == eTimer){ pPriv->cachedControl = fTime; } else { - pPriv->cachedControl = m2; + pPriv->cachedControl = m1; } return 1; } @@ -302,6 +303,11 @@ static int EL737Start(struct __COUNTER *self){ if(self->eMode == ePreset){ snprintf(pCommand,49,"MP %d\r",(int)self->fPreset); } else { + if(self->fPreset < .1 || self->fPreset > 200000) + { + self->iErrorCode = BADTRANGE; + return HWFault; + } snprintf(pCommand,49,"TP %.2f\r", self->fPreset); } if(EL737Command(pPriv,pCommand,pReply,29) != 1){ @@ -374,6 +380,9 @@ static int EL737GetError(struct __COUNTER *self, int *iCode, case BADRANGE: strncpy(pError,"EL737 parameter is out of range",errLen); break; + case BADTRANGE: + strncpy(pError,"preset timer out of range",errLen); + break; case BADCOMMAND: strncpy(pError,"EL737 received unknown command or is busy",errLen); break; @@ -416,6 +425,7 @@ static int EL737FixIt(struct __COUNTER *self, int iCode){ case BADPARAM: case NOPARAM: case BADRANGE: + case BADTRANGE: case TIMEOUT737: return COREDO; break; diff --git a/nextrics.c b/nextrics.c index 3ade6e7..cd9dcca 100644 --- a/nextrics.c +++ b/nextrics.c @@ -32,22 +32,23 @@ #include "hkl.h" #include "udpquieck.h" #include "nextrics.h" +#include "nxscript.h" #define DET1X 256 /* x -length of detector 1 */ #define DET1Y 128 /* y-length of detector 1 */ -#define DET1XS 2 /* pixel size in x of detector 1 */ -#define DET1YS 2 /* pixel size in y of detector 1 */ +#define DET1XS -.78 /* pixel size in x of detector 1 */ +#define DET1YS 1.486 /* pixel size in y of detector 1 */ #define DET1DESC "EMBL PSD" -#define DET2X 256 /* x -length of detector 1 */ -#define DET2Y 128 /* y-length of detector 1 */ -#define DET2XS 2 /* pixel size in x of detector 1 */ -#define DET2YS 2 /* pixel size in y of detector 1 */ +#define DET2X 256 /* x -length of detector 1 */ +#define DET2Y 128 /* y-length of detector 1 */ +#define DET2XS -.78 /* pixel size in x of detector 1 */ +#define DET2YS 1.486 /* pixel size in y of detector 1 */ #define DET2DESC "EMBL PSD" #define DET3X 256 /* x -length of detector 1 */ #define DET3Y 128 /* y-length of detector 1 */ -#define DET3XS 2 /* pixel size in x of detector 1 */ -#define DET3YS 2 /* pixel size in y of detector 1 */ +#define DET3XS -.78 /* pixel size in x of detector 1 */ +#define DET3YS 1.486 /* pixel size in y of detector 1 */ #define DET3DESC "EMBL PSD" #define DETAMAX 256 /* maximum length of pixelsize array */ @@ -1240,9 +1241,9 @@ name of hkl object holding crystallographic information /* make a filename and open it */ if(self->pCurrentFile) free(self->pCurrentFile); - iRet = IncrementDataNumber(self->pDanu,&iYear); - sprintf(pBueffel,"%s/trics%5.5d%4.4d.hdf",self->pFileRoot,iRet, iYear); - self->pCurrentFile = strdup(pBueffel); + + pText = makeFilename(pServ->pSics,pCon); + self->pCurrentFile = strdup(pText); if(self->iHDF5) { iRet = NXopen(self->pCurrentFile,NXACC_CREATE5,&hfil); diff --git a/nxamor.c b/nxamor.c index 93cefba..13c4066 100644 --- a/nxamor.c +++ b/nxamor.c @@ -447,13 +447,6 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim, response. Also allow for interrupting. */ SicsWait(2); - if(SCGetInterrupt(pCon) != eContinue) - { - SCWrite(pCon, - "ERROR: dataset writing interrupted, data probably corrupted", - eError); - return 0; - } iStart[0] = 0; iStart[1] = i*iChunk[1]; @@ -466,13 +459,6 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim, response. Also allow for interrupting. */ SicsWait(2); - if(SCGetInterrupt(pCon) != eContinue) - { - SCWrite(pCon, - "ERROR: dataset writing interrupted, data probably corrupted", - eError); - return 0; - } } /* close groups till root diff --git a/psi.c b/psi.c index 862cbb1..f9b00a5 100644 --- a/psi.c +++ b/psi.c @@ -425,6 +425,7 @@ static pEVControl InstallPsiEnvironmentController(SicsInterp *pSics, pNew = CreateEVController(pDriv,argv[2],&status); } } else if(strcmp(argv[3],"psi-dsp") == 0) { + checkError = 1; pDriv = CreateSLSDriv(argc-4,&argv[4]); if(pDriv != NULL){ pNew = CreateEVController(pDriv,argv[2],&status); diff --git a/slsmagnet.c b/slsmagnet.c index 9e7aeed..3bbefc5 100644 --- a/slsmagnet.c +++ b/slsmagnet.c @@ -35,8 +35,10 @@ error codes */ #define BADECHO -5100 -#define NOTCONNECTED -5200 +/* +#define NOTCONNECTED -5200 #define TIMEOUT -5300 +*/ /* when waiting for results, the code loops at max MAXLOOP times @@ -285,7 +287,7 @@ static int communicateSLS(mkChannel *pSock, char msg[6], char reply[6]) } } - return iRet; + return 1; } /*--------------------------------------------------------------------------*/ static int SLSClose(pEVDriver self) diff --git a/swmotor2.c b/swmotor2.c index 4c3591e..f682397 100644 --- a/swmotor2.c +++ b/swmotor2.c @@ -174,7 +174,7 @@ static long SWSetValue(void *pData, SConnection *pCon, float fVal) SCWrite(pCon,"Standby, starting reference run... ", eWarning); pElli = (EL734Driv *)self->pMaster->pDriver; sprintf(pCommand,"R %d\r",pElli->iMotor); - setRS232Timeout(pElli->controller,2000); + setRS232Timeout(pElli->controller,4000); status = transactRS232(pElli->controller,pCommand,strlen(pCommand), pError,131); if(status != 1) diff --git a/tasscan.c b/tasscan.c index 1648c76..acc6e4d 100644 --- a/tasscan.c +++ b/tasscan.c @@ -667,6 +667,11 @@ static int TASScanDrive(pScanData self, int iPoint) fixPowder(tasTargetMask); TASStart(pTAS,self->pCon, self->pSics,tasTargets,tasTargetMask); + } + else + { + SCSetInterrupt(self->pCon,eAbortOperation); + return 1; } } diff --git a/tasutil.c b/tasutil.c index 4f04933..4c78c21 100644 --- a/tasutil.c +++ b/tasutil.c @@ -533,11 +533,6 @@ int TASStart(pTASdata self, SConnection *pCon, SicsInterp *pSics, { status = StartMotor(pServ->pExecutor,pSics,pCon, tasMotorOrder[i], motorTargets[i]); - if(status == 0) - { - /* the error will have been reported and must be ignored */ - /* SCSetInterrupt(pCon,eContinue); */ - } } } /* @@ -550,7 +545,8 @@ int TASStart(pTASdata self, SConnection *pCon, SicsInterp *pSics, if(status == 0) { /* the error will have been reported but must be ignored*/ - /* SCSetInterrupt(pCon,eContinue); */ + SCSetInterrupt(pCon,eContinue); + return 0; } } if(motorMask[8])