- Implemented defpos for multiple motors
- Implemented automatic backup on parameter change - Implemented silent restore - Cleaned a couple of unused flags from connection object
This commit is contained in:
61
mumo.c
61
mumo.c
@ -161,6 +161,7 @@
|
||||
#define POSFIND 11
|
||||
#define NAMALL 12
|
||||
#define LIST 13
|
||||
#define DEFPOS 14
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int GetNextToken(psParser self, pMulMot pDings)
|
||||
{
|
||||
@ -283,6 +284,11 @@
|
||||
self->iCurrentToken = LIST;
|
||||
return LIST;
|
||||
}
|
||||
else if(strcmp(self->Token,"defpos") ==0)
|
||||
{
|
||||
self->iCurrentToken = DEFPOS;
|
||||
return DEFPOS;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->iCurrentToken = SYMBOL;
|
||||
@ -602,7 +608,7 @@
|
||||
char pCommand[1064];
|
||||
char *pPtr;
|
||||
|
||||
/* is the user allowe dto do ANYTHING ? */
|
||||
/* is the user allowed to do ANYTHING ? */
|
||||
iRet = CheckPermission(pCon,self);
|
||||
if(!iRet)
|
||||
{
|
||||
@ -625,8 +631,56 @@
|
||||
}
|
||||
return 0; /* not reached */
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int ParseDefPos(SicsInterp *pSics,psParser pPP,
|
||||
pMulMot self, SConnection *pCon)
|
||||
{
|
||||
pMotor pMot = NULL;
|
||||
char pError[132], motorName[80], command[1024], namPos[80];
|
||||
int iToken, status;
|
||||
float fVal;
|
||||
|
||||
|
||||
iToken = GetNextToken(pPP,self);
|
||||
if(iToken != SYMBOL) /* we want a name here */
|
||||
{
|
||||
sprintf(pError,"ERROR: Invalid Token %s in ParsePos",pPP->Token);
|
||||
SCWrite(pCon,pError,eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
strncpy(namPos,pPP->Token,79);
|
||||
iToken = GetNextToken(pPP,self);
|
||||
command[0] = '\0';
|
||||
while(iToken != END)
|
||||
{
|
||||
if(iToken != ALIAS)
|
||||
{
|
||||
sprintf(command,"ERROR: expected motor alias, got: %s", pPP->Token);
|
||||
SCWrite(pCon,command,eError);
|
||||
return 0;
|
||||
}
|
||||
StringDictGet(self->pAlias,pPP->Token,motorName,79);
|
||||
strcat(command, motorName);
|
||||
strcat(command," ");
|
||||
iToken = GetNextToken(pPP,self);
|
||||
if(iToken != NUMBER)
|
||||
{
|
||||
sprintf(command,"ERROR: expected number, got: %s", pPP->Token);
|
||||
SCWrite(pCon,command,eError);
|
||||
return 0;
|
||||
}
|
||||
strcat(command,pPP->Token);
|
||||
strcat(command," ");
|
||||
iToken = GetNextToken(pPP,self);
|
||||
}
|
||||
|
||||
/* The rest of the stuff should be the motors to drive until
|
||||
we are there
|
||||
*/
|
||||
StringDictAddPair(self->pNamPos,namPos,command);
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------
|
||||
MultiWrapper is the user interface to a multi motor unit. It supports the
|
||||
following syntax, where DingsBums is the name of the unit:
|
||||
@ -727,6 +781,9 @@
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case DEFPOS:
|
||||
return ParseDefPos(pSics,&MyParser,self,pCon);
|
||||
break;
|
||||
case LIST:
|
||||
pPtr = NULL;
|
||||
Tcl_DStringInit(&tString);
|
||||
|
Reference in New Issue
Block a user