- 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:
63
ecbdriv.c
63
ecbdriv.c
@@ -240,6 +240,7 @@ static int checkMotorResult(pECBMotDriv self, Z80_reg out){
|
||||
self->errorCode = ECBINHIBIT;
|
||||
break;
|
||||
case 32:
|
||||
case 96:
|
||||
self->errorCode = ECBRUNNING;
|
||||
break;
|
||||
case 1:
|
||||
@@ -252,6 +253,7 @@ static int checkMotorResult(pECBMotDriv self, Z80_reg out){
|
||||
self->errorCode = ECBINUSE;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Unidentified ECB motor error code %d\n", out.b);
|
||||
self->errorCode = UNIDENTIFIED;
|
||||
break;
|
||||
}
|
||||
@@ -846,30 +848,6 @@ static void ECBGetError(void *pData, int *iCode, char *buffer, int bufferlen){
|
||||
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){
|
||||
pECBMotDriv self = (pECBMotDriv)pData;
|
||||
@@ -890,6 +868,42 @@ static int ECBHalt(void *pData){
|
||||
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){
|
||||
pECBMotDriv self = (pECBMotDriv)pData;
|
||||
ObPar *par = NULL;
|
||||
@@ -1019,6 +1033,7 @@ static int ECBSetDriverPar(void *pData, SConnection *pCon, char *name,
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return status;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user