summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-02-05 19:37:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-02-09 17:04:28 +0100
commit128cb6525535acbddd324861c8d124e7f1729e18 (patch)
tree1ce95985245e37bb1095525ee37663dec224771c /tracker-hatire
parent6c2f3452553d68c46c9e38e71b7cc3208acc1c53 (diff)
tracker/hatire: clamp rotation to (-180)->180
Some devices have numeric stability problems.
Diffstat (limited to 'tracker-hatire')
-rw-r--r--tracker-hatire/ftnoir_tracker_hat.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tracker-hatire/ftnoir_tracker_hat.cpp b/tracker-hatire/ftnoir_tracker_hat.cpp
index a3f10d35..9ac44cf2 100644
--- a/tracker-hatire/ftnoir_tracker_hat.cpp
+++ b/tracker-hatire/ftnoir_tracker_hat.cpp
@@ -10,6 +10,7 @@
*/
#include <QDebug>
#include "ftnoir_tracker_hat.h"
+#include "compat/math.hpp"
#include <algorithm>
hatire::hatire()
@@ -128,6 +129,9 @@ void hatire::data(double *data)
CptError=0;
}
+ for (unsigned k = 0; k < 3; k++)
+ HAT.Rot[k] = clamp(HAT.Rot[k], -180, 180);
+
const struct
{
bool enable;
@@ -147,7 +151,7 @@ void hatire::data(double *data)
for (unsigned i = 0; i < std::size(spec); i++)
{
auto& k = spec[i];
- k.place = (k.sign ? -1.f : 1.f) * (k.enable ? k.input : 0.f);
+ k.place = (k.sign ? -1 : 1) * (k.enable ? k.input : 0);
}
}