Skip to content

Commit fc5ffcc

Browse files
brentrubrentru
authored andcommitted
fix pybadge init
1 parent 2a97532 commit fc5ffcc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_cursorcontrol/cursorcontrol_cursormanager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ def __init__(self, cursor):
5151
self._cursor = cursor
5252
self._is_clicked = False
5353
self._init_hardware()
54-
self._center_x = self._joystick_x.value
55-
self._center_y = self._joystick_y.value
5654

5755
def __enter__(self):
5856
return self
@@ -89,6 +87,9 @@ def _init_hardware(self):
8987
self._joystick_x = analogio.AnalogIn(board.JOYSTICK_X)
9088
self._joystick_y = analogio.AnalogIn(board.JOYSTICK_Y)
9189
self._pad_btns = {"btn_a": PYBADGE_BUTTON_A}
90+
# Sample the center points of the joystick
91+
self._center_x = self._joystick_x.value
92+
self._center_y = self._joystick_y.value
9293
else:
9394
raise AttributeError(
9495
"Board must have a D-Pad or Joystick for use with CursorManager!"

0 commit comments

Comments
 (0)