Skip to content

Commit 6933ad0

Browse files
committed
Implement invert and centered properly
1 parent 0b22c7f commit 6933ad0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

MAVProxy/modules/mavproxy_joystick/controls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ def value(self):
136136
if value != self._last_value:
137137
self._last_value = value
138138
if value != 0:
139+
if self.invert:
140+
value *= -1
139141
# In my testing the hat is clamped to -1, 0, 1 values only
140142
# NOTE: check if this universal
141143
self._value += value * self.step
@@ -186,7 +188,7 @@ def __init__(self, joystick, controls):
186188
elif control['type'] == 'dial':
187189
kwargs = {k: control[k]
188190
for k in control.keys()
189-
if k in ['outlow', 'outhigh', 'invert', 'step']}
191+
if k in ['outlow', 'outhigh', 'invert', 'step', 'centered']}
190192

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

0 commit comments

Comments
 (0)