Make the motion control test tighter, remove some obsolete code, and resolve some compilation warnings

r1565 | dcl | 2007-03-02 08:27:14 +1100 (Fri, 02 Mar 2007) | 2 lines
This commit is contained in:
Douglas Clowes
2007-03-02 08:27:14 +11:00
parent ff445f336b
commit 74e8db377d

View File

@@ -352,6 +352,7 @@ static void set_lastMotion(pDMC2280Driv self, float steps, float counts) {
gettimeofday(&(self->time_lastPos_set), NULL);
}
#if 0
/** \brief Record the given posn and timestamp it.
*
* \param *pData provides access to a motor's data
@@ -426,6 +427,7 @@ static int getDMCSetting(void *pData, enum dmcsetting cmdIndex){
DMC2280Send(self, cmd);
}
}
#endif
/** \brief Reads motion.
*
@@ -597,14 +599,14 @@ static int DMC2280RunAir(void *pData, float fValue) {
static int DMC2280Run(void *pData,float fValue){
pDMC2280Driv self = NULL;
char axis;
char cmd[CMDLEN], SHx[CMDLEN], BGx[CMDLEN], absPosCmd[CMDLEN];
char SHx[CMDLEN], BGx[CMDLEN], absPosCmd[CMDLEN];
int absEncHome, stepsPerX, motorHome, cntsPerX, newAbsPosn;
float target;
self = (pDMC2280Driv)pData;
assert(self != NULL);
/* If Motion Control is off, report HWFault */
if (!DMC2280MotionControl) {
if (DMC2280MotionControl != 1) {
self->errorCode = MOTIONCONTROL;
return HWFault;
}
@@ -653,9 +655,13 @@ static int DMC2280Run(void *pData,float fValue){
stepsPerX,
axis);
#ifdef BACKLASHFIX
snprintf(cmd, CMDLEN, "%cQTARGET=%d", axis, (int) (target * cntsPerX + absEncHome + 0.5));
if (FAILURE == DMC2280Send(self, cmd))
return HWFault;
do {
char cmd[CMDLEN];
snprintf(cmd, CMDLEN, "%cQTARGET=%d", axis,
(int) (target * cntsPerX + absEncHome + 0.5));
if (FAILURE == DMC2280Send(self, cmd))
return HWFault;
} while (0);
#endif
} else {
newAbsPosn = (int)(target * stepsPerX + motorHome + 0.5);
@@ -733,6 +739,7 @@ static int checkMotion(void *pData) {
return 1;
}
#if 0
/** \brief Check if the axis position has changed significantly since
* the last check.
*
@@ -767,6 +774,7 @@ static int checkPosition(void *pData) {
return 1;
}
}
#endif
/** \brief Returns the motor status while it's moving,
* implements the GetStatus method in the MotorDriver interface.
@@ -823,7 +831,7 @@ static int DMC2280Status(void *pData){
if (moving) {
int iRet;
/* If Motion Control is off, report HWFault */
if (!DMC2280MotionControl) {
if (DMC2280MotionControl != 1) {
self->errorCode = MOTIONCONTROL;
return HWFault;
}
@@ -1220,7 +1228,7 @@ static int DMC2280SetPar(void *pData, SConnection *pCon,
pDMC2280Driv self = NULL;
char pError[ERRLEN];
char cmd[CMDLEN];
float currPos, oldZero, newZero;
float oldZero, newZero;
self = (pDMC2280Driv)pData;