adafruit / Adafruit_CircuitPython_EPD

e paper driver for circuit python
MIT License
40 stars 19 forks source link

Bottom rows of pixels are not aligning on Adafruit 2.13" Monochrome eInk #75

Closed awallat closed 1 year ago

awallat commented 1 year ago

I purchased a Adafruit 2.13" Monochrome E-Ink Bonnet for Raspberry Pi (with 1680 based chipset). When trying the examples: E-Ink Weather Station](https://learn.adafruit.com/raspberry-pi-e-ink-weather-station-using-python/weather-station-code) or the examples/epd_bonnet.py the display does not update correctly. The bottom lines are distorted. The issue has come up before and it got a patch, but it does not appear to be working with the current library.

The problem was discussed and analyzed in the forum: https://forums.adafruit.com/viewtopic.php?p=972750#p972750

I tried with a Raspberry Pi Zero 2WH and 3b+. The interesting thing is that when switching to chipset 1675, where the screen cannot be controlled, and going back to 1680, the bottom lines are cleared, but still cannot be used for drawing correctly. There seems to be an offset problem. I'm using the current Adafruit CircuitPython EPD release (v2.11.0).

Here's a photo of the problem: PXL_20230512_070255249

and here switching back and forth the mentioned chipsets: PXL_20230515_202255522

tannewt commented 1 year ago

Use the RAM dimensions from the SSD1680 datasheet: 176x296. The displayed area won't start at 0,0 because it depends on how the control chip is connected to the display itself. (In CP displayio this is handled with colstart and rowstart.)

awallat commented 1 year ago

I'm afraid I need more information since I'm quite new to this. I'm working on a raspberry pi (zero 2wh) and only had examples using the modules digitalio, busio and board to setup the screen. The module displayio cannot be found.

tannewt commented 1 year ago

Please post the full code you are running and I can suggest the edit.

awallat commented 1 year ago

Here's a simple example, which draws a square and a line. Here you can also see the offset problem again:

import digitalio
import busio
import board
from adafruit_epd.epd import Adafruit_EPD
from adafruit_epd.ssd1680 import Adafruit_SSD1680  # pylint: disable=unused-import

spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
ecs = digitalio.DigitalInOut(board.CE0)
dc = digitalio.DigitalInOut(board.D22)
rst = digitalio.DigitalInOut(board.D27)
busy = digitalio.DigitalInOut(board.D17)

print("Creating display")
display = Adafruit_SSD1680(122, 250,
    spi,
    cs_pin=ecs,
    dc_pin=dc,
    sramcs_pin=None,
    rst_pin=rst,
    busy_pin=busy,
)

display.rotation = 1

print("Clear buffer")
display.fill(Adafruit_EPD.WHITE)

print("Draw Rectangles")
display.rect(0, 0, 30, 30, Adafruit_EPD.BLACK)

print("Draw lines")
display.line(0, 0, display.width - 1, display.height - 1, Adafruit_EPD.BLACK)

display.display()
awallat commented 1 year ago

PXL_20230522_183847484

awallat commented 1 year ago

Any help?

tannewt commented 1 year ago

You'll want to add rowstart to the driver init. Similar to: https://github.com/adafruit/Adafruit_CircuitPython_SSD1680/blob/main/examples/ssd1680_four_corners.py#L35 (My guess is rowstart=8)

tannewt commented 1 year ago

For example:

import digitalio
import busio
import board
from adafruit_epd.epd import Adafruit_EPD
from adafruit_epd.ssd1680 import Adafruit_SSD1680  # pylint: disable=unused-import

spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
ecs = digitalio.DigitalInOut(board.CE0)
dc = digitalio.DigitalInOut(board.D22)
rst = digitalio.DigitalInOut(board.D27)
busy = digitalio.DigitalInOut(board.D17)

print("Creating display")
display = Adafruit_SSD1680(122, 250,
    spi,
    rowstart=8,
    cs_pin=ecs,
    dc_pin=dc,
    sramcs_pin=None,
    rst_pin=rst,
    busy_pin=busy,
)

display.rotation = 1

print("Clear buffer")
display.fill(Adafruit_EPD.WHITE)

print("Draw Rectangles")
display.rect(0, 0, 30, 30, Adafruit_EPD.BLACK)

print("Draw lines")
display.line(0, 0, display.width - 1, display.height - 1, Adafruit_EPD.BLACK)

display.display()
awallat commented 1 year ago

This does not work unfortunately. TypeError: __init__() got an unexpected keyword argument 'rowstart'

The parameter does not exist in the library I use. Please see https://github.com/adafruit/Adafruit_CircuitPython_EPD/blob/main/adafruit_epd/ssd1680.py

tannewt commented 1 year ago

Ah, right. Sorry for the confusion. I'm not sure what the right way to do it is with this library.

Maybe just pretend the display is larger than it actually is to account for the clipped pixels.

makermelissa commented 1 year ago

Unfortunately I don't think there's a way to specify an offset with this library. I'm not sure when the offset issue started occurring or if it affects other displays as well, but likely additional testing will be needed to narrow down where to fix the issue in code.

makermelissa commented 1 year ago

Ok, I've been working on this. It appears you have the SSD1675 display (it has 2 tabs on the right as opposed to 1 with the 1680). I have both and verified the SSD1680 driver works fine with the newer one, but I wrote that guide when the bonnet first came out, which had the SSD1675 display. Anyways, the real issue is that the 1675 driver isn't working anymore on the 1675 display and that's what I'm going to try and fix.

makermelissa commented 1 year ago

For reference, here are the 2 different displays: SSD1675 SSD1680

awallat commented 1 year ago

Thanks a lot! It works now with the new version 😄