Skip to content

removing use of gamepad #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2021
Merged

removing use of gamepad #48

merged 1 commit into from
Jul 26, 2021

Conversation

FoamyGuy
Copy link
Contributor

This is a breaking change! We will need to bump the major version if/when it's merged and released.

This removes the use of gamepad from the library which has been removed from the CircuitPython core (ref #4940). The only thing that this library used it for was the were_pressed API. This PR removes the were_pressed property and updates the relevant examples to use clue.button_a and clue.button_b instead of were_pressed

While working on this I also removed the lines in the advanced ams example like this one:

a = clue.were_pressed

It seems to me these were accidental / unnecessary. The only other use of the a variable is before the main loop starts and was for the BLE advertisement rather than anything related to buttons. Nothing else in the main loop seemed to be accessing this value after it was being set based on the button value.

I do not have an Apple media device to test the updated examples with, but I did test out that section of the code on a CLUE with CircuitPython 7.0.0-alpha.5 by running this minimal example that uses the same logic. Everything appears to be working as intended.

from adafruit_clue import clue
import time

while True:
    # If button B (on the right) is pressed, it increases the volume
    if clue.button_b:
        print("inital vol up")
        time.sleep(0.30)
        while clue.button_b:
            time.sleep(0.07)

    # If button A (on the left) is pressed, the volume decreases
    if clue.button_a:
        print("inital vol down")
        time.sleep(0.30)
        while clue.button_a:
            print("vol down")
            time.sleep(0.07)

@FoamyGuy FoamyGuy requested a review from a team July 23, 2021 21:27
Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@dhalbert dhalbert merged commit 0df62eb into adafruit:main Jul 26, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 27, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_CLUE to 3.0.0 from 2.3.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#48 from FoamyGuy/remove_gamepad
  > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#47 from lesamouraipourpre/remove-max-glyphs

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_SCD4X, Adafruit_CircuitPython_Ticks
@tekktrik tekktrik mentioned this pull request Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants