Skip to content

Commit 31d921a

Browse files
authored
Merge pull request #1642 from dhalbert/pyloton-no-gamepad
Remove gamepad use from Pyloton
2 parents be5c21f + 2c7b156 commit 31d921a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

CircuitPython_Pyloton/pyloton.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ def were_pressed(self):
4949
ret.add(button)
5050
return ret
5151

52+
@property
53+
def button_a(self):
54+
"""``True`` when Button A is pressed. ``False`` if not."""
55+
return not self._a.value
56+
57+
@property
58+
def button_b(self):
59+
"""``True`` when Button B is pressed. ``False`` if not."""
60+
return not self._b.value
61+
5262
def _touch(self, i):
5363
if not isinstance(self._touches[i], touchio.TouchIn):
5464
self._touches[i] = touchio.TouchIn(self._touches[i])
@@ -549,12 +559,12 @@ def ams_remote(self):
549559
time.sleep(0.25)
550560

551561
# If button B (on the right) is pressed, it increases the volume
552-
if 'B' in self.clue.were_pressed:
562+
if self.clue.button_b:
553563
self.ams.volume_up()
554564
time.sleep(0.1)
555565

556566
# If button A (on the left) is pressed, the volume decreases
557-
if 'A' in self.clue.were_pressed:
567+
if self.clue.button_a:
558568
self.ams.volume_down()
559569
time.sleep(0.1)
560570
except (RuntimeError, UnsupportedCommand, AttributeError):

0 commit comments

Comments
 (0)