Implemented and fixed many issues
This commit is contained in:
@@ -16,6 +16,10 @@ TimeArrayGAM::TimeArrayGAM() :
|
||||
GAM(),
|
||||
samplingRate(1000000.0),
|
||||
anchorIsFirst(true),
|
||||
anchorIsCont(false),
|
||||
contStarted(false),
|
||||
contOriginNs(0u),
|
||||
contSamples(0u),
|
||||
nElements(0u),
|
||||
inputTime(NULL_PTR(uint32 *)),
|
||||
outputBuf(NULL_PTR(uint64 *)) {
|
||||
@@ -42,9 +46,12 @@ bool TimeArrayGAM::Initialise(StructuredDataI &data) {
|
||||
else if (anchor == "LastSample") {
|
||||
anchorIsFirst = false;
|
||||
}
|
||||
else if (anchor == "Continuous") {
|
||||
anchorIsCont = true;
|
||||
}
|
||||
else {
|
||||
REPORT_ERROR(ErrorManagement::InitialisationError,
|
||||
"TimeArrayGAM: Anchor must be 'FirstSample' or 'LastSample'.");
|
||||
"TimeArrayGAM: Anchor must be 'FirstSample', 'LastSample' or 'Continuous'.");
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +95,21 @@ bool TimeArrayGAM::Execute() {
|
||||
/* Input is uint32 microseconds (LinuxTimer); convert to nanoseconds. */
|
||||
uint64 anchorNs = static_cast<uint64>(*inputTime) * 1000u;
|
||||
|
||||
if (anchorIsFirst) {
|
||||
if (anchorIsCont) {
|
||||
/* Latch the timer once, then run off an internal sample counter so a
|
||||
* lost RT cycle (LinuxTimer re-phases with counter += nCycles) cannot
|
||||
* punch a hole into an otherwise contiguous sample stream. */
|
||||
if (!contStarted) {
|
||||
contOriginNs = anchorNs;
|
||||
contStarted = true;
|
||||
}
|
||||
for (uint32 k = 0u; k < nElements; k++) {
|
||||
outputBuf[k] = contOriginNs +
|
||||
(contSamples + static_cast<uint64>(k)) * periodNs;
|
||||
}
|
||||
contSamples += static_cast<uint64>(nElements);
|
||||
}
|
||||
else if (anchorIsFirst) {
|
||||
/* out[k] = anchorNs + k * periodNs */
|
||||
for (uint32 k = 0u; k < nElements; k++) {
|
||||
outputBuf[k] = anchorNs + static_cast<uint64>(k) * periodNs;
|
||||
|
||||
Reference in New Issue
Block a user