fix conditional implementation of SerialInterface

This commit is contained in:
Stephen Birarda 2013-03-18 16:29:06 -07:00
parent 6a7b40629c
commit 5b8541eaa4
2 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -13,7 +13,7 @@
#include <iostream>
// These includes are for serial port reading/writing
#ifdef UNIX
#ifdef __APPLE__
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>