-
Notifications
You must be signed in to change notification settings - Fork 25
Instantation error if display is disabled via displayio.release_displays() #35
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
Comments
Looks like this may be similar to #33 and this lib has an outstanding type annotations issue (#30) so I'll cook up a quick PR incorporating fixes for those as well as this one. In the interest of keeping things as simple as possible I'll implement option "2" - just using null checks to allow edit: Type annotations took a bit more time than I thought they would and were complicated enough that I don't think I'll be tackling additonal fixes until that PR is done |
just to check, are you using Adafruit MacroPad hardware or is this a DIY thing? |
@ladyada Using a standard issue Adafruit MacroPad RP2040. The only difference is that I had done a |
oh i see you want to practice not having the display exist...i guess for each time we access the display you can verify its |
I was going to do a quick Here are some permutations I tried:
I also considered using a Here's a quick example of in-situ REPL testing results. Adafruit CircuitPython 7.1.1 on 2022-01-14; Adafruit Macropad RP2040 with rp2040
>>> import board
>>> if not isinstance(board.DISPLAY, type(None)):
... print("board.DISPLAY is ready to go")
...
...
...
board.DISPLAY is ready to go
>>> import displayio
>>> displayio.release_displays()
>>> if not isinstance(board.DISPLAY, type(None)):
... print("board.DISPLAY is ready to go")
...
...
...
>>> Since its a tiny change (famous last words, I know) I just stacked it on to my type annotation changes in #36 (in a76f87e) since that PR is still open. If having two unrelated fixes in a single PR is an issue I can pull the commit back out and submit a separate PR though. |
PR #36 is merged so this is all wrapped up. With this fix applied, instantiating a |
In the early stages of a keeb type project I try to start simple by disabling displays/NeoPixels for the first prototype builds.
This causes an error when instantiating a
MacroPad
.Here's where its coming from in the current lib version:
Adafruit_CircuitPython_MacroPad/adafruit_macropad.py
Lines 153 to 155 in 89b5cc7
Off the top of my head I can think of a few possible ways to address this, if addressing it with a code change is actually warranted.
kwarg
allowing the user to disable display init.board.DISPLAY
before doing a display initThis could be considered "not a bug, but a feature" if my more adavanced use case for the library doesn't line up with the lib's intent. It does make sense to keep these 'all in one' libs as simple as possible. So if that's the case, closing this issue with a "won't fix" is totally fine. 😄
For now I've been working around it easily by just making my own slimmed-down
MacroPad
class using this lib as an example. But its just so convenient to use the 'all-in-one' lib for quick-start prototyping that I find myself wishing for a bit more granular control (or null safety) during instantiation to allow for more slimmed-down use cases.The text was updated successfully, but these errors were encountered: