From 023490db6ac86ee3f82b1b89e279d0b2ccae5fd3 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 1 Aug 2020 09:20:19 +0200 Subject: Adds invert option, updates usage. --- src/device/axis/axis_filter.c | 5 +++++ src/device/axis/axis_option.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/device') diff --git a/src/device/axis/axis_filter.c b/src/device/axis/axis_filter.c index 6258ad9..d7840ca 100644 --- a/src/device/axis/axis_filter.c +++ b/src/device/axis/axis_filter.c @@ -122,6 +122,11 @@ int relabsd_axis_filter_new_value return 0; } + if (axis->flags[RELABSD_INVERT]) + { + *value = -(*value); + } + if (axis->flags[RELABSD_NOT_ABS]) { return 1; diff --git a/src/device/axis/axis_option.c b/src/device/axis/axis_option.c index 7796eb7..e8d06f5 100644 --- a/src/device/axis/axis_option.c +++ b/src/device/axis/axis_option.c @@ -57,10 +57,14 @@ int relabsd_axis_enable_option_from_name ); } } - else if (RELABSD_IS_PREFIX("notabs", option_name)) + else if (RELABSD_IS_PREFIX("not_abs", option_name)) { axis->flags[RELABSD_NOT_ABS] = 1; } + else if (RELABSD_IS_PREFIX("invert", option_name)) + { + axis->flags[RELABSD_INVERT] = 1; + } else if (RELABSD_IS_PREFIX("convert_to=", option_name)) { axis->convert_to = -- cgit v1.2.3-70-g09d2