- New batch file management module
- New oscillator module - Bug fixes
This commit is contained in:
30
el734hp.c
30
el734hp.c
@ -55,6 +55,8 @@
|
||||
float lastValue;
|
||||
int errorCode;
|
||||
int oredMsr;
|
||||
int posCount;
|
||||
int runCount;
|
||||
} EL734Driv, *pEL734Driv;
|
||||
/*------------------- error codes ----------------------------------*/
|
||||
#define BADADR -1
|
||||
@ -71,6 +73,7 @@
|
||||
#define RUNFAULT -12
|
||||
#define POSFAULT -13
|
||||
#define BADCUSHION -14
|
||||
#define BADCOUNT -15
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int checkResponse(pEL734Driv self, char *pReply){
|
||||
/*
|
||||
@ -142,11 +145,18 @@ static int EL734Run(void *pData,float fValue){
|
||||
if(!checkResponse(self,pReply)){
|
||||
return HWFault;
|
||||
}
|
||||
self->posCount =0;
|
||||
self->runCount = 0;
|
||||
return OKOK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static int decodeMSR(pEL734Driv self, int msr){
|
||||
if (msr == 0){
|
||||
if(self->posCount > 0 || self->runCount > 0){
|
||||
self->errorCode = BADCOUNT;
|
||||
return HWPosFault;
|
||||
}
|
||||
|
||||
/*
|
||||
we are done: check ored_msr for troubles
|
||||
*/
|
||||
@ -187,6 +197,15 @@ static int decodeMSR(pEL734Driv self, int msr){
|
||||
/*
|
||||
we are still tugging along ............
|
||||
*/
|
||||
if(msr & 0x80){
|
||||
self->runCount++;
|
||||
} else if(msr & 0x200) {
|
||||
self->posCount++;
|
||||
} else if(msr & 0x100) {
|
||||
self->posCount++;
|
||||
} else if(msr & 0x400) {
|
||||
self->posCount++;
|
||||
}
|
||||
|
||||
return HWBusy;
|
||||
/* inserted above line and commented out lines below M.Zolliker Sep 2004
|
||||
@ -250,6 +269,8 @@ static int EL734Status(void *pData){
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void EL734Error(void *pData, int *iCode, char *error, int errLen){
|
||||
pEL734Driv self = NULL;
|
||||
char pBueffel[132];
|
||||
|
||||
self = (pEL734Driv)pData;
|
||||
assert(self);
|
||||
|
||||
@ -297,6 +318,11 @@ static void EL734Error(void *pData, int *iCode, char *error, int errLen){
|
||||
case BADCUSHION:
|
||||
strncpy(error,"Air cushion problem",errLen);
|
||||
break;
|
||||
case BADCOUNT:
|
||||
snprintf(pBueffel,131,"%d RunFaults, %d PosFaults",
|
||||
self->runCount, self->posCount);
|
||||
strncpy(error,pBueffel,errLen);
|
||||
break;
|
||||
default:
|
||||
getRS232Error(*iCode,error,errLen);
|
||||
break;
|
||||
@ -328,6 +354,10 @@ static int EL734Fix(void *pData, int iCode, float fValue){
|
||||
case RUNFAULT:
|
||||
case POSFAULT:
|
||||
return MOTREDO;
|
||||
case BADCOUNT:
|
||||
self->runCount = 0;
|
||||
self->posCount = 0;
|
||||
return MOTOK;
|
||||
}
|
||||
return MOTFAIL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user