summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-03-23 11:54:50 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-03-23 12:35:24 +0100
commit6dcf0f0ff85e4b41a22416dfbe9b88fb57921ec5 (patch)
tree6a31b8378f1ea76c60f12b313669db1fc1059a07
parentcc26a1f3ea084e6567d0505b6379e7fb1240cc5e (diff)
filter/accela: add old staircase behavior
-rw-r--r--filter-accela/ftnoir_filter_accela.cpp16
-rw-r--r--opentrack/defs.hpp1
2 files changed, 17 insertions, 0 deletions
diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp
index 0f31f6a6..d3464f7b 100644
--- a/filter-accela/ftnoir_filter_accela.cpp
+++ b/filter-accela/ftnoir_filter_accela.cpp
@@ -7,6 +7,7 @@
#include "ftnoir_filter_accela.h"
#include "compat/math.hpp"
#include "api/plugin-api.hpp"
+#include "opentrack/defs.hpp"
#include <algorithm>
#include <QDebug>
@@ -62,6 +63,14 @@ static void do_deltas(const double* deltas, double* output, F&& fun)
}
}
+template<typename F>
+[[maybe_unused]]
+never_inline
+static void do_delta(double delta, double* output, F&& fun)
+{
+ *output = fun(fabs(delta)) * signum(delta);
+}
+
void accela::filter(const double* input, double *output)
{
static constexpr double full_turn = 360.0;
@@ -111,9 +120,16 @@ void accela::filter(const double* input, double *output)
deltas[i] = d / rot_thres;
}
+#ifdef UI_ACCELA_OLD_STAIRCASE
+ for (int i = Yaw; i <= Roll; i++)
+ do_delta(deltas[i], &output[i], [this](double x) {
+ return spline_rot.get_value_no_save(x);
+ });
+#else
do_deltas(&deltas[Yaw], &output[Yaw], [this](double x) {
return spline_rot.get_value_no_save(x);
});
+#endif
// pos
diff --git a/opentrack/defs.hpp b/opentrack/defs.hpp
index 01b6557f..e3826474 100644
--- a/opentrack/defs.hpp
+++ b/opentrack/defs.hpp
@@ -11,3 +11,4 @@
//#define UI_NO_RAW_DATA
//#define UI_NO_GAME_DATA
+//define UI_ACCELA_OLD_STAIRCASE