- Fixed putpos bug in ecbdriv.c

- Improved handling of conflicting drive commands in ecbdriv.c
- Better status codes after drive command
- Better error handling in anticollider
This commit is contained in:
cvs
2003-09-04 07:15:38 +00:00
parent d310b4a427
commit d542f758b0
3 changed files with 49 additions and 26 deletions

View File

@ -240,6 +240,7 @@ static int checkMotorResult(pECBMotDriv self, Z80_reg out){
self->errorCode = ECBINHIBIT; self->errorCode = ECBINHIBIT;
break; break;
case 32: case 32:
case 96:
self->errorCode = ECBRUNNING; self->errorCode = ECBRUNNING;
break; break;
case 1: case 1:
@ -252,6 +253,7 @@ static int checkMotorResult(pECBMotDriv self, Z80_reg out){
self->errorCode = ECBINUSE; self->errorCode = ECBINUSE;
break; break;
default: default:
fprintf(stderr,"Unidentified ECB motor error code %d\n", out.b);
self->errorCode = UNIDENTIFIED; self->errorCode = UNIDENTIFIED;
break; break;
} }
@ -846,30 +848,6 @@ static void ECBGetError(void *pData, int *iCode, char *buffer, int bufferlen){
break; break;
} }
} }
/*=======================================================================*/
static int ECBTryAndFixIt(void *pData, int iCode, float fNew){
pECBMotDriv self = (pECBMotDriv)pData;
int result;
Z80_reg in, out;
assert(self);
switch(iCode){
case ECBMANUELL:
in.d = 1 ;
ecbExecute(self->ecb,162,in,&out);
result = MOTREDO;
break;
case COMMERROR:
ecbClear(self->ecb);
result = MOTREDO;
break;
default:
result = MOTFAIL;
break;
}
return result;
}
/*========================================================================*/ /*========================================================================*/
static int ECBHalt(void *pData){ static int ECBHalt(void *pData){
pECBMotDriv self = (pECBMotDriv)pData; pECBMotDriv self = (pECBMotDriv)pData;
@ -890,6 +868,42 @@ static int ECBHalt(void *pData){
return 1; return 1;
} }
/*=======================================================================*/ /*=======================================================================*/
static int ECBTryAndFixIt(void *pData, int iCode, float fNew){
pECBMotDriv self = (pECBMotDriv)pData;
int result;
Z80_reg in, out;
int i;
assert(self);
switch(iCode){
case ECBMANUELL:
in.d = 1 ;
ecbExecute(self->ecb,162,in,&out);
result = MOTREDO;
break;
case ECBRUNNING:
ECBHalt(pData);
self->restart = 0;
for(i = 0; i < 7; i++){
if(ECBGetStatus(pData) == HWIdle){
break;
}
SicsWait(1);
}
result = MOTREDO;
break;
case COMMERROR:
ecbClear(self->ecb);
result = MOTREDO;
break;
default:
result = MOTFAIL;
break;
}
return result;
}
/*=======================================================================*/
static int ECBGetDriverPar(void *pData,char *name, float *value){ static int ECBGetDriverPar(void *pData,char *name, float *value){
pECBMotDriv self = (pECBMotDriv)pData; pECBMotDriv self = (pECBMotDriv)pData;
ObPar *par = NULL; ObPar *par = NULL;
@ -1019,6 +1033,7 @@ static int ECBSetDriverPar(void *pData, SConnection *pCon, char *name,
SCWrite(pCon,pBueffel,eError); SCWrite(pCon,pBueffel,eError);
return status; return status;
} }
return 1;
} }
/* /*

View File

@ -8,6 +8,8 @@
include ../$(SRC)linux_def include ../$(SRC)linux_def
HDFROOT=/usr/users/SANS2/src
CC = gcc CC = gcc
CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I$(SRC)hardsup \ CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I$(SRC)hardsup \
-I../$(SRC) -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) -I../$(SRC) -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY)

View File

@ -5,11 +5,14 @@
# Markus Zolliker, March 2003 # Markus Zolliker, March 2003
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
include ../../$(SRC)linux_def include ../../linux_def
SICST=..
SICS=$(SRC)..
CC = gcc CC = gcc
FC = g77 FC = g77
CFLAGS = -DLINUX -g $(DFORTIFY) CFLAGS = -DLINUX -g $(DFORTIFY) -I../..
FFLAGS = -u -fvxt -g FFLAGS = -u -fvxt -g
ARFLAGS = cr ARFLAGS = cr
@ -20,6 +23,9 @@ ARFLAGS = cr
PGPLOT =/afs/psi.ch/user/z/zolliker/pgplot/ PGPLOT =/afs/psi.ch/user/z/zolliker/pgplot/
PGLIB =$(PGPLOT)/libpgplot.a -L/usr/X11R6/lib -lX11 PGLIB =$(PGPLOT)/libpgplot.a -L/usr/X11R6/lib -lX11
# -- library for ASYNSRV
HARDSUPLIB=../hardsup/libhlib.a
# -- readline library # -- readline library
RDLIB =-lreadline -ltermcap RDLIB =-lreadline -ltermcap