Convert difscan skip count to be milliseconds
r3639 | dcl | 2012-07-11 15:12:51 +1000 (Wed, 11 Jul 2012) | 1 line
This commit is contained in:
19
diffscan.c
19
diffscan.c
@@ -15,6 +15,8 @@
|
||||
#include "drive.h"
|
||||
#include "counter.h"
|
||||
|
||||
extern double DoubleTime(void);
|
||||
|
||||
#define DIFFMONITOR 0
|
||||
#define SKIP 1
|
||||
|
||||
@@ -259,12 +261,27 @@ static int DiffScanTask(void *pData){
|
||||
char pBueffel[255];
|
||||
long rawCount, rawMon;
|
||||
CountEntry rawCopy;
|
||||
double now;
|
||||
|
||||
pDiffScan self = (pDiffScan)pData;
|
||||
|
||||
/*
|
||||
manage skip
|
||||
*/
|
||||
#if 1
|
||||
now = DoubleTime();
|
||||
if(self->skip > 0) {
|
||||
if (now - self->last_report_time < 0.001 * self->skip) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (now - self->last_report_time < 0.1) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
self->last_report_time = now;
|
||||
#else
|
||||
if(self->skip > 0){
|
||||
if(self->skipCount > self->skip){
|
||||
self->skipCount = 0;
|
||||
@@ -273,6 +290,7 @@ static int DiffScanTask(void *pData){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
read motor status
|
||||
@@ -353,6 +371,7 @@ int RunDiffScan(pDiffScan self, pScanData pScan,
|
||||
if(StartDiffScan(self,pScan,pCon,fEnd) != 1) {
|
||||
return 0;
|
||||
}
|
||||
self->last_report_time = DoubleTime();
|
||||
InvokeCallBack(self->scanObject->pCall,SCANSTART,self->scanObject);
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ typedef struct {
|
||||
int skip;
|
||||
int skipCount;
|
||||
pScanData scanObject;
|
||||
double last_report_time;
|
||||
} DiffScan, *pDiffScan;
|
||||
|
||||
/*==================================================================*/
|
||||
|
||||
Reference in New Issue
Block a user