From e01d9b94cb9b19d65d8e841bea63159f38e05322 Mon Sep 17 00:00:00 2001
From: GroundStation <foo@bar>
Date: Mon, 28 Nov 2016 14:27:16 -0600
Subject: [PATCH] Fixed things to work with the groundstation computer

- Changed C standard
- Changed wpedantic to pedantic
- Deleted some unused code that used nonexistent time functions
- Fixed a bug with VRPN
---
 groundStation/Makefile              |  4 ++--
 groundStation/src/backend/backend.c |  2 +-
 groundStation/src/cli/cli_monitor.c | 17 -----------------
 3 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/groundStation/Makefile b/groundStation/Makefile
index 4830eee98..50c78782e 100644
--- a/groundStation/Makefile
+++ b/groundStation/Makefile
@@ -3,8 +3,8 @@
 # Generic Variables
 GCC=gcc
 GXX=g++
-CFLAGS= -Wall -Wpedantic -Wextra -Werror -std=gnu11 -g -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable
-CXXFLAGS= -Wall -Wpedantic -Wextra -Werror -Wno-reorder -Wno-unused-variable -std=c++0x -g
+CFLAGS= -Wall -pedantic -Wextra -Werror -std=gnu99 -g -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable
+CXXFLAGS= -Wall -pedantic -Wextra -Werror -Wno-reorder -Wno-unused-variable -std=c++0x -g
 INCLUDES = $(foreach dir, $(INCDIR), -I$(dir))
 INCDIR=inc src/vrpn src/vrpn/quat src/vrpn/build $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR)
 LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat 
diff --git a/groundStation/src/backend/backend.c b/groundStation/src/backend/backend.c
index 7bc7969ab..9bcaa7a19 100644
--- a/groundStation/src/backend/backend.c
+++ b/groundStation/src/backend/backend.c
@@ -638,7 +638,7 @@ static void client_recv(int fd) {
 				if (tracker == NULL) {
 					char * dummy = TD_MAGIC " 1.0 2.0 3.0 4.0 5.0 6.0\n";
 					write(fd, dummy, strlen(dummy));
-				}else if (ucart_vrpn_tracker_getData(tracker, &td)) {
+				}else if (!ucart_vrpn_tracker_getData(tracker, &td)) {
 					write(fd, TD_MAGIC " ERROR\n", strlen(TD_MAGIC " ERROR\n"));
 				} else { 
 					/* more than sufficient buffer */
diff --git a/groundStation/src/cli/cli_monitor.c b/groundStation/src/cli/cli_monitor.c
index ea5a7b8c7..23ca913dc 100644
--- a/groundStation/src/cli/cli_monitor.c
+++ b/groundStation/src/cli/cli_monitor.c
@@ -10,8 +10,6 @@
 #include "cli_monitor.h"
 #include "frontend_tracker.h"
 
-static void timespec_diff(struct timespec *start,  struct timespec *result);
-
 int cli_monitor(struct backend_conn * conn,	int argc, char **argv) {
 	int c, result;
 	int countFlag = 0;
@@ -98,18 +96,3 @@ int monitor(struct backend_conn * conn) {
 
 	return 0;
 }
-
-static void timespec_diff(struct timespec *start, struct timespec *result)
-{
-	struct timespec stop;
-	clock_gettime(CLOCK_REALTIME, &stop);
-    if ((stop.tv_nsec - start->tv_nsec) < 0) {
-        result->tv_sec = stop.tv_sec - start->tv_sec - 1;
-        result->tv_nsec = stop.tv_nsec - start->tv_nsec + 1000000000;
-    } else {
-        result->tv_sec = stop.tv_sec - start->tv_sec;
-        result->tv_nsec = stop.tv_nsec - start->tv_nsec;
-    }
-
-    return;
-}
-- 
GitLab