summaryrefslogtreecommitdiffhomepage
path: root/filter-accela
diff options
context:
space:
mode:
authorGO63-samara <go1@list.ru>2020-04-28 22:13:55 +0400
committerGO63-samara <go1@list.ru>2020-04-28 22:13:55 +0400
commit48e1c8a5a41449e4b9291954964188fad9dfd248 (patch)
treed5b0e339cdc03fb6d6b28adce84ea3b37a34be0b /filter-accela
parent7252c00161959b3b7ce9d78506ec6cf026f24d5e (diff)
fix sintax
replacing define with static constexpr double and replacing a tab with a space
Diffstat (limited to 'filter-accela')
-rw-r--r--filter-accela/ftnoir_filter_accela.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp
index 2059d7f9..b70f08cf 100644
--- a/filter-accela/ftnoir_filter_accela.cpp
+++ b/filter-accela/ftnoir_filter_accela.cpp
@@ -64,8 +64,9 @@ static void do_deltas(const double* deltas, double* output, F&& fun)
void accela::filter(const double* input, double *output)
{
-#define FULL_TURN 360.0
-#define HALF_TURN 180.0
+ static constexpr double full_turn = 360.0;
+ static constexpr double half_turn = 180.0;
+
if (unlikely(first_run))
{
first_run = false;
@@ -100,7 +101,7 @@ void accela::filter(const double* input, double *output)
for (unsigned i = 3; i < 6; i++)
{
double d = input[i] - last_output[i];
- if (fabs(d) > HALF_TURN) d -= copysign(FULL_TURN, d);
+ if (fabs(d) > half_turn) d -= copysign(full_turn, d);
if (fabs(d) > rot_dz)
d -= copysign(rot_dz, d);
@@ -137,7 +138,7 @@ void accela::filter(const double* input, double *output)
{
output[k] *= dt;
output[k] += last_output[k];
- if (fabs(output[k]) > HALF_TURN) output[k] -= copysign(FULL_TURN, output[k]);
+ if (fabs(output[k]) > half_turn) output[k] -= copysign(full_turn, output[k]);
last_output[k] = output[k];
}