Code cleanup.
r2693 | ffr | 2008-09-17 08:40:39 +1000 (Wed, 17 Sep 2008) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
02015668e2
commit
8b4c571d63
@@ -28,10 +28,10 @@ typedef enum {
|
||||
char *subcmdName[] = {"act", "args", "status", "debug", NULL};
|
||||
char *validActions[LASTACTION+1] = {"up", "down"};
|
||||
/* Each action takes two arguments, an axis label and the jogspeed */
|
||||
char *dfltActionSequence[ACTIONS][SEQLEN] = { {"SH%c","JG%c=%d", "BG%c", NULL}, {"SH%c","JG%c=(-1.0)*(%d)", "BG%c", NULL} };
|
||||
int dfltactArgs[ACTIONS][SEQLEN] = { {1,2,1}, {1,2,1} };
|
||||
char *dfltStatusCheck[ACTIONS][SEQLEN] = {{"TS%c", NULL}, {"TS%c", NULL}};
|
||||
char *dfltDevStatusMsg[] = {"up", "down", "inbetween", "FAULT: Are the limit switches connected?"};
|
||||
static char *dfltActionSequence[ACTIONS][SEQLEN] = { {"SH%c","JG%c=%d", "BG%c", NULL}, {"SH%c","JG%c=(-1.0)*(%d)", "BG%c", NULL} };
|
||||
static int dfltactArgs[ACTIONS][SEQLEN] = { {1,2,1}, {1,2,1} };
|
||||
static char *dfltStatusCheck[ACTIONS][SEQLEN] = {{"TS%c", NULL}, {"TS%c", NULL}};
|
||||
static char *dfltDevStatusMsg[] = {"up", "down", "inbetween", "FAULT: Are the limit switches connected?"};
|
||||
int numactions = 2;
|
||||
#define NUM_DEVSTATES 4
|
||||
// Mask TS reply to get limswitch status
|
||||
@@ -53,7 +53,7 @@ typedef struct __Action {
|
||||
char args[256];
|
||||
char cf_axis;
|
||||
int cf_jogspeed;
|
||||
int cf_mask[NUM_DEVSTATES];
|
||||
int cf_devState[NUM_DEVSTATES];
|
||||
int status;
|
||||
float fTarget;
|
||||
int debug;
|
||||
@@ -250,7 +250,7 @@ cmd_len = AO_CMDLEN;
|
||||
} else {
|
||||
limswi = LIMSWI_MASK & iFlags;
|
||||
for (devStatus = 0; devStatus < NUM_DEVSTATES; devStatus++) {
|
||||
if (self->cf_mask[devStatus] == limswi) {
|
||||
if (self->cf_devState[devStatus] == limswi) {
|
||||
self->devStatusID = devStatus;
|
||||
break;
|
||||
}
|
||||
@@ -358,15 +358,11 @@ int ActionObjectFactory(SConnection *pCon, SicsInterp *pSics, void *pData, int a
|
||||
pNew->statusCheck = dfltStatusCheck;
|
||||
pNew->devStatusMsg = dfltDevStatusMsg;
|
||||
pNew->cf_jogspeed = atoi(argv[3]);
|
||||
pNew->cf_mask[DEVUP] = atoi(argv[4]);
|
||||
pNew->cf_mask[DEVDOWN] = atoi(argv[5]);
|
||||
pNew->cf_mask[DEVBETWEEN] = 12; // REVSWI | FWDSWI
|
||||
pNew->cf_mask[DEVFLT] = 0; // REV & FWD low
|
||||
pNew->cf_devState[DEVUP] = atoi(argv[4]);
|
||||
pNew->cf_devState[DEVDOWN] = atoi(argv[5]);
|
||||
pNew->cf_devState[DEVBETWEEN] = 12; // REVSWI | FWDSWI
|
||||
pNew->cf_devState[DEVFLT] = 0; // REV & FWD low
|
||||
pNew->cf_axis = argv[6][0];
|
||||
printf("axis = %c\n", pNew->cf_axis);
|
||||
printf("jogspeed = %d\n", pNew->cf_jogspeed);
|
||||
for (i=0; i< NUM_DEVSTATES; i++)
|
||||
printf("mask[%d] = %d\n",i, pNew->cf_mask[i]);
|
||||
iRet = AddCommand(pSics, argv[1], AO_Wrapper, AO_Kill, pNew);
|
||||
if(!iRet) {
|
||||
sprintf(pError,"ERROR: duplicate command %s not created [%d]", argv[1], iRet);
|
||||
|
||||
Reference in New Issue
Block a user