Skip to content

Commit b4c5f77

Browse files
authored
Update how board.DISPLAY is checked
Historically, boards with no built-in display have not had a `board.DISPLAY` property. Soon, with adafruit/circuitpython#10028, any board with displayio will have a `board.DISPLAY` property. This property will be `None` if no display is configured, or a truthy non-`None` value if a display is configured (including dynamically at runtime). This revised check will work on both old and new circuitpython versions.
1 parent 1befbbb commit b4c5f77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_bitmapsaver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def save_pixels(
168168
:param palette: the Palette to use for looking up colors in the bitmap
169169
"""
170170
if not pixel_source:
171-
if not hasattr(board, "DISPLAY"):
171+
if not getattr(board, "DISPLAY", None):
172172
raise ValueError("Second argument must be a Bitmap or Display")
173173
pixel_source = board.DISPLAY
174174

0 commit comments

Comments
 (0)