Showing the changes to interface/src/SerialInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -30,8 +30,6 @@ const int ZERO_OFFSET = 2048; · 29 unmodified lines | ||
| 30 | 30 | const short NO_READ_MAXIMUM_MSECS = 3000; |
| 31 | 31 | const short SAMPLES_TO_DISCARD = 100; |
| 32 | 32 | |
| 33 | −#ifdef UNIX | |
| 34 | − | |
| 35 | 33 | void SerialInterface::pair() { |
| 36 | 34 | |
| 37 | 35 | #ifdef __APPLE__ |
| @@ -65,6 +63,7 @@ void SerialInterface::pair() { · 27 unmodified lines | ||
| 65 | 63 | // Init the serial port to the specified values |
| 66 | 64 | int SerialInterface::init(char* portname, int baud) |
| 67 | 65 | { |
| 66 | +#ifdef __APPLE__ | |
| 68 | 67 | serial_fd = open(portname, O_RDWR | O_NOCTTY | O_NDELAY); |
| 69 | 68 | |
| 70 | 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 | 103 | active = true; |
| 105 | 104 | |
| 106 | 105 | return 0; |
| 106 | +#endif | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // 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 | } |
| 163 | 163 | void SerialInterface::readData() { |
| 164 | +#ifdef __APPLE__ | |
| 164 | 165 | // This array sets the rate of trailing averaging for each channel. |
| 165 | 166 | // If the sensor rate is 100Hz, 0.001 will make the long term average a 10-second average |
| 166 | 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 | 216 | } else { |
| 216 | 217 | gettimeofday(&lastGoodRead, NULL); |
| 217 | 218 | } |
| 219 | +#endif | |
| 218 | 220 | } |
| 219 | 221 | |
| 220 | 222 | void 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 | |