Skip to content

Commit c2f9e3c

Browse files
authored
Merge pull request #12 from brentru/fix-pybadge
Fix Pybadge no attribute error
2 parents 2a97532 + ef3697a commit c2f9e3c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

adafruit_cursorcontrol/cursorcontrol_cursormanager.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# PyBadge & PyGamer
4242
PYBADGE_BUTTON_A = const(2)
4343

44-
class CursorManager(object):
44+
class CursorManager():
4545
"""Simple interaction user interface interaction for Adafruit_CursorControl.
4646
4747
:param adafruit_cursorcontrol cursor: The cursor object we are using.
@@ -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)