Reverse compare operator to correct report rate logic

r3613 | dcl | 2012-06-20 14:57:37 +1000 (Wed, 20 Jun 2012) | 1 line
This commit is contained in:
Douglas Clowes
2012-06-20 14:57:37 +10:00
parent d99d9cc7ee
commit 79c4acc5ad
2 changed files with 9 additions and 4 deletions

View File

@@ -23,6 +23,7 @@
extern char *stptok(char *s, char *t, int len, char *brk);
extern int CheckMotiMatch(const void* context, const void* pUserData);
extern double DoubleTime();
/*---------------------------------------------------------------------------
An internal data structure which holds information required to control
@@ -191,6 +192,7 @@ static long ConfSetValue(void *pData, SConnection *pCon, float newValue){
self->targetValue = newValue;
self->targetReached = 0;
self->posCount = 0;
self->last_report_time = 0.0;
status = startMotorList(self,pCon);
if(status != OKOK){
@@ -314,10 +316,10 @@ static int ConfCheckStatus(void *pData, SConnection *pCon){
InvokeCallBack(self->pCall, MOTDRIVE, &event);
} else if (result == HWBusy) {
#if 1
double current_time, skip_time, DoubleTime(void);
double current_time, skip_time;
current_time = DoubleTime();
skip_time = 0.500;
if (self->last_report_time + skip_time >= current_time)
if (self->last_report_time + skip_time <= current_time)
#else
self->posCount++;
if(self->posCount >= 10/*ObVal(self->ParArray,MOVECOUNT)*/)
@@ -469,6 +471,7 @@ int MakeConfigurableVirtualMotor(SConnection *pCon, SicsInterp *pSics,
pNew->name = strdup(argv[1]);
pNew->posCount = 0;
pNew->last_report_time = 0.0;
pNew->pDes = CreateDescriptor("ConfigurableVirtualMotor");
pNew->pDriv = CreateDrivableInterface();
pNew->motorList = LLDcreate(sizeof(RealMotor));