| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-07-23 20:33:40 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-07-23 20:33:40 +0200 |
| commit | 6ca39654bfc65eee45cb38cbc53ce838d1f656a0 (patch) | |
| tree | 2d926ef997411c099a0b0897dceb1dfd13ab1c0d /src/device/axis | |
| parent | 87a86b9a599de35d09da7d954ba662091accc90b (diff) | |
Trying out axis renaming...
Diffstat (limited to 'src/device/axis')
| -rw-r--r-- | src/device/axis/axis.c | 10 | ||||
| -rw-r--r-- | src/device/axis/axis_name.c | 41 | ||||
| -rw-r--r-- | src/device/axis/axis_option.c | 19 |
3 files changed, 70 insertions, 0 deletions
diff --git a/src/device/axis/axis.c b/src/device/axis/axis.c index e854e37..1cdb856 100644 --- a/src/device/axis/axis.c +++ b/src/device/axis/axis.c @@ -20,6 +20,8 @@ void relabsd_axis_initialize ) { (void) memset(axis, 0, sizeof(struct relabsd_axis)); + + axis->convert_to = RELABSD_UNKNOWN; } void relabsd_axis_to_absinfo @@ -68,3 +70,11 @@ void relabsd_axis_set_attributes_are_dirty { axis->attributes_were_modified = val; } + +enum relabsd_axis_name relabsd_axis_get_convert_to +( + const struct relabsd_axis axis [const restrict static 1] +) +{ + return axis->convert_to; +} diff --git a/src/device/axis/axis_name.c b/src/device/axis/axis_name.c index c18a28f..1ac0715 100644 --- a/src/device/axis/axis_name.c +++ b/src/device/axis/axis_name.c @@ -56,6 +56,47 @@ enum relabsd_axis_name relabsd_axis_parse_name return RELABSD_UNKNOWN; } +enum relabsd_axis_name relabsd_axis_parse_name_from_prefix +( + const char name [const restrict static 1] +) +{ + if (RELABSD_IS_PREFIX("X", name)) + { + return RELABSD_X; + } + else if (RELABSD_IS_PREFIX("Y", name)) + { + return RELABSD_Y; + } + else if (RELABSD_IS_PREFIX("Z", name)) + { + return RELABSD_Z; + } + else if (RELABSD_IS_PREFIX("RX", name)) + { + return RELABSD_RX; + } + else if (RELABSD_IS_PREFIX("RY", name)) + { + return RELABSD_RY; + } + else if (RELABSD_IS_PREFIX("RZ", name)) + { + return RELABSD_RZ; + } + else if (RELABSD_IS_PREFIX("WL", name)) + { + return RELABSD_WHEEL; + } + else if (RELABSD_IS_PREFIX("MC", name)) + { + return RELABSD_MISC; + } + + return RELABSD_UNKNOWN; +} + const char * relabsd_axis_name_to_string (const enum relabsd_axis_name e) { switch (e) diff --git a/src/device/axis/axis_option.c b/src/device/axis/axis_option.c index 1d68b78..8e52fe1 100644 --- a/src/device/axis/axis_option.c +++ b/src/device/axis/axis_option.c @@ -57,6 +57,25 @@ int relabsd_axis_enable_option_from_name ); } } + else if (RELABSD_IS_PREFIX("convert_to=", option_name)) + { + axis->convert_to = + relabsd_axis_parse_name_from_prefix + ( + option_name + strlen("convert_to=") + ); + + if (axis->convert_to == RELABSD_UNKNOWN) + { + RELABSD_ERROR + ( + "Unknown target axis to convert to in config for axis '%s'.", + axis_name + ); + + return -1; + } + } else { RELABSD_ERROR |


