History

fix conditional implementation of SerialInterface

Stephen Birarda committed 13 years ago

Commit 5b8541e1 parent 6a7b4062 files · +5 −4Browse files

Showing the changes to interface/src/SerialInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/SerialInterface.cpp+4−3
@@ -30,8 +30,6 @@ const int ZERO_OFFSET = 2048; · 29 unmodified lines
30const short NO_READ_MAXIMUM_MSECS = 3000;30const short NO_READ_MAXIMUM_MSECS = 3000;
31const short SAMPLES_TO_DISCARD = 100;31const short SAMPLES_TO_DISCARD = 100;
32 32
33#ifdef UNIX
34
35void SerialInterface::pair() {33void SerialInterface::pair() {
36 34
37#ifdef __APPLE__35#ifdef __APPLE__
@@ -65,6 +63,7 @@ void SerialInterface::pair() { · 27 unmodified lines
65// Init the serial port to the specified values63// Init the serial port to the specified values
66int SerialInterface::init(char* portname, int baud)64int SerialInterface::init(char* portname, int baud)
67{65{
66#ifdef __APPLE__
68 serial_fd = open(portname, O_RDWR | O_NOCTTY | O_NDELAY);67 serial_fd = open(portname, O_RDWR | O_NOCTTY | O_NDELAY);
69 68
70 printf("Attemping to open serial interface: %s\n", portname);69 printf("Attemping to open serial interface: %s\n", portname);
@@ -104,6 +103,7 @@ int SerialInterface::init(char* portname, int baud) · 33 unmodified lines
104 active = true;103 active = true;
105 104
106 return 0;105 return 0;
106#endif
107}107}
108 108
109// Reset Trailing averages to the current measurement109// Reset Trailing averages to the current measurement
@@ -161,6 +161,7 @@ void SerialInterface::renderLevels(int width, int height) { · 51 unmodified lines
161 161
162}162}
163void SerialInterface::readData() {163void SerialInterface::readData() {
164#ifdef __APPLE__
164 // This array sets the rate of trailing averaging for each channel.165 // This array sets the rate of trailing averaging for each channel.
165 // If the sensor rate is 100Hz, 0.001 will make the long term average a 10-second average166 // If the sensor rate is 100Hz, 0.001 will make the long term average a 10-second average
166 const float AVG_RATE[] = {0.01, 0.01, 0.01, 0.01, 0.01, 0.01};167 const float AVG_RATE[] = {0.01, 0.01, 0.01, 0.01, 0.01, 0.01};
@@ -215,6 +216,7 @@ void SerialInterface::readData() { · 48 unmodified lines
215 } else {216 } else {
216 gettimeofday(&lastGoodRead, NULL);217 gettimeofday(&lastGoodRead, NULL);
217 }218 }
219#endif
218}220}
219 221
220void SerialInterface::resetSerial() {222void SerialInterface::resetSerial() {
@@ -234,7 +236,6 @@ void SerialInterface::resetSerial() { · 13 unmodified lines
234 }236 }
235}237}
236 238
237#endif
238 239
239 240
240 241