devdupont/METAR-RasPi

Trouble with AdaFruit touchscreen

Opened this issue · 10 comments

The application works great and I love the new graphic layout, but I've been struggling with the 3.5" 480x320 AdaFruit touchscreen. I'm doubting it's the application, but the touchscreen test and calibration tools all work fine. When I run screen.py, however, the touchscreen buttons don't work at all. If I set the application resolution to 320x240, the touch registration areas are rotated 90 degrees, right along the side edge of the screen, so only a selection are accessible. I surmise that at 480x320, they're off the edge of the screen completely. Is this something you've run into with the AdaFruit screen and do you have any suggestions? The documentation is kind of a mix of old (LCD plate) and new, so piecing it together is a little challenging.

My initial guess is that PyGame is not understanding the display properties. Not sure what's going on yet. What happens if you run it as 320x240 with fullscreen disabled?

I've tried on 320x240 but I'm not sure how to disable fullscreen. I agree that this is either a pygame or an SDL problem. It looks like current versions of RPI have some issues with Adafruit touchscreens. So far, the various forum postings I've seen either haven't worked or are a year or more out of date.

Fullscreen is a setting in config.py. The out of date postings would make sense since that's when the last update happened.

Looks like this is going to end up being a non-starter. Pygame seems to be joined to libsdl1.2 at the hip while the rest of the world has moved on. The last working version I can find is Wheezy, which is years old and doesn't play nice with RPI 4. Even patching libsdl as noted in some forum posts hasn't worked. The combination of RPI 4, Adafruit, and pygame/libsdl isn't happening.

couldn't get my adafruit 2.8 TFT to work; too many screen.py errors when trying to import avwx data. darn.

Unsure if this was you. Just got an email with the error trace which tails with:

    from .search import search
  File "/home/pi/.local/lib/python3.7/site-packages/avwx/station/search.py", line 10, in <module>
    from rapidfuzz import fuzz, process  # type: ignore
  File "/home/pi/.local/lib/python3.7/site-packages/rapidfuzz/__init__.py", line 8, in <module>
    from rapidfuzz import process, fuzz, utils, levenshtein, string_metric
  File "/home/pi/.local/lib/python3.7/site-packages/rapidfuzz/process.py", line 7, in <module>
    from rapidfuzz.cpp_process_cdist import cdist
  File "cpp_process_cdist.pyx", line 1, in init cpp_process_cdist
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 44 from C header, got 40 from PyObject

The avwx-engine library uses rapidfuzz for fuzzy string searching, but the Pi doesn't appear to have the needed C binary with the install. Wouldn't be an issue otherwise since this project doesn't use it.

I can update the library code to handle a bad import and disable the search functions rather than error at runtime.

Pushed an update for version numbers. Should hopefully help. Checked that it runs fine with the pygame 1.x to 2.x upgrade. Let me know if you're still getting screen errors.