pygame problem with adafruit-pitft on raspbian jessie

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit2
 
Posts: 22144
Joined: Fri Mar 11, 2005 7:36 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by adafruit2 »

k updated!

User avatar
Snowboundfox
 
Posts: 1
Joined: Wed Mar 09, 2016 10:08 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by Snowboundfox »

Even after heine's fix I am still having problems with this. Any suggestions?

It seems like as I click around the screen a bit it starts to work itself out, but it is kind of obnoxious to tap around the screen for 5 minutes every time I start up the program.

User avatar
atredi
 
Posts: 1
Joined: Wed Mar 16, 2016 4:16 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by atredi »

same problem here, replaced the library (confirmed with dpkg -l | grep sdl) but still no luck with the screen.

ideas?

User avatar
FrankPrCB
 
Posts: 3
Joined: Fri Oct 16, 2015 8:08 am

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by FrankPrCB »

Same problem, the fix does not help.
libsdl is version 1.2.15-5. Touch do not work, returned coordinates are false.

User avatar
Sirukinx
 
Posts: 1
Joined: Thu Aug 25, 2016 10:49 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by Sirukinx »

I am having the same problem.

Attempted downgrading the libsdl1.2.15.10 library to libsdl1.2.15.5 but no dice.

The touchscreen is still not working right in pygame but it works fine in X.

User avatar
woferry
 
Posts: 2
Joined: Mon Jul 03, 2017 4:45 am

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by woferry »

I ran across these instructions on another page, which pointed to this thread as the original source. This fixed my issues getting my Sainsmart 5" HDMI touchscreen (ADS7846) working properly. But whenever I run 'apt-get upgrade' it tries to go back to the Jessie version of libsdl, which breaks it all over again. Is there some way to convince apt-get to stick with the installed version and not attempt to "upgrade" it? Thanks in advance.

User avatar
adafruit2
 
Posts: 22144
Joined: Fri Mar 11, 2005 7:36 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by adafruit2 »

woferry - please contact sainsmart for support, they will be able to help you!

User avatar
woferry
 
Posts: 2
Joined: Mon Jul 03, 2017 4:45 am

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by woferry »

adafruit2 wrote:woferry - please contact sainsmart for support, they will be able to help you!
This has absolutely nothing to do with sainsmart, it's a linux / apt-get question. From the earlier post, the section to "set the priority for libsdl from wheezy higher then the jessie package" doesn't seem to work as far as I can tell, apt-get upgrade still prefers the jessie package over the wheezy one and breaks pygame's support for touchscreens every time it's run. So I don't know if there's something wrong with that part of heine's very helpful post or if there's more necessary to make it stick, etc. But this is of benefit to people who use the adafruit touchscreen displays as well.

User avatar
tmo7452
 
Posts: 1
Joined: Tue Jul 04, 2017 12:32 am

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by tmo7452 »

I just got a 2.8" PiTFT - Capacitive to use for a project. I already have the bulk of it running in Raspbian (jessie) so I used the Easy Install DIY script. After reboot, the desktop moved to the TFT and it looked good (although unusable with everything mashed together). I'd like to avoid having the main display there, so I changed /etc/X11/xorg.conf.d/99-fbdev.conf to point to /dev/fb0 and now the desktop is back on the HDMI.

At this point, I'm trying to draw to the TFT in python. Everyone is saying pygame so I followed the instructions for "Pygame UI basics". At this point, I have been unable to get ANYTHING drawn to the TFT in pygame. I followed the instructions in the "PyGame Tips" post to force SDL 1.2, no change. I've set SDL_FBDEV to /dev/fb1, confirmed by calling os.getenv('SDL_FBDEV') and os.environ['SDL_FBDEV']. Every time I call pygame.display.set_mode((320,240)), I get a "pygame window" on the HDMI and all draw commands go to that. Was there something else I'm supposed to install to make this work?

User avatar
cragganmore
 
Posts: 10
Joined: Mon Oct 14, 2013 7:18 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by cragganmore »

I'm having the same problem as tmo7452. I've done exactly what he/she has done and with the same (lack of) results. Unable to get pygame to draw to /dev/fb1.

Interestingly, I'm also unable to get X to run on the pitft with the "export FRAMEBUFFER=/dev/fb1 startx" command in the detailed installation instructions. I can get X to run on the pitft when I boot if I've changed /etc/X11/xorg.conf.d/99-fbdev.conf to point to /dev/fb1, but that's it.

Any ideas?

User avatar
kck
 
Posts: 29
Joined: Fri Dec 25, 2015 1:40 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by kck »

I have always had to specify os.environ['SDL_VIDEODRIVER'] = 'fbcon' as well as the /dev/fb1. Also I set FULLSCREEN mode in the set_mode:
config.screen = pygame.display.set_mode((config.screenwidth, config.screenheight),pygame.FULLSCREEN)

Either of these of any help?

User avatar
cragganmore
 
Posts: 10
Joined: Mon Oct 14, 2013 7:18 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by cragganmore »

Hi kck. Thanks for the reply.

I tried using:

os.environ['SDL_VIDEODRIVER'] = 'fbcon'
os.environ['SDL_FBDEV'] = '/dev/fb1'

as well as:

os.putenv('SDL_VIDEODRIVER', 'fbcon')
os.putenv('SDL_FBDEV', '/dev/fb1')

But neither work for me. I'm going to start a new thread that outlines my specific issues and what I've tried. Thanks for your suggestion!

User avatar
Joshb08
 
Posts: 1
Joined: Fri Jan 19, 2018 3:55 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by Joshb08 »

The installsdl.sh script in the tutorial needs to be updated again. If you run it as-is you get:

Code: Select all

E: The value 'stable' is invalid for APT::Default-Release as such a release is not available in the sources
"stable" is no longer valid for wheezy, instead it needs to be "oldstable" The fix is to change line 8 in the script to:

Code: Select all

echo "APT::Default-release \"oldstable\";
It works great with that change.

User avatar
adafruit2
 
Posts: 22144
Joined: Fri Mar 11, 2005 7:36 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by adafruit2 »

fixed!

User avatar
spotrh
 
Posts: 4
Joined: Mon Jun 25, 2012 3:34 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

Post by spotrh »

The "downgrade" libsdl1.2debian hack does not work for me on raspbian-stretch (2018-04-18). WIth the libsdl1.2 in stretch, I get wild input from the touchscreen, if I downgrade, I get no input read at all (despite evtest clearly showing input being read in).

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”