joukos / PaperTTY

PaperTTY - Python module to render a TTY or VNC on e-ink
942 stars 101 forks source link

gpiozero SPIDevice - support for remote devices #120

Closed mcarr823 closed 8 months ago

mcarr823 commented 8 months ago

*Note: this PR is built on top of PR #116 and should be ignored until/unless that one is merged.

This PR furthers the implementation of the optional gpiozero dependency. If gpiozero is detected, it will use gpiozero for SPI operations instead of using spidev directly.

Most interestingly, this allows for targeting remote devices which are attached to waveshare panels. For example, running papertty on a desktop computer and sending updates to a raspberry pi on the same network. This could facilitate some interesting use-cases, since a desktop PC is going to be significantly more powerful than a raspberry pi.

A quick example of remote execution and the setup necessary is below.

On the raspberry pi:

#Install gpiod
sudo apt install pigpio

#Remove the "-l" from the end of the ExecStart command
sudo vi /lib/systemd/system/pigpiod.service

#Reload the daemon, then start it
sudo systemctl daemon-reload
sudo systemctl start pigpiod.service

#Make it start automatically on reboot
sudo systemctl enable pigpiod.service

On the desktop:

#Install papertty like normal
#Then install gpiozero per the other PR
papertty_venv/bin/pip3 install gpiozero

#Then install pigpio
papertty_venv/bin/pip3 install pigpio

#Finally, start papertty REMOTELY
#It's the same command as you'd usually run for the panel, but with an environment variable for the IP address of the target device
sudo PIGPIO_ADDR=192.168.1.170 papertty_venv/bin/papertty --driver IT8951 terminal --size 12 --font myfont.ttf
joukos commented 8 months ago

Oops, a wild conflict appeared.