mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
Merge pull request #420 from newtonick/larger-spidev-buffer
Update ST7789 to support writing to larger SPIDEV buffer
This commit is contained in:
@@ -215,6 +215,13 @@ workon seedsigner-env
|
|||||||
pwd
|
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:
|
### Configure `systemd` to run SeedSigner at boot:
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class ScanScreen(BaseScreen):
|
|||||||
decoder: DecodeQR = None
|
decoder: DecodeQR = None
|
||||||
instructions_text: str = "< back | Scan a QR code"
|
instructions_text: str = "< back | Scan a QR code"
|
||||||
resolution: tuple[int,int] = (480, 480)
|
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
|
render_rect: tuple[int,int,int,int] = None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -159,13 +159,11 @@ class ST7789(object):
|
|||||||
pix = arr.tobytes()
|
pix = arr.tobytes()
|
||||||
self.SetWindows ( 0, 0, self.width, self.height)
|
self.SetWindows ( 0, 0, self.width, self.height)
|
||||||
GPIO.output(self._dc,GPIO.HIGH)
|
GPIO.output(self._dc,GPIO.HIGH)
|
||||||
for i in range(0,len(pix),4096):
|
self._spi.writebytes2(pix)
|
||||||
self._spi.writebytes(pix[i:i+4096])
|
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
"""Clear contents of image buffer"""
|
"""Clear contents of image buffer"""
|
||||||
_buffer = [0xff]*(self.width * self.height * 2)
|
_buffer = [0xff]*(self.width * self.height * 2)
|
||||||
self.SetWindows ( 0, 0, self.width, self.height)
|
self.SetWindows ( 0, 0, self.width, self.height)
|
||||||
GPIO.output(self._dc,GPIO.HIGH)
|
GPIO.output(self._dc,GPIO.HIGH)
|
||||||
for i in range(0,len(_buffer),4096):
|
self._spi.writebytes2(_buffer)
|
||||||
self._spi.writebytes(_buffer[i:i+4096])
|
|
||||||
|
|||||||
Reference in New Issue
Block a user