pimoroni / st7735-python

Python library to control an ST7735 TFT LCD display. Allows simple drawing on the display without installing a kernel module.
MIT License
61 stars 29 forks source link

Merge of pull request #33 broke examples in other Repositories #36

Open dwaardenburg opened 11 months ago

dwaardenburg commented 11 months ago

The examples in the other repositories that are using this library are outdated due to this pull request.

Downloading the old version of this repository (commit c0733d6) and pip installing that one fixes the issues.

If I may suggest to using a development branch for the currently new versions. The errors that are generated are not very instructive yet.

Gadgetoid commented 11 months ago

If I may suggest to using a development branch for the currently new versions. The errors that are generated are not very instructive yet.

It's not in development. The main branch currently tracks release v1.0.0.

I'm dragging a whole ecosystem kicking and screaming into "the future of GPIO" and unfortunately I don't have the time to tread lightly. I would recommend ensuring any examples relying upon this library pin themselves to st7735==0.0.5 until such a time as they're ready to migrate.

There's a bug in gpiodevice which causes very unhelpful errors to be produced when you use an integer - as per the old way - instead of a pin label. Look up the pins you're using and swap them out for "PINX" or "GPIOX" or whatever labels your hardware has when you run gpioinfo (sudo apt install gpiod).

Welcome to the future 😭

dwaardenburg commented 11 months ago

The libraries are from pimoroni, would it not be worth while to update the setups for at least those ones?

dwaardenburg commented 11 months ago

I can help out with some PRs, but I just started building mine today. So it might take some time before I can get the new versions working.

Gadgetoid commented 11 months ago

The libraries are from pimoroni, would it not be worth while to update the setups for at least those ones?

Oh good fun 😆

I plan to upgrade everything but couldn't do it simultaneously. Part of this is a huge rejig of the python packaging to the latest and greatest. The other part is migration from the defunct (and always rather non-standard) RPi.GPIO over to gpiod and my weird gpiodevice library. Things are already so broken that I totally didn't think how much more broken they could get.

The gpiodevice library - which is, ironically, probably the bit responsible for throwing weird cryptic errors when using a newer st7735 library with older code - is currently a very experimental effort to solve the "gpiod doesn't give you very helpful error messages" problem.

Any feedback at all is useful, I'm being a little bit more reactive than proactive here and I've been distracted from Pi/Python by RP2040/Pico/MicroPython for a couple of years, so I've lost the plot somewhat.

Which libraries/projects were you trying to use?

Edit: A WIP for better surfacing errors - https://github.com/pimoroni/gpiodevice-python/pull/3

wardbox commented 11 months ago

FWIW I can't get the scrolling-text example in this repo working. Installing from scratch I ended up with a few issues.

Downgrading to 0.0.5 and switching the strings for dc and backlight to ints does result in the example working.

Let me know if I can provide any other details - don't mean for this to be a "same here" comment, just seemed like the issue wasn't known to be for the examples here as well. Happy to pitch in on a PR as well!

nemecek-filip commented 11 months ago

@wardbox can you share which changes you made? I am running into this same issue and simply downgrading the library is not enough to get it to work. Thanks!

wardbox commented 11 months ago

@wardbox can you share which changes you made? I am running into this same issue and simply downgrading the library is not enough to get it to work. Thanks!

This snippet worked for my setup following the wiring suggestion on the store page:

Here's which pins to connect between your 0.96" LCD Breakout and your Pi's GPIO (note that it's BCM pin numbering):

3-5V to any 5V or 3V pin CS to BCM 7 SCK to BCM 11 MOSI to BCM 10 DC to BCM 9 BL to BCM 19 GND to any ground pin

import ST7735
    # Create TFT LCD display class.
disp = ST7735.ST7735(
        port=0,
        cs=ST7735.BG_SPI_CS_FRONT,
        dc=9,
        backlight=35,
        rotation=90,
        spi_speed_hz=4000000,
    )

ymmv for the actual pin numbers on cs, dc, and backlight

Gadgetoid commented 11 months ago
  • Once those are installed, I get
Woah there, suitable gpiochip not found!
PIN21: not found - /dev/gpiochip0 (pinctrl-bcm2835)!

You should run gpioinfo, it's likely instead of 'PIN21' you need 'GPIO9'.

wardbox commented 11 months ago
  • Once those are installed, I get
Woah there, suitable gpiochip not found!
PIN21: not found - /dev/gpiochip0 (pinctrl-bcm2835)!

You should run gpioinfo, it's likely instead of 'PIN21' you need 'GPIO9'.

I did try that out as well with no luck :(