File tree 1 file changed +10
-11
lines changed
1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -72,22 +72,21 @@ def __init__(self):
72
72
digitalio .DigitalInOut (board .BUTTON_OUT ),
73
73
digitalio .DigitalInOut (board .BUTTON_LATCH ),
74
74
)
75
- self .joy_x = analogio .AnalogIn (board .JOYSTICK_X )
76
- self .joy_y = analogio .AnalogIn (board .JOYSTICK_Y )
75
+ self .joy_x = analogio .AnalogIn (board .JOYSTICK_Y )
76
+ self .joy_y = analogio .AnalogIn (board .JOYSTICK_X )
77
77
78
78
def get_pressed (self ):
79
79
pressed = self .buttons .get_pressed ()
80
- dead = 500
81
- center = 32767
82
- x = self .joy_x .value
83
- if x < center - dead :
84
- pressed |= K_RIGHT
85
- elif x > center + dead :
80
+ dead = 15000
81
+ x = self .joy_x .value - 32767
82
+ if x < - dead :
86
83
pressed |= K_LEFT
87
- y = self .joy_y .value
88
- if y < center - dead :
84
+ elif x > dead :
85
+ pressed |= K_RIGHT
86
+ y = self .joy_y .value - 32767
87
+ if y < - dead :
89
88
pressed |= K_UP
90
- elif y > center + dead :
89
+ elif y > dead :
91
90
pressed |= K_DOWN
92
91
return pressed
93
92
You can’t perform that action at this time.
0 commit comments