From 0cd93fd99c8f8459e8bcd3190efbe99613a99128 Mon Sep 17 00:00:00 2001 From: Nick Klockenga Date: Wed, 2 Aug 2023 22:39:00 -0400 Subject: [PATCH 1/3] move from writebytes to writebytes2 to support larger than default spidev buffer sizes --- src/seedsigner/hardware/ST7789.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/seedsigner/hardware/ST7789.py b/src/seedsigner/hardware/ST7789.py index c9cb1cdb..ebd4952b 100644 --- a/src/seedsigner/hardware/ST7789.py +++ b/src/seedsigner/hardware/ST7789.py @@ -159,13 +159,11 @@ class ST7789(object): pix = arr.tobytes() self.SetWindows ( 0, 0, self.width, self.height) GPIO.output(self._dc,GPIO.HIGH) - for i in range(0,len(pix),4096): - self._spi.writebytes(pix[i:i+4096]) + self._spi.writebytes2(pix) def clear(self): """Clear contents of image buffer""" _buffer = [0xff]*(self.width * self.height * 2) self.SetWindows ( 0, 0, self.width, self.height) GPIO.output(self._dc,GPIO.HIGH) - for i in range(0,len(_buffer),4096): - self._spi.writebytes(_buffer[i:i+4096]) + self._spi.writebytes2(_buffer) From 32eda52bb4e89c95dfd53a2d034808331f2ff910 Mon Sep 17 00:00:00 2001 From: Nick Klockenga Date: Wed, 2 Aug 2023 23:05:57 -0400 Subject: [PATCH 2/3] update manual install instructions for how to increase spidev buffer in cmdline.txt --- docs/manual_installation.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/manual_installation.md b/docs/manual_installation.md index 5b8ebadf..a8c63da5 100644 --- a/docs/manual_installation.md +++ b/docs/manual_installation.md @@ -215,6 +215,13 @@ workon seedsigner-env pwd ``` +### Optional: increase spidev buffer size +This allows `ST7789.py` to update the LCD without performing multiple write operations because the default buffer size is 4096 bytes. The default can be changed via the `/boot/cmdline.txt` file. You will need to add `spidev.bufsiz=131072` to the end of this single lined file command. + +Example `cmdline.txt` contents: +``` +console=serial0,115200 console=tty1 root=PARTUUID=2fa4ba7e-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether spidev.bufsiz=131072 +``` ### Configure `systemd` to run SeedSigner at boot: From 3276628e2f8c40c244cee3131a630fb5e64c0199 Mon Sep 17 00:00:00 2001 From: Nick Klockenga Date: Thu, 3 Aug 2023 16:54:37 -0400 Subject: [PATCH 3/3] bump framerate to 6 --- src/seedsigner/gui/screens/scan_screens.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/seedsigner/gui/screens/scan_screens.py b/src/seedsigner/gui/screens/scan_screens.py index 85fc3a27..a92821f5 100644 --- a/src/seedsigner/gui/screens/scan_screens.py +++ b/src/seedsigner/gui/screens/scan_screens.py @@ -44,7 +44,7 @@ class ScanScreen(BaseScreen): decoder: DecodeQR = None instructions_text: str = "< back | Scan a QR code" resolution: tuple[int,int] = (480, 480) - framerate: int = 5 # TODO: alternate optimization for Pi Zero 2W? + framerate: int = 6 # TODO: alternate optimization for Pi Zero 2W? render_rect: tuple[int,int,int,int] = None