mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:17:25 +02:00
fix conditional implementation of SerialInterface
This commit is contained in:
parent
6a7b40629c
commit
5b8541eaa4
2 changed files with 5 additions and 4 deletions
|
@ -30,8 +30,6 @@ const int ZERO_OFFSET = 2048;
|
||||||
const short NO_READ_MAXIMUM_MSECS = 3000;
|
const short NO_READ_MAXIMUM_MSECS = 3000;
|
||||||
const short SAMPLES_TO_DISCARD = 100;
|
const short SAMPLES_TO_DISCARD = 100;
|
||||||
|
|
||||||
#ifdef UNIX
|
|
||||||
|
|
||||||
void SerialInterface::pair() {
|
void SerialInterface::pair() {
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -65,6 +63,7 @@ void SerialInterface::pair() {
|
||||||
// Init the serial port to the specified values
|
// Init the serial port to the specified values
|
||||||
int SerialInterface::init(char* portname, int baud)
|
int SerialInterface::init(char* portname, int baud)
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
serial_fd = open(portname, O_RDWR | O_NOCTTY | O_NDELAY);
|
serial_fd = open(portname, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
|
|
||||||
printf("Attemping to open serial interface: %s\n", portname);
|
printf("Attemping to open serial interface: %s\n", portname);
|
||||||
|
@ -104,6 +103,7 @@ int SerialInterface::init(char* portname, int baud)
|
||||||
active = true;
|
active = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset Trailing averages to the current measurement
|
// Reset Trailing averages to the current measurement
|
||||||
|
@ -161,6 +161,7 @@ void SerialInterface::renderLevels(int width, int height) {
|
||||||
|
|
||||||
}
|
}
|
||||||
void SerialInterface::readData() {
|
void SerialInterface::readData() {
|
||||||
|
#ifdef __APPLE__
|
||||||
// This array sets the rate of trailing averaging for each channel.
|
// 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
|
// 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};
|
const float AVG_RATE[] = {0.01, 0.01, 0.01, 0.01, 0.01, 0.01};
|
||||||
|
@ -215,6 +216,7 @@ void SerialInterface::readData() {
|
||||||
} else {
|
} else {
|
||||||
gettimeofday(&lastGoodRead, NULL);
|
gettimeofday(&lastGoodRead, NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialInterface::resetSerial() {
|
void SerialInterface::resetSerial() {
|
||||||
|
@ -234,7 +236,6 @@ void SerialInterface::resetSerial() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// These includes are for serial port reading/writing
|
// These includes are for serial port reading/writing
|
||||||
#ifdef UNIX
|
#ifdef __APPLE__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
Loading…
Reference in a new issue