summaryrefslogtreecommitdiffhomepage
path: root/tracker-freepie-udp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-09 10:52:12 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-09 11:08:40 +0200
commit674f441f58d3c9321dddce88a55857c125551c62 (patch)
treed7c29527d442e3ccffed15deda690fcae0e4aca3 /tracker-freepie-udp
parent091c5bf5ae019e9667ccc5ff0cb74531c740550b (diff)
tracker/freepie: fix float/double promotions
Diffstat (limited to 'tracker-freepie-udp')
-rw-r--r--tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
index 12cf9bca..621e601a 100644
--- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
+++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp
@@ -3,6 +3,11 @@
#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)
{
@@ -37,7 +42,7 @@ void TrackerImpl::run() {
flag_Orient = 1 << 1,
Mask = flag_Raw | flag_Orient
};
-
+
(void) sock.bind(QHostAddress::Any, (int) s.port, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
while (!should_quit) {
@@ -46,7 +51,7 @@ void TrackerImpl::run() {
bound<int>(s.idx_y, 0, 2),
bound<int>(s.idx_z, 0, 2)
};
- float orient[3];
+ double orient[3] = {0, 0, 0};
bool filled = false;
while (sock.hasPendingDatagrams())
@@ -87,7 +92,7 @@ void TrackerImpl::run() {
};
int indices[] = { s.add_yaw, s.add_pitch, s.add_roll };
QMutexLocker foo(&mtx);
- static constexpr double r2d = 57.295781;
+ static constexpr double r2d = 180 / M_PI;
for (int i = 0; i < 3; i++)
{
int val = 0;