From fbe8211a10bd753b62d4439542c85ffeda220929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B2=E5=B1=8E=E5=B0=86=E5=86=9B?= <37292630+wlmh110@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:43:47 +0800 Subject: [PATCH] waveshare e-lnk 2.13 V3/V4 update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimize the initialization function to resolve the issue of noise in the first few frames caused by the lack of buffer initialization. Signed-off-by: 铲屎将军 <37292630+wlmh110@users.noreply.github.com> --- pwnagotchi/ui/hw/waveshare2in13_V3.py | 9 +++++++++ pwnagotchi/ui/hw/waveshare2in13_V4.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pwnagotchi/ui/hw/waveshare2in13_V3.py b/pwnagotchi/ui/hw/waveshare2in13_V3.py index 8c5bcd0a..c63c391f 100644 --- a/pwnagotchi/ui/hw/waveshare2in13_V3.py +++ b/pwnagotchi/ui/hw/waveshare2in13_V3.py @@ -2,6 +2,7 @@ import logging import pwnagotchi.ui.fonts as fonts from pwnagotchi.ui.hw.base import DisplayImpl +from PIL import Image,ImageDraw,ImageFont class WaveshareV3(DisplayImpl): @@ -37,6 +38,14 @@ class WaveshareV3(DisplayImpl): self._display = EPD() self._display.init() self._display.Clear(0xFF) + try: + new_image = Image.new('1', ( self._display.height, self._display.width), 255) + buf = self._display.getbuffer(new_image) + self._display.displayPartBaseImage(buf) + except Exception as e: + logging.info(e) + + logging.info("initializing waveshare v3 display done") def render(self, canvas): buf = self._display.getbuffer(canvas) diff --git a/pwnagotchi/ui/hw/waveshare2in13_V4.py b/pwnagotchi/ui/hw/waveshare2in13_V4.py index ed07fbd9..6e7275e9 100644 --- a/pwnagotchi/ui/hw/waveshare2in13_V4.py +++ b/pwnagotchi/ui/hw/waveshare2in13_V4.py @@ -3,6 +3,7 @@ import logging import pwnagotchi.ui.fonts as fonts from pwnagotchi.ui.hw.base import DisplayImpl +from PIL import Image,ImageDraw,ImageFont class WaveshareV4(DisplayImpl): def __init__(self, config): @@ -36,6 +37,14 @@ class WaveshareV4(DisplayImpl): self._display = EPD() self._display.init() self._display.Clear(0xFF) + try: + new_image = Image.new('1', ( self._display.height, self._display.width), 255) + buf = self._display.getbuffer(new_image) + self._display.displayPartBaseImage(buf) + except Exception as e: + logging.info(e) + + logging.info("initializing waveshare v2in13_V4 display done") def render(self, canvas): buf = self._display.getbuffer(canvas)