Handle the case where motion control is not enabled on the panel. This is regarded as a hardware fault for all DMC2280 motors.
r1563 | dcl | 2007-03-01 09:09:32 +1100 (Thu, 01 Mar 2007) | 2 lines
This commit is contained in:
@@ -118,6 +118,9 @@ typedef struct __MoDriv {
|
||||
pNWTimer motor_timer;
|
||||
int debug;
|
||||
} DMC2280Driv, *pDMC2280Driv;
|
||||
|
||||
int DMC2280MotionControl = 1; /* defaults to enabled */
|
||||
|
||||
#define AIRPADS_DOWN 0
|
||||
#define AIRPADS_RAISE 1
|
||||
#define AIRPADS_UP 2
|
||||
@@ -138,6 +141,7 @@ typedef struct __MoDriv {
|
||||
#define IMPOSSIBLE_LIM_SW -14
|
||||
#define BGFAIL -15 // NOT SET
|
||||
#define BLOCKED -16
|
||||
#define MOTIONCONTROL -17
|
||||
/*--------------------------------------------------------------------*/
|
||||
#define STATUSMOVING 128 /* Motor is moving */
|
||||
#define STATUSERRORLIMIT 64 /* Number of errorss exceed limit */
|
||||
@@ -599,6 +603,12 @@ static int DMC2280Run(void *pData,float fValue){
|
||||
self = (pDMC2280Driv)pData;
|
||||
assert(self != NULL);
|
||||
|
||||
/* If Motion Control is off, report HWFault */
|
||||
if (!DMC2280MotionControl) {
|
||||
self->errorCode = MOTIONCONTROL;
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
if (self->motor_timer)
|
||||
NetWatchRemoveTimer(self->motor_timer);
|
||||
self->motor_timer = NULL;
|
||||
@@ -812,6 +822,11 @@ static int DMC2280Status(void *pData){
|
||||
}
|
||||
if (moving) {
|
||||
int iRet;
|
||||
/* If Motion Control is off, report HWFault */
|
||||
if (!DMC2280MotionControl) {
|
||||
self->errorCode = MOTIONCONTROL;
|
||||
return HWFault;
|
||||
}
|
||||
/* If pos hasn't changed since last
|
||||
* check then stop and scream */
|
||||
#if 0
|
||||
@@ -1004,6 +1019,9 @@ static void DMC2280Error(void *pData, int *iCode, char *error, int errLen){
|
||||
case BLOCKED:
|
||||
strncpy(error,"STOPPING MOTOR, MOTION SEEMS TO BE BLOCKED", (size_t)errLen);
|
||||
break;
|
||||
case MOTIONCONTROL:
|
||||
strncpy(error,"MOTION CONTROL SEEMS TO BE DISABLED", (size_t)errLen);
|
||||
break;
|
||||
default:
|
||||
/* FIXME What's the default */
|
||||
break;
|
||||
@@ -1034,6 +1052,7 @@ static int DMC2280Fix(void *pData, int iCode,/*@unused@*/ float fValue){
|
||||
//case TIMEOUT:
|
||||
case BADPAR:
|
||||
case BLOCKED:
|
||||
case MOTIONCONTROL:
|
||||
return MOTFAIL;
|
||||
case POSFAULT:
|
||||
case BADSEND:
|
||||
|
||||
Reference in New Issue
Block a user