- Fixed a bug in conman.c which could cause a core dump when terminating

a connection during an active run.
- Added an additional output mode for the connection in order to
  support the batch run editor.
- Made clientput send everything with eWarning mode in order to support
  the batch run editor.
- Added a better NetReadTillTerm
- Fixed a problem in synchronize.c
- Fixed an issue with reading empty line on normal connection sockets.
- Added a psi scan mode to mesure.c for TRICS
- Made motor print warnings when trying to reposition.
- Fixed abug in hkl.c which cause wrong signs.
This commit is contained in:
cvs
2004-07-21 12:03:08 +00:00
parent 017ac7500f
commit e3ee358dbc
11 changed files with 59 additions and 40 deletions

View File

@ -256,10 +256,12 @@
strcat(pBuffer,"EL734__FORCED_CLOSED"); strcat(pBuffer,"EL734__FORCED_CLOSED");
break; break;
case EL734__BAD_STP: case EL734__BAD_STP:
strcat(pBuffer,"EL734__BAD_STP"); strcat(pBuffer,
"The motor is switched off at the motor controller");
break; break;
case EL734__EMERG_STOP: case EL734__EMERG_STOP:
strcat(pBuffer,"EL734__EMERG_STOP"); strcat(pBuffer,
"Emergency stop button depressed, please release");
break; break;
case EL734__NOT_OPEN: case EL734__NOT_OPEN:
strcat(pBuffer,"EL734__NOT_OPEN"); strcat(pBuffer,"EL734__NOT_OPEN");

View File

@ -269,10 +269,10 @@ static void EL734Error(void *pData, int *iCode, char *error, int errLen){
strncpy(error,"Unknown error condition",errLen); strncpy(error,"Unknown error condition",errLen);
break; break;
case BADSTP: case BADSTP:
strncpy(error,"Motor is stopped",errLen); strncpy(error,"Motor is switeched off at motor controller",errLen);
break; break;
case BADEMERG: case BADEMERG:
strncpy(error,"Emergency stop is engaged",errLen); strncpy(error,"Emergency stop is engaged, please release",errLen);
break; break;
case LOWLIM: case LOWLIM:
strncpy(error,"Crashed into lower limit switch",errLen); strncpy(error,"Crashed into lower limit switch",errLen);

View File

@ -17,6 +17,8 @@
#include "hardsup/sinq_prototypes.h" #include "hardsup/sinq_prototypes.h"
#include "hardsup/el737_def.h" #include "hardsup/el737_def.h"
#include "hardsup/el737fix.h" #include "hardsup/el737fix.h"
#define BADTRANGE -117766
/*----------------------------- EL737 ------------------------------------*/ /*----------------------------- EL737 ------------------------------------*/
typedef struct { typedef struct {
char *host; char *host;
@ -122,6 +124,11 @@
} }
else if(self->eMode == eTimer) 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); iRet = EL737_StartTime(&pEL737->pData,self->fPreset,&iRS);
if(iRet == 1) if(iRet == 1)
{ {
@ -369,6 +376,14 @@
self->iErrorCode = 0; self->iErrorCode = 0;
return 1; 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); EL737_ErrInfo(&pErr,&iC1,&iC2, &iC3);
EL737Error2Text(pBueffel,iC1); EL737Error2Text(pBueffel,iC1);
@ -437,6 +452,7 @@
case EL737__BAD_NOT_BCD: case EL737__BAD_NOT_BCD:
case UNKNOWNPAR: case UNKNOWNPAR:
case BADCOUNTER: case BADCOUNTER:
case BADTRANGE:
return COTERM; return COTERM;
break; break;
case EL737__FORCED_CLOSED: case EL737__FORCED_CLOSED:

View File

@ -21,6 +21,7 @@
#define STATSEND 0 #define STATSEND 0
#define STATRECEIVE 2 #define STATRECEIVE 2
#define BADTRANGE -117766
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
our own data struture our own data struture
------------------------------------------------------------------------*/ ------------------------------------------------------------------------*/
@ -212,7 +213,7 @@ static int updateMonitors(struct __COUNTER *self){
if(self->eMode == eTimer){ if(self->eMode == eTimer){
pPriv->cachedControl = fTime; pPriv->cachedControl = fTime;
} else { } else {
pPriv->cachedControl = m2; pPriv->cachedControl = m1;
} }
return 1; return 1;
} }
@ -302,6 +303,11 @@ static int EL737Start(struct __COUNTER *self){
if(self->eMode == ePreset){ if(self->eMode == ePreset){
snprintf(pCommand,49,"MP %d\r",(int)self->fPreset); snprintf(pCommand,49,"MP %d\r",(int)self->fPreset);
} else { } else {
if(self->fPreset < .1 || self->fPreset > 200000)
{
self->iErrorCode = BADTRANGE;
return HWFault;
}
snprintf(pCommand,49,"TP %.2f\r", self->fPreset); snprintf(pCommand,49,"TP %.2f\r", self->fPreset);
} }
if(EL737Command(pPriv,pCommand,pReply,29) != 1){ if(EL737Command(pPriv,pCommand,pReply,29) != 1){
@ -374,6 +380,9 @@ static int EL737GetError(struct __COUNTER *self, int *iCode,
case BADRANGE: case BADRANGE:
strncpy(pError,"EL737 parameter is out of range",errLen); strncpy(pError,"EL737 parameter is out of range",errLen);
break; break;
case BADTRANGE:
strncpy(pError,"preset timer out of range",errLen);
break;
case BADCOMMAND: case BADCOMMAND:
strncpy(pError,"EL737 received unknown command or is busy",errLen); strncpy(pError,"EL737 received unknown command or is busy",errLen);
break; break;
@ -416,6 +425,7 @@ static int EL737FixIt(struct __COUNTER *self, int iCode){
case BADPARAM: case BADPARAM:
case NOPARAM: case NOPARAM:
case BADRANGE: case BADRANGE:
case BADTRANGE:
case TIMEOUT737: case TIMEOUT737:
return COREDO; return COREDO;
break; break;

View File

@ -32,22 +32,23 @@
#include "hkl.h" #include "hkl.h"
#include "udpquieck.h" #include "udpquieck.h"
#include "nextrics.h" #include "nextrics.h"
#include "nxscript.h"
#define DET1X 256 /* x -length of detector 1 */ #define DET1X 256 /* x -length of detector 1 */
#define DET1Y 128 /* y-length of detector 1 */ #define DET1Y 128 /* y-length of detector 1 */
#define DET1XS 2 /* pixel size in x of detector 1 */ #define DET1XS -.78 /* pixel size in x of detector 1 */
#define DET1YS 2 /* pixel size in y of detector 1 */ #define DET1YS 1.486 /* pixel size in y of detector 1 */
#define DET1DESC "EMBL PSD" #define DET1DESC "EMBL PSD"
#define DET2X 256 /* x -length of detector 1 */ #define DET2X 256 /* x -length of detector 1 */
#define DET2Y 128 /* y-length of detector 1 */ #define DET2Y 128 /* y-length of detector 1 */
#define DET2XS 2 /* pixel size in x of detector 1 */ #define DET2XS -.78 /* pixel size in x of detector 1 */
#define DET2YS 2 /* pixel size in y of detector 1 */ #define DET2YS 1.486 /* pixel size in y of detector 1 */
#define DET2DESC "EMBL PSD" #define DET2DESC "EMBL PSD"
#define DET3X 256 /* x -length of detector 1 */ #define DET3X 256 /* x -length of detector 1 */
#define DET3Y 128 /* y-length of detector 1 */ #define DET3Y 128 /* y-length of detector 1 */
#define DET3XS 2 /* pixel size in x of detector 1 */ #define DET3XS -.78 /* pixel size in x of detector 1 */
#define DET3YS 2 /* pixel size in y of detector 1 */ #define DET3YS 1.486 /* pixel size in y of detector 1 */
#define DET3DESC "EMBL PSD" #define DET3DESC "EMBL PSD"
#define DETAMAX 256 /* maximum length of pixelsize array */ #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 */ /* make a filename and open it */
if(self->pCurrentFile) if(self->pCurrentFile)
free(self->pCurrentFile); free(self->pCurrentFile);
iRet = IncrementDataNumber(self->pDanu,&iYear);
sprintf(pBueffel,"%s/trics%5.5d%4.4d.hdf",self->pFileRoot,iRet, iYear); pText = makeFilename(pServ->pSics,pCon);
self->pCurrentFile = strdup(pBueffel); self->pCurrentFile = strdup(pText);
if(self->iHDF5) if(self->iHDF5)
{ {
iRet = NXopen(self->pCurrentFile,NXACC_CREATE5,&hfil); iRet = NXopen(self->pCurrentFile,NXACC_CREATE5,&hfil);

View File

@ -447,13 +447,6 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
response. Also allow for interrupting. response. Also allow for interrupting.
*/ */
SicsWait(2); SicsWait(2);
if(SCGetInterrupt(pCon) != eContinue)
{
SCWrite(pCon,
"ERROR: dataset writing interrupted, data probably corrupted",
eError);
return 0;
}
iStart[0] = 0; iStart[0] = 0;
iStart[1] = i*iChunk[1]; iStart[1] = i*iChunk[1];
@ -466,13 +459,6 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
response. Also allow for interrupting. response. Also allow for interrupting.
*/ */
SicsWait(2); SicsWait(2);
if(SCGetInterrupt(pCon) != eContinue)
{
SCWrite(pCon,
"ERROR: dataset writing interrupted, data probably corrupted",
eError);
return 0;
}
} }
/* /*
close groups till root close groups till root

1
psi.c
View File

@ -425,6 +425,7 @@ static pEVControl InstallPsiEnvironmentController(SicsInterp *pSics,
pNew = CreateEVController(pDriv,argv[2],&status); pNew = CreateEVController(pDriv,argv[2],&status);
} }
} else if(strcmp(argv[3],"psi-dsp") == 0) { } else if(strcmp(argv[3],"psi-dsp") == 0) {
checkError = 1;
pDriv = CreateSLSDriv(argc-4,&argv[4]); pDriv = CreateSLSDriv(argc-4,&argv[4]);
if(pDriv != NULL){ if(pDriv != NULL){
pNew = CreateEVController(pDriv,argv[2],&status); pNew = CreateEVController(pDriv,argv[2],&status);

View File

@ -35,8 +35,10 @@
error codes error codes
*/ */
#define BADECHO -5100 #define BADECHO -5100
/*
#define NOTCONNECTED -5200 #define NOTCONNECTED -5200
#define TIMEOUT -5300 #define TIMEOUT -5300
*/
/* /*
when waiting for results, the code loops at max MAXLOOP times 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) static int SLSClose(pEVDriver self)

View File

@ -174,7 +174,7 @@ static long SWSetValue(void *pData, SConnection *pCon, float fVal)
SCWrite(pCon,"Standby, starting reference run... ", eWarning); SCWrite(pCon,"Standby, starting reference run... ", eWarning);
pElli = (EL734Driv *)self->pMaster->pDriver; pElli = (EL734Driv *)self->pMaster->pDriver;
sprintf(pCommand,"R %d\r",pElli->iMotor); sprintf(pCommand,"R %d\r",pElli->iMotor);
setRS232Timeout(pElli->controller,2000); setRS232Timeout(pElli->controller,4000);
status = transactRS232(pElli->controller,pCommand,strlen(pCommand), status = transactRS232(pElli->controller,pCommand,strlen(pCommand),
pError,131); pError,131);
if(status != 1) if(status != 1)

View File

@ -668,6 +668,11 @@ static int TASScanDrive(pScanData self, int iPoint)
TASStart(pTAS,self->pCon, TASStart(pTAS,self->pCon,
self->pSics,tasTargets,tasTargetMask); self->pSics,tasTargets,tasTargetMask);
} }
else
{
SCSetInterrupt(self->pCon,eAbortOperation);
return 1;
}
} }
/* /*

View File

@ -533,11 +533,6 @@ int TASStart(pTASdata self, SConnection *pCon, SicsInterp *pSics,
{ {
status = StartMotor(pServ->pExecutor,pSics,pCon, status = StartMotor(pServ->pExecutor,pSics,pCon,
tasMotorOrder[i], motorTargets[i]); 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) if(status == 0)
{ {
/* the error will have been reported but must be ignored*/ /* the error will have been reported but must be ignored*/
/* SCSetInterrupt(pCon,eContinue); */ SCSetInterrupt(pCon,eContinue);
return 0;
} }
} }
if(motorMask[8]) if(motorMask[8])