mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01: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 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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue