Skip to content

Commit

Permalink
Implement invert and centered properly
Browse files Browse the repository at this point in the history
  • Loading branch information
landswellsong committed Oct 29, 2024
1 parent 61eb3a9 commit 0e29f86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MAVProxy/modules/mavproxy_joystick/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def value(self):
if value != self._last_value:
self._last_value = value
if value != 0:
if self.invert:
value *= -1
# In my testing the hat is clamped to -1, 0, 1 values only
# NOTE: check if this universal
self._value += value * self.step
Expand Down Expand Up @@ -186,7 +188,7 @@ def __init__(self, joystick, controls):
elif control['type'] == 'dial':
kwargs = {k: control[k]
for k in control.keys()
if k in ['outlow', 'outhigh', 'invert', 'step']}
if k in ['outlow', 'outhigh', 'invert', 'step', 'centered']}

handler = Dial(self.joystick, control['id'], control['axis'], **kwargs)

Expand Down

0 comments on commit 0e29f86

Please sign in to comment.