Change movecount to millisecond rather than loop count because of faster loop count on newere hardware/software

r3611 | dcl | 2012-06-19 14:01:09 +1000 (Tue, 19 Jun 2012) | 1 line
This commit is contained in:
Douglas Clowes
2012-06-19 14:01:09 +10:00
parent 6891ac08ee
commit da624bba07
4 changed files with 25 additions and 2 deletions

14
motor.c
View File

@@ -368,15 +368,25 @@ static int evaluateStatus(pMotor self, SConnection *pCon)
/*---------------------------------------------------------------------*/
static void handleMoveCallback(pMotor self, SConnection *pCon)
{
MotCallback sCall;
#if 1
double current_time, skip_time, DoubleTime(void);
current_time = DoubleTime();
skip_time = 0.001 * ObVal(self->ParArray,MOVECOUNT);
if(self->last_report_time + skip_time >= current_time)
#else
self->posCount++;
if(self->posCount >= ObVal(self->ParArray,MOVECOUNT))
#endif
{
MotCallback sCall;
MotorGetSoftPosition(self,pCon,&sCall.fVal);
sCall.pName = self->name;
InvokeCallBack(self->pCall, MOTDRIVE, &sCall);
#if 1
self->last_report_time = current_time;
#else
self->posCount = 0;
#endif
}
}
/*-----------------------------------------------------------------------*/