Skip to content

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