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