diff --git a/diffscan.c b/diffscan.c index 08fd95d3..8639134e 100644 --- a/diffscan.c +++ b/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); diff --git a/diffscan.h b/diffscan.h index 17fa5e4f..847ed3cf 100644 --- a/diffscan.h +++ b/diffscan.h @@ -22,6 +22,7 @@ typedef struct { int skip; int skipCount; pScanData scanObject; + double last_report_time; } DiffScan, *pDiffScan; /*==================================================================*/