From fc5ffcc38c95fc86dd1814e4cfccdf4a5f310543 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2019 09:40:07 -0400 Subject: [PATCH 1/2] fix pybadge init --- adafruit_cursorcontrol/cursorcontrol_cursormanager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adafruit_cursorcontrol/cursorcontrol_cursormanager.py b/adafruit_cursorcontrol/cursorcontrol_cursormanager.py index 4038403..e92dfe1 100755 --- a/adafruit_cursorcontrol/cursorcontrol_cursormanager.py +++ b/adafruit_cursorcontrol/cursorcontrol_cursormanager.py @@ -51,8 +51,6 @@ def __init__(self, cursor): self._cursor = cursor self._is_clicked = False self._init_hardware() - self._center_x = self._joystick_x.value - self._center_y = self._joystick_y.value def __enter__(self): return self @@ -89,6 +87,9 @@ def _init_hardware(self): self._joystick_x = analogio.AnalogIn(board.JOYSTICK_X) self._joystick_y = analogio.AnalogIn(board.JOYSTICK_Y) self._pad_btns = {"btn_a": PYBADGE_BUTTON_A} + # Sample the center points of the joystick + self._center_x = self._joystick_x.value + self._center_y = self._joystick_y.value else: raise AttributeError( "Board must have a D-Pad or Joystick for use with CursorManager!" From ef3697ada33c9cd270712185030e963d37c7259f Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2019 09:43:36 -0400 Subject: [PATCH 2/2] remove useless object inherritance --- adafruit_cursorcontrol/cursorcontrol_cursormanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_cursorcontrol/cursorcontrol_cursormanager.py b/adafruit_cursorcontrol/cursorcontrol_cursormanager.py index e92dfe1..5510f77 100755 --- a/adafruit_cursorcontrol/cursorcontrol_cursormanager.py +++ b/adafruit_cursorcontrol/cursorcontrol_cursormanager.py @@ -41,7 +41,7 @@ # PyBadge & PyGamer PYBADGE_BUTTON_A = const(2) -class CursorManager(object): +class CursorManager(): """Simple interaction user interface interaction for Adafruit_CursorControl. :param adafruit_cursorcontrol cursor: The cursor object we are using.