From 5b8541eaa4addfa21769e3936cbe0790cc7ec20b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 18 Mar 2013 16:29:06 -0700 Subject: [PATCH] fix conditional implementation of SerialInterface --- interface/src/SerialInterface.cpp | 7 ++++--- interface/src/SerialInterface.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/src/SerialInterface.cpp b/interface/src/SerialInterface.cpp index 73e0d6044d..ca2609eaef 100644 --- a/interface/src/SerialInterface.cpp +++ b/interface/src/SerialInterface.cpp @@ -30,8 +30,6 @@ const int ZERO_OFFSET = 2048; const short NO_READ_MAXIMUM_MSECS = 3000; const short SAMPLES_TO_DISCARD = 100; -#ifdef UNIX - void SerialInterface::pair() { #ifdef __APPLE__ @@ -65,6 +63,7 @@ void SerialInterface::pair() { // Init the serial port to the specified values int SerialInterface::init(char* portname, int baud) { +#ifdef __APPLE__ serial_fd = open(portname, O_RDWR | O_NOCTTY | O_NDELAY); printf("Attemping to open serial interface: %s\n", portname); @@ -104,6 +103,7 @@ int SerialInterface::init(char* portname, int baud) active = true; return 0; +#endif } // Reset Trailing averages to the current measurement @@ -161,6 +161,7 @@ void SerialInterface::renderLevels(int width, int height) { } void SerialInterface::readData() { +#ifdef __APPLE__ // This array sets the rate of trailing averaging for each channel. // If the sensor rate is 100Hz, 0.001 will make the long term average a 10-second average const float AVG_RATE[] = {0.01, 0.01, 0.01, 0.01, 0.01, 0.01}; @@ -215,6 +216,7 @@ void SerialInterface::readData() { } else { gettimeofday(&lastGoodRead, NULL); } +#endif } void SerialInterface::resetSerial() { @@ -234,7 +236,6 @@ void SerialInterface::resetSerial() { } } -#endif diff --git a/interface/src/SerialInterface.h b/interface/src/SerialInterface.h index f8a2952bb4..c943ef60a7 100644 --- a/interface/src/SerialInterface.h +++ b/interface/src/SerialInterface.h @@ -13,7 +13,7 @@ #include // These includes are for serial port reading/writing -#ifdef UNIX +#ifdef __APPLE__ #include #include #include