Add uninterest to Virtual Motors and externalize CheckMotiMatch in motor.c

r3548 | dcl | 2012-05-18 14:05:11 +1000 (Fri, 18 May 2012) | 1 line
This commit is contained in:
Douglas Clowes
2012-05-18 14:05:11 +10:00
parent 585b67ca5a
commit 32d8224dd7
2 changed files with 9 additions and 1 deletions

View File

@@ -22,6 +22,7 @@
#define BAD_VALUE (-9999.99)
extern char *stptok(char *s, char *t, int len, char *brk);
extern int CheckMotiMatch(const void* context, const void* pUserData);
/*---------------------------------------------------------------------------
An internal data structure which holds information required to control
@@ -571,10 +572,17 @@ int ConfigurableVirtualMotorAction(SConnection *pCon, SicsInterp *pSics,
}
pRegInfo->lastValue = value;
RemoveCallback3(self->pCall, InterestCallback, CheckMotiMatch, pCon); /* only this one */
lID = RegisterCallback(self->pCall, SCGetContext(pCon),MOTDRIVE, InterestCallback, pRegInfo, KillInfo);
SCRegister(pCon,pSics, self->pCall,lID);
SCSendOK(pCon);
return 1;
}
else if(strcmp(argv[1],"uninterest") == 0)
{
RemoveCallback3(self->pCall, InterestCallback, CheckMotiMatch, pCon);
SCSendOK(pCon);
return 1;
} else {
snprintf(pBueffel,5120,"ERROR: subcommand %s to %s unknown",
argv[1],argv[0]);