summaryrefslogtreecommitdiffhomepage
path: root/tracker-freepie-udp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-18 12:14:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-19 07:17:22 +0200
commita9b804e18c811c781a099a70b960f5bbde61257d (patch)
tree069a7de35557f4d9ff141d795d287e4ac128f625 /tracker-freepie-udp
parent9fc8ebfd8ab54b9fe1caaf60147dd43a573d67ef (diff)
some: replace hardcoded pi values with the same pi constant
We can't depend on M_PI existing after including cmath.
Diffstat (limited to 'tracker-freepie-udp')
-rw-r--r--tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
index 621e601a..9a5697dd 100644
--- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
+++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
@@ -1,13 +1,11 @@
#include "ftnoir_tracker_freepie-udp.h"
#include "opentrack/plugin-api.hpp"
+#include "opentrack-compat/pi-constant.hpp"
#include <cinttypes>
#include <algorithm>
#include <cmath>
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
TrackerImpl::TrackerImpl() : pose { 0,0,0, 0,0,0 }, should_quit(false)
{
@@ -43,7 +41,7 @@ void TrackerImpl::run() {
Mask = flag_Raw | flag_Orient
};
- (void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
+ sock.bind(QHostAddress::Any, (unsigned short) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
while (!should_quit) {
int order[] = {
@@ -92,7 +90,7 @@ void TrackerImpl::run() {
};
int indices[] = { s.add_yaw, s.add_pitch, s.add_roll };
QMutexLocker foo(&mtx);
- static constexpr double r2d = 180 / M_PI;
+ static constexpr double r2d = 180 / OPENTRACK_PI;
for (int i = 0; i < 3; i++)
{
int val = 0;