Use BAD_VALUE #define

r2002 | dcl | 2007-06-05 13:29:16 +1000 (Tue, 05 Jun 2007) | 2 lines
This commit is contained in:
Douglas Clowes
2007-06-05 13:29:16 +10:00
parent c8d13fef1d
commit ea52ccfcae

View File

@ -19,6 +19,8 @@
#include "confvirtmot.h" #include "confvirtmot.h"
#include "confvirtmot.i" #include "confvirtmot.i"
#define BAD_VALUE (-9999.99)
extern char *stptok(char *s, char *t, int len, char *brk); extern char *stptok(char *s, char *t, int len, char *brk);
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
@ -366,7 +368,7 @@ static void checkMotorValues(pConfigurableVirtualMotor self,
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static float ConfGetValue(void *pData, SConnection *pCon){ static float ConfGetValue(void *pData, SConnection *pCon){
pConfigurableVirtualMotor self = (pConfigurableVirtualMotor)pData; pConfigurableVirtualMotor self = (pConfigurableVirtualMotor)pData;
float currentValue = -9999.99; float currentValue = BAD_VALUE;
assert(self != NULL); assert(self != NULL);
@ -501,7 +503,6 @@ int ConfigurableVirtualMotorAction(SConnection *pCon, SicsInterp *pSics,
pConfigurableVirtualMotor self = NULL; pConfigurableVirtualMotor self = NULL;
char pBueffel[512]; char pBueffel[512];
float value; float value;
int iRet;
long lID; long lID;
pRegisteredInfo pRegInfo = NULL; pRegisteredInfo pRegInfo = NULL;
@ -561,7 +562,7 @@ int ConfigurableVirtualMotorAction(SConnection *pCon, SicsInterp *pSics,
pRegInfo->pName = strdup(argv[0]); pRegInfo->pName = strdup(argv[0]);
pRegInfo->pCon = pCon; pRegInfo->pCon = pCon;
value = ConfGetValue(self,pCon); value = ConfGetValue(self,pCon);
if(!iRet) if(value == BAD_VALUE)
{ {
sprintf(pBueffel,"Failed to register interest, Reason:Error obtaining current position for %s",argv[0]); sprintf(pBueffel,"Failed to register interest, Reason:Error obtaining current position for %s",argv[0]);
SCWrite(pCon,pBueffel,eError); SCWrite(pCon,pBueffel,eError);