I managed to fully use a Waveshare eink screen 2in7. I use this driver: https://github.com/mcauser/micropython- ... per2in7.py. I use to display information from sensors: temperature, humidity, etc.
This is how I setup the screen:
And this is how I use it:
Code: Select all
def setup_screen(): # SPIV on ESP32 sck = Pin(18) miso = Pin(19) # Not physically connected mosi = Pin(23) dc = Pin(22) cs = Pin(5) rst = Pin(21) busy = Pin(4) spi = SPI(2, baudrate=115200, polarity=1, phase=1, sck=sck, mosi=mosi, miso=miso) screen = epaper2in7.EPD(spi, cs, dc, rst, busy) screen.init() print("Screen ready") return screen
The first time I upload some files to the board (ESP32 dev kit) and reboot (by disconnecting/connecting the USB cable), the screen works fines and displays what I want. And it works indefinitely: my program loops and read sensors every 10 seconds and displays the info on the screen. The screen refreshes smoothly. The system ran overnight without problem.
Code: Select all
buf = bytearray(config.SCREEN_W * config.SCREEN_H // 8) fb = framebuf.FrameBuffer(buf, config.SCREEN_W, config.SCREEN_H, framebuf.MONO_HLSB) black = 1 white = 0 fb.fill(white) fb.blit(pics.fb_thermometer, 0, 2) screen.display_frame(buf)
Now, when I disconnect the board (to move it somewhere else), the screen seems to have some sort of memory effect. I know eink screens display the same thing until they are refreshed, but that's not what I'm talking about. When I reconnect the board, the screen displays the new data, but then hangs indefinitely: the image is first very clear, then it fades almost completely (white background), then the screen gets slightly dark, and the pattern starts at the begin. This is happening even if I disconnect the screen's power pin. And I don't understand why.
To make it work again, I need to upload any file to the board (with ampy), and then disconnect/reconnect the board.
Any idea why this is happening?