From 882202c2bcd1e286cf83874e2623c5dc5d002f82 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 12 Aug 2016 13:48:30 +0200 Subject: [PATCH] fixed bug show nth frame as in 2nd, 4th etc. --- .../include/UDPStandardImplementation.h | 4 ++++ slsReceiverSoftware/src/UDPStandardImplementation.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/slsReceiverSoftware/include/UDPStandardImplementation.h b/slsReceiverSoftware/include/UDPStandardImplementation.h index 26f63ddc0..a3af9ab03 100644 --- a/slsReceiverSoftware/include/UDPStandardImplementation.h +++ b/slsReceiverSoftware/include/UDPStandardImplementation.h @@ -601,6 +601,8 @@ private: /** Dummy Packet identifier value */ const static uint32_t dummyPacketValue = 0xFFFFFFFF; + + //***receiver to GUI parameters*** /** Current Frame copied for GUI */ char* latestData; @@ -617,6 +619,8 @@ private: /** Semaphore to synchronize Writer and GuiReader threads*/ sem_t writerGuiSemaphore; + /** counter for nth frame to gui */ + int frametoGuiCounter; diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 6ab655ac0..d64692b65 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -176,6 +176,7 @@ void UDPStandardImplementation::initializeMembers(){ guiDataReady = false; guiData = NULL; strcpy(guiFileName,""); + frametoGuiCounter = 0; //***general and listening thread parameters*** threadStarted = false; @@ -804,6 +805,7 @@ int UDPStandardImplementation::startReceiver(char *c){ //RESET //reset measurement variables + frametoGuiCounter = 0; measurementStarted = false; startFrameIndex = 0; frameIndex = 0; @@ -2897,6 +2899,9 @@ void UDPStandardImplementation::copyFrameToGui(char* buffer[]){ pthread_mutex_unlock(&dataReadyMutex); } + //if nthe frame, wait for your turn (1st frame always shown as its zero) + else if(FrameToGuiFrequency && ((frametoGuiCounter)%FrameToGuiFrequency)); + //random read (gui ready) or nth frame read: gui needs data now or it is the first frame else{ #ifdef DEBUG4 @@ -2936,6 +2941,12 @@ void UDPStandardImplementation::copyFrameToGui(char* buffer[]){ } } + + //update the counter for nth frame + if(FrameToGuiFrequency) + frametoGuiCounter++; + + }