remove trailing spaces on numerous lines

r1898 | dcl | 2007-04-20 11:56:22 +1000 (Fri, 20 Apr 2007) | 2 lines
This commit is contained in:
Douglas Clowes
2007-04-20 11:56:22 +10:00
parent ade5216ea9
commit 56cdbec451

View File

@@ -2,7 +2,7 @@
* \brief Driver for Galil DMC2280 motor controller.
*
* Implements a SICS motor object with a MotorDriver interface.
*
*
* Copyright: see file Copyright.txt
*
* Ferdi Franceschini November 2005
@@ -33,7 +33,7 @@
#define UNITSLEN 256
#define TEXTPARLEN 1024
#define CMDLEN 1024
/** \brief Used to ensure that the getDMCSetting function is called
/** \brief Used to ensure that the getDMCSetting function is called
* with valid values.
* \see getDMCSetting
*/
@@ -44,11 +44,11 @@ typedef int (*CommandCallback)(pCommand pCmd);
enum dmcsetting {dmcspeed, dmcacceleration, dmcdeceleration};
/*-----------------------------------------------------------------------
The motor driver structure. Please note that the first set of fields has
be identical with the fields of AbstractModriv in ../modriv.h
The motor driver structure. Please note that the first set of fields has
be identical with the fields of AbstractModriv in ../modriv.h
------------------------------------------------------------------------*/
struct __MoDriv {
/* general motor driver interface
/* general motor driver interface
fields. _REQUIRED!
*/
float fUpper; /**< hard upper limit */
@@ -60,14 +60,14 @@ struct __MoDriv {
void (*GetError)(void *self, int *iCode, char *buffer, int iBufLen);
int (*TryAndFixIt)(void *self,int iError, float fNew);
int (*Halt)(void *self);
int (*GetDriverPar)(void *self, char *name,
int (*GetDriverPar)(void *self, char *name,
float *value);
int (*SetDriverPar)(void *self,SConnection *pCon,
char *name, float newValue);
void (*ListDriverPar)(void *self, char *motorName,
SConnection *pCon);
void (*KillPrivate)(/*@only@*/void *self);
int (*GetDriverTextPar)(void *self, char *name,
int (*GetDriverTextPar)(void *self, char *name,
char *textPar);
@@ -75,7 +75,7 @@ struct __MoDriv {
pMultiChan mcc;
pMotor pMot; /**< Points to logical motor object */
int errorCode;
char *errorMsg; /**< Points to memory for error messages */
char *errorMsg; /**< Points to memory for error messages */
char units[256]; /**< physical units for axis */
char long_name[256]; /**< long name of motor */
char part[256]; /**< assembly which motor belongs to */
@@ -85,7 +85,7 @@ struct __MoDriv {
float maxAccel; /**< physical units per second^2 */
float decel; /**< physical units per second^2 */
float maxDecel; /**< physical units per second^2 */
char axisLabel;
char axisLabel;
char lastCmd[CMDLEN];
char dmc2280Error[CMDLEN];
float home; /**< home position for axis, default=0 */
@@ -112,7 +112,7 @@ struct __MoDriv {
int airpad_state; /**< state of the airpads finite state machine */
int airpad_counter; /**< airpad timer retry counter */
pNWTimer airpad_timer; /**< timer waiting for airpad action to complete */
pNWTimer motor_timer; /**< motor off timer */
pNWTimer motoff_timer; /**< motor off timer */
int debug;
int preseek; /**< Flag = 1 if current move is a backlash preseek */
};
@@ -132,7 +132,7 @@ int DMC2280MotionControl = 1; /* defaults to enabled */
#define BADSTP -6 // NOT SET
#define BADEMERG -7 // NOT SET: ESTOP
#define RVRSLIM -8
#define FWDLIM -9
#define FWDLIM -9
#define POSFAULT -11 // NOT SET
#define BADCUSHION -12 // NOT SET
#define ERRORLIM -13
@@ -192,11 +192,11 @@ struct __command {
/** \brief Convert axis speed in physical units to
* motor speed in steps/sec.
* \param self (r) provides access to the motor's data structure
* \param speed in physical units, eg mm/sec degrees/sec
* \param speed in physical units, eg mm/sec degrees/sec
* \return the speed in motor steps/sec
*/
static int motSpeed(pDMC2280Driv self, float axisSpeed) {
int speed;
int speed;
speed = (int) (fabs(axisSpeed * self->stepsPerX) + 0.5);
return speed;
}
@@ -204,7 +204,7 @@ static int motSpeed(pDMC2280Driv self, float axisSpeed) {
/** \brief Convert axis acceleration in physical units to
* to motor speed in steps/sec^2
* \param self (r) provides access to the motor's data structure
* \param acceleration in physical units, eg mm/sec^2 degrees/sec^2
* \param acceleration in physical units, eg mm/sec^2 degrees/sec^2
* \return the acceleration in motor steps/sec^2
*/
static int motAccel(pDMC2280Driv self, float axisAccel) {
@@ -216,7 +216,7 @@ static int motAccel(pDMC2280Driv self, float axisAccel) {
/** \brief Convert axis deceleration in physical units to
* motor deceleration in steps/sec^2
* \param self (r) provides access to the motor's data structure
* \param deceleration in physical units, eg mm/sec^2 degrees/sec^2
* \param deceleration in physical units, eg mm/sec^2 degrees/sec^2
* \return the deceleration in motor steps/sec^2
*/
static int motDecel(pDMC2280Driv self, float axisDecel) {
@@ -286,7 +286,7 @@ static int DMC_Rx(void* ctx, int rxchar) {
myCmd->inp_buf[myCmd->inp_idx++] = rxchar;
if (rxchar == 0x0A) {
/* end of line */
/*
/*
myCmd->inp_idx -= 2;
myCmd->inp_buf[myCmd->inp_idx++] = rxchar;
*/
@@ -565,7 +565,7 @@ static int readMotion(pDMC2280Driv self, float *steps, float *counts) {
char cmd[CMDLEN];
snprintf(cmd, CMDLEN, "MG _TD%c,_TP%c", self->axisLabel, self->axisLabel);
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
return FAILURE;
if (2 != sscanf(reply, "%f %f", steps, counts))
@@ -585,7 +585,7 @@ static int readAbsEnc(pDMC2280Driv self, float *pos) {
char cmd[CMDLEN];
snprintf(cmd, CMDLEN, "TP%c", self->axisLabel);
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
return FAILURE;
*pos = (float) atoi(reply);
@@ -604,7 +604,7 @@ static int ReadThread(pDMC2280Driv self, int thread, float *pos) {
char cmd[CMDLEN];
snprintf(cmd, CMDLEN, "MG _XQ%d", thread);
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
return 0;
*pos = (float) atoi(reply);
@@ -623,7 +623,7 @@ static int readHomeRun(pDMC2280Driv self, float *pos) {
char cmd[CMDLEN];
snprintf(cmd, CMDLEN, "MG HOMERUN");
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
if (FAILURE == DMC2280SendReceive(self, cmd, reply))
return FAILURE;
*pos = (float) atoi(reply);
@@ -647,13 +647,13 @@ static int RunHomeRoutine(pDMC2280Driv self, float newValue) {
/* 0 => reset homerun */
if (newValue < 0.5) {
snprintf(cmd, CMDLEN, "HOMERUN=0");
if (FAILURE == DMC2280Send(self, cmd))
return FAILURE;
if (FAILURE == DMC2280Send(self, cmd))
return FAILURE;
return SUCCESS;
}
snprintf(cmd, CMDLEN, "XQ #HOME,1");
if (FAILURE == DMC2280Send(self, cmd))
return FAILURE;
if (FAILURE == DMC2280Send(self, cmd))
return FAILURE;
return SUCCESS;
}
@@ -887,11 +887,11 @@ static int DMC_AirPads(pDMC2280Driv self, int flag) {
* \param context motor data
* \param mode
*/
static int motor_timeout(void* context, int mode) {
static int motoff_timeout(void* context, int mode) {
pDMC2280Driv self = (pDMC2280Driv) context;
char cmd[CMDLEN];
self->motor_timer = NULL;
self->motoff_timer = NULL;
if (self->has_airpads) {
DMC_AirPads(self, 0);
return 0;
@@ -905,12 +905,12 @@ static int motor_timeout(void* context, int mode) {
* the last check.
*
* The motion is checked against the expected at intervals of
* pDMC2280Driv->blockage_ckInterval.
* pDMC2280Driv->blockage_ckInterval.
*
* \param *pData provides access to a motor's data
* \return
* - 1 MOTOR OK, position has changed significantly during move
* - 0 MOTOR BLOCKED, no significant change in position detected.
* - 0 MOTOR BLOCKED, no significant change in position detected.
*/
static int checkMotion(void *pData) {
float precision, steps, counts, ratio_obs, ratio_exp, ratio_cmp;
@@ -1052,9 +1052,9 @@ static int DMC2280Run(void *pData,float fValue){
return HWFault;
}
if (self->motor_timer)
NetWatchRemoveTimer(self->motor_timer);
self->motor_timer = NULL;
if (self->motoff_timer)
NetWatchRemoveTimer(self->motoff_timer);
self->motoff_timer = NULL;
if (self->settle)
self->time_settle_done.tv_sec = 0;
@@ -1114,7 +1114,7 @@ static int DMC2280Status(void *pData){
* If we are waiting for the motor or airpads then we
* are busy
*/
if (self->motor_timer || self->airpad_timer)
if (self->motoff_timer || self->airpad_timer)
return HWBusy;
/* Make sure that speed, accel and decel are set correctly */
@@ -1144,7 +1144,7 @@ static int DMC2280Status(void *pData){
self->errorCode = MOTIONCONTROLUNK;
return HWFault;
}
/* If pos hasn't changed since last
/* If pos hasn't changed since last
* check then stop and scream */
#if 0
iRet = checkPosition(pData);
@@ -1231,9 +1231,9 @@ static int DMC2280Status(void *pData){
if (self->airpad_state == AIRPADS_LOWER)
return HWBusy;
if (self->motOffDelay > 0 ) {
NetWatchRegisterTimer(&self->motor_timer,
NetWatchRegisterTimer(&self->motoff_timer,
self->motOffDelay,
motor_timeout, self);
motoff_timeout, self);
return HWIdle;
}
if (!DMC_AirPads(self, 0))
@@ -1245,9 +1245,9 @@ static int DMC2280Status(void *pData){
#if 0
snprintf(cmd, CMDLEN, "AT %d; MO%c", self->motOffDelay, self->axisLabel);
#else
NetWatchRegisterTimer(&self->motor_timer,
NetWatchRegisterTimer(&self->motoff_timer,
self->motOffDelay,
motor_timeout, self);
motoff_timeout, self);
return HWIdle;
#endif
} else {
@@ -1276,7 +1276,7 @@ static void DMC2280Error(void *pData, int *iCode, char *error, int errLen){
self->errorMsg = (char *) malloc(errLen);
if (self->errorMsg == NULL) {
*iCode = 0;
return;
return;
}
}
*iCode = self->errorCode;
@@ -1380,7 +1380,7 @@ static int DMC2280Fix(void *pData, int iCode,/*@unused@*/ float fValue){
return MOTFAIL;
case POSFAULT:
#if HAS_RS232
case BADSEND:
case BADSEND:
case TIMEOUT:
case BADMEMORY: /* Won't happen if MonConnect sets the send terminator */
case INCOMPLETE:
@@ -1413,11 +1413,11 @@ static int DMC2280Halt(void *pData){
/* Stop motor */
snprintf(cmd, CMDLEN, "ST%c", self->axisLabel);
if (FAILURE == DMC2280Send(self, cmd))
return HWFault;
return HWFault;
/* TODO: FIXME cannot do this until motor stops */
snprintf(cmd, CMDLEN, "MO%c", self->axisLabel);
if (FAILURE == DMC2280Send(self, cmd))
return HWFault;
return HWFault;
else
return 1;
}
@@ -1428,13 +1428,13 @@ static int DMC2280Halt(void *pData){
* Note: The GetDriverPar method in the MotorDriver interface only
* allows float values to be returned.
*
* If the speed, acceleration or deceleration is requested then
* If the speed, acceleration or deceleration is requested then
* this compares the setting on the controller to the required setting,
* if they don't match then the controller is set to the required value.
*
* Note: Doesn't warn if the speed, acceleration, or deceleration set on
* the controller differ from the required settings.
*
*
* \param *pData (r) provides access to a motor's data
* \param *name (r) the name of the parameter to fetch.
* \param *fValue (w) the parameter's value.
@@ -1452,7 +1452,7 @@ static int DMC2280GetPar(void *pData, char *name,
if(strcasecmp(name,HOME) == 0) {
*fValue = self->home;
return 1;
}
}
if(strcasecmp(name,HARDLOWERLIM) == 0) {
*fValue = self->fLower;
return 1;
@@ -1883,7 +1883,7 @@ static void KillDMC2280(/*@only@*/void *pData){
* Motor stth DMC2280 paramArray\n
* - stth is the motor name
* - DMC2280 is the motor type that will lead to calling this function.
* - paramArray is a Tcl array of the motor parameters.
* - paramArray is a Tcl array of the motor parameters.
*
* \param *pCon (r) connection object.
* \param *motor (r) motor name
@@ -1894,7 +1894,7 @@ static void KillDMC2280(/*@only@*/void *pData){
* -Adding parameters
* - Add a field for the parameter to the DMC2280Driv struct
* - Get the parameter from the parameter array, see PARAMETERS: below
* - If the parameter requires an abs enc then add it after ABSENC:
* - If the parameter requires an abs enc then add it after ABSENC:
*/
MotorDriver *CreateDMC2280(SConnection *pCon, char *motor, char *params) {
pDMC2280Driv pNew = NULL;
@@ -1925,7 +1925,7 @@ MotorDriver *CreateDMC2280(SConnection *pCon, char *motor, char *params) {
if (!MultiChanCreate(pPtr, &pNew->mcc)) {
snprintf(pError, ERRLEN, "Cannot find MultiChan '%s' when creating DMC2280 motor '%s'",
pPtr, motor);
SCWrite(pCon,pError,eError);
SCWrite(pCon,pError,eError);
KillDMC2280(pNew);
return NULL;
}
@@ -1935,7 +1935,7 @@ MotorDriver *CreateDMC2280(SConnection *pCon, char *motor, char *params) {
char* host = pPtr;
if ((pPtr=getParam(pCon, interp, params,"port",_REQUIRED)) == NULL) {
snprintf(pError, ERRLEN, "\tError occurred when creating DMC2280 motor '%s'", motor);
SCWrite(pCon,pError,eError);
SCWrite(pCon,pError,eError);
KillDMC2280(pNew);
return NULL;
}
@@ -1944,7 +1944,7 @@ MotorDriver *CreateDMC2280(SConnection *pCon, char *motor, char *params) {
snprintf(pError, ERRLEN,
"Cannot create MultiChan '%s:%s' for DMC2280 motor '%s'",
host, pPtr, motor);
SCWrite(pCon,pError,eError);
SCWrite(pCon,pError,eError);
KillDMC2280(pNew);
return NULL;
}
@@ -1952,7 +1952,7 @@ MotorDriver *CreateDMC2280(SConnection *pCon, char *motor, char *params) {
}
else {
snprintf(pError, ERRLEN, "\tError occurred when creating DMC2280 motor '%s'", motor);
SCWrite(pCon,pError,eError);
SCWrite(pCon,pError,eError);
KillDMC2280(pNew);
return NULL;
}