diff --git a/source/SENTAnalyzer.cpp b/source/SENTAnalyzer.cpp
index 37c098d..3aa94e8 100644
--- a/source/SENTAnalyzer.cpp
+++ b/source/SENTAnalyzer.cpp
@@ -107,15 +107,7 @@ void SENTAnalyzer::syncPulseDetected()
{
U8 expected_crc = CalculateCRC();
bool crc_correct = (framelist.at(crc_nibble_number).mData1 == expected_crc);
- for(std::vector::iterator it = framelist.begin(); it != framelist.end(); it++) {
- if(!crc_correct && (it->mType == CRCNibble)) {
- addErrorFrame(expected_crc, it->mStartingSampleInclusive, it->mEndingSampleInclusive, CrcError);
- } else {
- mResults->AddFrame( *it );
- mResults->CommitResults();
- ReportProgress( it->mEndingSampleInclusive );
- }
- }
+ commit_results(crc_correct, expected_crc);
mResults->CommitPacketAndStartNewPacket();
}
else if( framelist.size() > 0 )
@@ -130,6 +122,69 @@ void SENTAnalyzer::syncPulseDetected()
framelist.clear();
}
+
+void SENTAnalyzer::commit_results(bool crc_correct, U8 expected_crc)
+{
+#if 1
+ /* Sync pulse */
+ mResults->AddFrame(framelist[0]);
+ mResults->CommitResults();
+ ReportProgress(framelist[0].mEndingSampleInclusive );
+
+ /* SCN */
+ mResults->AddFrame(framelist[1]);
+ mResults->CommitResults();
+ ReportProgress(framelist[1].mEndingSampleInclusive );
+
+ /* FC1 */
+ U16 fc1_data = ((framelist[2].mData1 & 0xF) << 8u) | ((framelist[3].mData1 & 0xF) << 4u) | (framelist[4].mData1 & 0xF);
+ Frame fc1_frame;
+ fc1_frame.mData1 = fc1_data;
+ fc1_frame.mFlags = 0;
+ fc1_frame.mType = FCNibble;
+ fc1_frame.mStartingSampleInclusive = framelist[2].mStartingSampleInclusive;
+ fc1_frame.mEndingSampleInclusive = framelist[4].mEndingSampleInclusive;
+
+ mResults->AddFrame(fc1_frame);
+ mResults->CommitResults();
+ ReportProgress(fc1_frame.mEndingSampleInclusive );
+
+ /* Secure counter */
+ U16 secure_counter_data = ((framelist[5].mData1 & 0xF) << 4u) | (framelist[6].mData1 & 0xF);
+ Frame secure_counter_frame;
+ secure_counter_frame.mData1 = secure_counter_data;
+ secure_counter_frame.mFlags = 0;
+ secure_counter_frame.mType = FCNibble;
+ secure_counter_frame.mStartingSampleInclusive = framelist[5].mStartingSampleInclusive;
+ secure_counter_frame.mEndingSampleInclusive = framelist[6].mEndingSampleInclusive;
+
+ mResults->AddFrame(secure_counter_frame);
+ mResults->CommitResults();
+ ReportProgress(secure_counter_frame.mEndingSampleInclusive );
+
+ for(std::vector::iterator it = framelist.begin() + 7; it != framelist.end(); it++)
+ {
+ if(!crc_correct && (it->mType == CRCNibble)) {
+ addErrorFrame(expected_crc, it->mStartingSampleInclusive, it->mEndingSampleInclusive, CrcError);
+ } else {
+ mResults->AddFrame(*it);
+ mResults->CommitResults();
+ ReportProgress(it->mEndingSampleInclusive );
+ }
+ }
+#else
+ for(std::vector::iterator it = framelist.begin(); it != framelist.end(); it++) {
+ if(!crc_correct && (it->mType == CRCNibble)) {
+ addErrorFrame(expected_crc, it->mStartingSampleInclusive, it->mEndingSampleInclusive, CrcError);
+ } else {
+ mResults->AddFrame(*it);
+ mResults->CommitResults();
+ ReportProgress(it->mEndingSampleInclusive );
+ }
+ }
+#endif
+
+}
/** Function for correcting the tick time
*
* This function should be called whenever a sync pulse is detected (given the specified clock tolerances)
diff --git a/source/SENTAnalyzer.h b/source/SENTAnalyzer.h
index 500b0a5..2388034 100644
--- a/source/SENTAnalyzer.h
+++ b/source/SENTAnalyzer.h
@@ -40,6 +40,7 @@ class ANALYZER_EXPORT SENTAnalyzer : public Analyzer2
U32 corrected_samples_per_tick;
void syncPulseDetected();
+ void commit_results(bool crc_correct, U8 expected_crc);
void correctTickTime(U32 number_of_samples);
U8 CalculateCRC();
bool isPulseSyncPulse(U16 number_of_ticks);