More robust reading of the start sample from opto-data.
This commit is contained in:
@@ -343,7 +343,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
double timestampSecEnd2;
|
||||
double timestampSecEnd3;
|
||||
|
||||
private int telegramIx;
|
||||
int currentTelegramIx;
|
||||
bool startSampleAcquired;
|
||||
public int TestStartTelegramIx;
|
||||
public int TestEndTelegramIx;
|
||||
|
||||
@@ -548,6 +549,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
|
||||
/// Reset opto data
|
||||
optoDataCount = 0;
|
||||
currentTelegramIx = -1;
|
||||
startSampleAcquired = false;
|
||||
TestStartTelegramIx = 0;
|
||||
TestEndTelegramIx = 0;
|
||||
|
||||
@@ -584,12 +587,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
sampleNr++;
|
||||
ReadPulses();
|
||||
if (sampleNr == 4)
|
||||
if (!startSampleAcquired && (sampleNr >= 4) && (currentTelegramIx >= 0))
|
||||
{
|
||||
/// Take the test start sample
|
||||
startSampleAcquired = true;
|
||||
volumeLtrStart = volumeLtr;
|
||||
timestampSecStart = timestampSec;
|
||||
TestStartTelegramIx = telegramIx;
|
||||
TestStartTelegramIx = currentTelegramIx;
|
||||
}
|
||||
|
||||
/// Shift data in pipelines
|
||||
@@ -603,7 +607,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
timestampSecEnd2 = timestampSecEnd1;
|
||||
timestampSecEnd1 = timestampSec;
|
||||
|
||||
TestEndTelegramIx = telegramIx - 3;
|
||||
if (startSampleAcquired && (currentTelegramIx >= 3))
|
||||
{
|
||||
TestEndTelegramIx = currentTelegramIx - 3;
|
||||
}
|
||||
|
||||
return Event.ReadRegisterDone;
|
||||
}
|
||||
@@ -851,7 +858,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
|
||||
void OptoTelegramRreceived(int currentIx, bool async, Int64 volumeRawExt, Int64 timestampRawExt)
|
||||
{
|
||||
telegramIx = currentIx;
|
||||
currentTelegramIx = currentIx;
|
||||
|
||||
lastVolumeRaw = volumeRawExt;
|
||||
lastTimestamp = timestampRawExt;
|
||||
|
||||
Reference in New Issue
Block a user