Skip to content

fix error from board.DISPLAY not existing #12

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

Conversation

FoamyGuy
Copy link
Contributor

@FoamyGuy FoamyGuy commented Jul 3, 2020

This fix allows the library to be used with builds where there is no board.DISPLAY.

Tested on Raspberry Pi with Blinka_Displayio and PyPortal

@makermelissa
Copy link
Collaborator

Hi @FoamyGuy, I somehow missed this PR. I'm wondering if this change adds anything. Couldn't you just pass your display object as pixel_source or does it give you an error?

@FoamyGuy
Copy link
Contributor Author

FoamyGuy commented Aug 11, 2020

@makermelissa no worries. I'm not 100% certain that I recall exactly what happened. But I think it was throwing an error on Blinka (or any platform that did not have board.DISPLAY I assume) since the library is trying to use that as the default value for pixel_source.

If I recall correctly it did throw an error even when you try to pass in a pixel_source meaning the default should not have been in use. Which did seem odd to me since I was passing in a value any way.

This fix resolved it by never trying to access board.DISPLAY until after it's proven safe with if "DISPLAY" in dir(board):

I can try this out again tomorrow to refresh my memory on the specific behavior.

Copy link
Collaborator

@makermelissa makermelissa left a comment

Choose a reason for hiding this comment

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

Thanks @FoamyGuy. Code looks good. I just wanted to be sure.

@makermelissa makermelissa merged commit 043f614 into adafruit:master Aug 11, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 11, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver to 1.1.2 from 1.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BitmapSaver#12 from FoamyGuy/fix_for_board_without_display

Updating https://github.com/adafruit/Adafruit_CircuitPython_RSA to 1.2.0 from 1.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#14 from adafruit/sha_fix
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#12 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_MatrixPortal
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