From 32d8224dd759c4f9d792ca513553bc752253b2be Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 18 May 2012 14:05:11 +1000 Subject: [PATCH] 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 --- confvirtualmot.c | 8 ++++++++ motor.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/confvirtualmot.c b/confvirtualmot.c index e94fe9bd..69f7a000 100644 --- a/confvirtualmot.c +++ b/confvirtualmot.c @@ -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]); diff --git a/motor.c b/motor.c index c8cf487f..04fa5537 100644 --- a/motor.c +++ b/motor.c @@ -1190,7 +1190,7 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray); return iRet; } -static int CheckMotiMatch(const void* context, const void* pUserData) + int CheckMotiMatch(const void* context, const void* pUserData) { pMotInfo pMoti = (pMotInfo) pUserData; SConnection *pCon = (SConnection*) context;