fixed bug show nth frame as in 2nd, 4th etc.

This commit is contained in:
Dhanya Maliakal 2016-08-12 13:48:30 +02:00
parent e452bccea2
commit 882202c2bc
2 changed files with 15 additions and 0 deletions

View File

@ -601,6 +601,8 @@ private:
/** Dummy Packet identifier value */ /** Dummy Packet identifier value */
const static uint32_t dummyPacketValue = 0xFFFFFFFF; const static uint32_t dummyPacketValue = 0xFFFFFFFF;
//***receiver to GUI parameters*** //***receiver to GUI parameters***
/** Current Frame copied for GUI */ /** Current Frame copied for GUI */
char* latestData; char* latestData;
@ -617,6 +619,8 @@ private:
/** Semaphore to synchronize Writer and GuiReader threads*/ /** Semaphore to synchronize Writer and GuiReader threads*/
sem_t writerGuiSemaphore; sem_t writerGuiSemaphore;
/** counter for nth frame to gui */
int frametoGuiCounter;

View File

@ -176,6 +176,7 @@ void UDPStandardImplementation::initializeMembers(){
guiDataReady = false; guiDataReady = false;
guiData = NULL; guiData = NULL;
strcpy(guiFileName,""); strcpy(guiFileName,"");
frametoGuiCounter = 0;
//***general and listening thread parameters*** //***general and listening thread parameters***
threadStarted = false; threadStarted = false;
@ -804,6 +805,7 @@ int UDPStandardImplementation::startReceiver(char *c){
//RESET //RESET
//reset measurement variables //reset measurement variables
frametoGuiCounter = 0;
measurementStarted = false; measurementStarted = false;
startFrameIndex = 0; startFrameIndex = 0;
frameIndex = 0; frameIndex = 0;
@ -2897,6 +2899,9 @@ void UDPStandardImplementation::copyFrameToGui(char* buffer[]){
pthread_mutex_unlock(&dataReadyMutex); 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 //random read (gui ready) or nth frame read: gui needs data now or it is the first frame
else{ else{
#ifdef DEBUG4 #ifdef DEBUG4
@ -2936,6 +2941,12 @@ void UDPStandardImplementation::copyFrameToGui(char* buffer[]){
} }
} }
//update the counter for nth frame
if(FrameToGuiFrequency)
frametoGuiCounter++;
} }