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