From 4398adb90243858edcf3c491b730aeb3bba62163 Mon Sep 17 00:00:00 2001
From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es>
Date: Tue, 23 Jun 2015 03:09:00 +0200
Subject: [PATCH] Add debug line to packet decoding

---
 .../DataThreads/rhythm-api/rhd2000datablock.cpp        | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000datablock.cpp b/Source/Processors/DataThreads/rhythm-api/rhd2000datablock.cpp
index e412ee170..443a0134d 100755
--- a/Source/Processors/DataThreads/rhythm-api/rhd2000datablock.cpp
+++ b/Source/Processors/DataThreads/rhythm-api/rhd2000datablock.cpp
@@ -142,13 +142,16 @@ void Rhd2000DataBlock::fillFromUsbBuffer(unsigned char usbBuffer[], int blockInd
 {
     int index, t, channel, stream, i;
 	int samplesToRead = nSamples <= 0 ? samplesPerBlock : nSamples;
+	int num = 0;
 
     index = blockIndex * 2 * calculateDataBlockSizeInWords(numDataStreams, usb3);
 	for (t = 0; t < samplesToRead; ++t) {
-        if (!checkUsbHeader(usbBuffer, index)) {
-            cerr << "Error in Rhd2000EvalBoard::readDataBlock: Incorrect header." << endl;
+		if (!checkUsbHeader(usbBuffer, index)) {
+			cerr << "Error in Rhd2000EvalBoard::readDataBlock: Incorrect header." << endl;
 			break;
-        }
+		}
+		else
+			num++;
 		//else cerr << "Block ok" << endl;
         index += 8;
         timeStamp[t] = convertUsbTimeStamp(usbBuffer, index);
@@ -186,6 +189,7 @@ void Rhd2000DataBlock::fillFromUsbBuffer(unsigned char usbBuffer[], int blockInd
         ttlOut[t] = convertUsbWord(usbBuffer, index);
         index += 2;
     }
+	cout << "Read " << num << " valid samples with " << numDataStreams << " streams. Usb mode status: " << usb3 << endl;
 }
 
 // Print the contents of RHD2000 registers from a selected USB data stream (0-7)
-- 
GitLab