Added a motor driver which ignores air cushion errors for TRICS (falsely triggered)
This commit is contained in:
101
el734hp.c
101
el734hp.c
@ -744,3 +744,104 @@ MotorDriver *CreateEL734HPT(SConnection * pCon, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
return pDriv;
|
return pDriv;
|
||||||
}
|
}
|
||||||
|
/*======================================================================
|
||||||
|
A version which ignores the air cushion error for TRICS. Not recommended for
|
||||||
|
general use!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
But HW cannot be fixed.... as the electronics guys are not there.......
|
||||||
|
========================================================================*/
|
||||||
|
static int EL734FixAir(void *pData, int iCode, float fValue)
|
||||||
|
{
|
||||||
|
pEL734Driv self = NULL;
|
||||||
|
int status, msr, i, len = 49;
|
||||||
|
char pCommand[50], pReply[80];
|
||||||
|
|
||||||
|
self = (pEL734Driv) pData;
|
||||||
|
assert(self);
|
||||||
|
|
||||||
|
switch (iCode) {
|
||||||
|
/*
|
||||||
|
air cushion error is really OK.....
|
||||||
|
*/
|
||||||
|
case BADCUSHION:
|
||||||
|
return MOTOK;
|
||||||
|
case BADADR:
|
||||||
|
case BADCMD:
|
||||||
|
case BADPAR:
|
||||||
|
return MOTREDO;
|
||||||
|
case BADBSY:
|
||||||
|
EL734Halt(pData);
|
||||||
|
SicsWait(1);
|
||||||
|
return MOTREDO;
|
||||||
|
case TIMEOUT:
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
len = 49;
|
||||||
|
status = readRS232TillTerm(self->controller, pReply, &len);
|
||||||
|
if (status == 1) {
|
||||||
|
return MOTREDO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
If nothing can be read, the only fixable cause is a network breakdown
|
||||||
|
Try to fix this. If this does not work: give up
|
||||||
|
*/
|
||||||
|
closeRS232(self->controller);
|
||||||
|
SicsWait(60);
|
||||||
|
status = initRS232(self->controller);
|
||||||
|
if (status != 1) {
|
||||||
|
return MOTFAIL;
|
||||||
|
} else {
|
||||||
|
return MOTREDO;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BADUNKNOWN:
|
||||||
|
if (availableRS232(self->controller)) {
|
||||||
|
len = 79;
|
||||||
|
readRS232TillTerm(self->controller, pReply, &len);
|
||||||
|
return MOTREDO;
|
||||||
|
}
|
||||||
|
return MOTFAIL;
|
||||||
|
break;
|
||||||
|
case BADLOC:
|
||||||
|
snprintf(pCommand, 49, "RMT 1\r");
|
||||||
|
transactEL734(self->controller, pCommand, strlen(pCommand), pReply,
|
||||||
|
79);
|
||||||
|
snprintf(pCommand, 49, "ECHO 0\r");
|
||||||
|
transactEL734(self->controller, pCommand, strlen(pCommand), pReply,
|
||||||
|
79);
|
||||||
|
return MOTREDO;
|
||||||
|
case NOTCONNECTED:
|
||||||
|
initRS232(self->controller);
|
||||||
|
return MOTREDO;
|
||||||
|
case RUNFAULT:
|
||||||
|
case POSFAULT:
|
||||||
|
return MOTREDO;
|
||||||
|
case BADCOUNT:
|
||||||
|
self->runCount = 0;
|
||||||
|
self->posCount = 0;
|
||||||
|
return MOTOK;
|
||||||
|
case BADSEND:
|
||||||
|
/*
|
||||||
|
network problem: try to reopen connection
|
||||||
|
*/
|
||||||
|
closeRS232(self->controller);
|
||||||
|
SicsWait(60);
|
||||||
|
status = initRS232(self->controller);
|
||||||
|
if (status != 1) {
|
||||||
|
return MOTFAIL;
|
||||||
|
} else {
|
||||||
|
return MOTREDO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MOTFAIL;
|
||||||
|
}
|
||||||
|
/*-------------------------------------------------------------------------*/
|
||||||
|
MotorDriver *CreateEL734Air(SConnection * pCon, int argc, char *argv[])
|
||||||
|
{
|
||||||
|
MotorDriver *pDriv = NULL;
|
||||||
|
pDriv = CreateEL734HP(pCon, argc, argv);
|
||||||
|
if (pDriv != NULL) {
|
||||||
|
pDriv->TryAndFixIt = EL734FixAir;
|
||||||
|
}
|
||||||
|
return pDriv;
|
||||||
|
}
|
||||||
|
|
||||||
|
13
psi.c
13
psi.c
@ -145,6 +145,7 @@ static void AddPsiCommands(SicsInterp * pInter)
|
|||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
MotorDriver *CreateEL734HP(SConnection * pCon, int argc, char *argv[]);
|
MotorDriver *CreateEL734HP(SConnection * pCon, int argc, char *argv[]);
|
||||||
MotorDriver *CreateEL734HPT(SConnection * pCon, int argc, char *argv[]);
|
MotorDriver *CreateEL734HPT(SConnection * pCon, int argc, char *argv[]);
|
||||||
|
MotorDriver *CreateEL734Air(SConnection * pCon, int argc, char *argv[]);
|
||||||
MotorDriver *MakePiPiezo(Tcl_Interp * pTcl, char *pArray);
|
MotorDriver *MakePiPiezo(Tcl_Interp * pTcl, char *pArray);
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
static pMotor CreatePsiMotor(SConnection * pCon, int argc, char *argv[])
|
static pMotor CreatePsiMotor(SConnection * pCon, int argc, char *argv[])
|
||||||
@ -180,6 +181,18 @@ static pMotor CreatePsiMotor(SConnection * pCon, int argc, char *argv[])
|
|||||||
SCWrite(pCon, pBueffel, eError);
|
SCWrite(pCon, pBueffel, eError);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(argv[1], "el734air") == 0) {
|
||||||
|
pDriver = (MotorDriver *) CreateEL734Air(pCon, argc - 2, &argv[2]);
|
||||||
|
if (!pDriver) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* create the motor */
|
||||||
|
pNew = MotorInit("EL734air", argv[0], pDriver);
|
||||||
|
if (!pNew) {
|
||||||
|
snprintf(pBueffel,131, "Failure to create motor %s", argv[1]);
|
||||||
|
SCWrite(pCon, pBueffel, eError);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
} else if (strcmp(argv[1], "el734hpt") == 0) {
|
} else if (strcmp(argv[1], "el734hpt") == 0) {
|
||||||
pDriver = (MotorDriver *) CreateEL734HPT(pCon, argc - 2, &argv[2]);
|
pDriver = (MotorDriver *) CreateEL734HPT(pCon, argc - 2, &argv[2]);
|
||||||
if (!pDriver) {
|
if (!pDriver) {
|
||||||
|
@ -196,6 +196,7 @@ int SansliRebin(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|||||||
sortData[ix].frac = frac;
|
sortData[ix].frac = frac;
|
||||||
} else {
|
} else {
|
||||||
val = .0;
|
val = .0;
|
||||||
|
frac = .0;
|
||||||
}
|
}
|
||||||
setSICSDataInt(target, pos, (int) val);
|
setSICSDataInt(target, pos, (int) val);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user