adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
MIT License
3.96k stars 1.16k forks source link

Support for Monochrome Displays #8410

Open DJDevon3 opened 9 months ago

DJDevon3 commented 9 months ago

Someone was having an issue with taking a screenshot with a monochrome display due to bitmap colorspace. There doesn't seem to be support for monochrome displays?

They were using a 128x128 Monochrome display I do not have one to test with.

Circuit Python SH1107 library

help-with-circuitpython discord discussion

AbFarid commented 9 months ago

Thank you, @DJDevon3, for opening this issue! It was I (⚡️) who was having the issue!

It's true, that I was originally using adafruit_bitmapsaver.save_pixels(), but upon further investigation, I can conclude that the root of the problem is likely the adafruit_displayio_sh1107 library (or displayio.Display).

The issue

When using SH1107.fill_row() (an extension of displayio.Display.fill_row()) it triggers the following error: ValueError: Display must have a 16 bit colorspace.

The display in question indeed has a 1 bit colorspace:

class SH1107(displayio.Display):
def __init__(...):
    super().__init__(
            #...
            color_depth=1,
            #...

I am not sure whether SH1107.fill_row() should override displayio.Display.fill_row() or if the Display method itself needs modification.

Environment

tannewt commented 9 months ago

This looks like a core issue because it is a limitation of fill_row: https://github.com/adafruit/circuitpython/blob/70ce576390c7b21007b1f75f16e6fc591c0f61d7/shared-bindings/displayio/Display.c#L479

I'll move the issue.