File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 41
41
# PyBadge & PyGamer
42
42
PYBADGE_BUTTON_A = const (2 )
43
43
44
- class CursorManager (object ):
44
+ class CursorManager ():
45
45
"""Simple interaction user interface interaction for Adafruit_CursorControl.
46
46
47
47
:param adafruit_cursorcontrol cursor: The cursor object we are using.
@@ -51,8 +51,6 @@ def __init__(self, cursor):
51
51
self ._cursor = cursor
52
52
self ._is_clicked = False
53
53
self ._init_hardware ()
54
- self ._center_x = self ._joystick_x .value
55
- self ._center_y = self ._joystick_y .value
56
54
57
55
def __enter__ (self ):
58
56
return self
@@ -89,6 +87,9 @@ def _init_hardware(self):
89
87
self ._joystick_x = analogio .AnalogIn (board .JOYSTICK_X )
90
88
self ._joystick_y = analogio .AnalogIn (board .JOYSTICK_Y )
91
89
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
92
93
else :
93
94
raise AttributeError (
94
95
"Board must have a D-Pad or Joystick for use with CursorManager!"
You can’t perform that action at this time.
0 commit comments