File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 4141# PyBadge & PyGamer
4242PYBADGE_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!"
You can’t perform that action at this time.
0 commit comments