0

pygame problem with adafruit-pitft on raspbian jessie
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: pygame problem with adafruit-pitft on raspbian jessie

by adafruit2 on Tue Mar 08, 2016 5:00 pm

k updated!

adafruit2
Site Admin
 
Posts: 16799
Joined: Fri Mar 11, 2005 7:36 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

by Snowboundfox on Wed Mar 09, 2016 10:09 pm

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.

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by atredi on Wed Mar 16, 2016 4:18 pm

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

ideas?

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by FrankPrCB on Sun Apr 24, 2016 5:00 am

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

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by Sirukinx on Thu Aug 25, 2016 10:51 pm

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.

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by woferry on Mon Jul 03, 2017 4:47 am

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.

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by adafruit2 on Mon Jul 03, 2017 7:02 pm

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

adafruit2
Site Admin
 
Posts: 16799
Joined: Fri Mar 11, 2005 7:36 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

by woferry on Mon Jul 03, 2017 8:43 pm

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.

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by tmo7452 on Tue Jul 04, 2017 12:47 am

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?

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by Cragganmore on Sat Sep 09, 2017 2:04 am

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?
Cragganmore
 
Posts: 10
Joined: Mon Oct 14, 2013 7:18 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

by kck on Sat Sep 09, 2017 2:15 pm

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?

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by Cragganmore on Mon Sep 11, 2017 3:35 pm

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!
Cragganmore
 
Posts: 10
Joined: Mon Oct 14, 2013 7:18 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

by Joshb08 on Fri Jan 19, 2018 4:42 pm

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

Code: Select all | TOGGLE FULL SIZE
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 | TOGGLE FULL SIZE
echo "APT::Default-release \"oldstable\";


It works great with that change.

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

Re: pygame problem with adafruit-pitft on raspbian jessie

by adafruit2 on Fri Jan 19, 2018 5:50 pm

fixed!

adafruit2
Site Admin
 
Posts: 16799
Joined: Fri Mar 11, 2005 7:36 pm

Re: pygame problem with adafruit-pitft on raspbian jessie

by spotrh on Wed Apr 25, 2018 2:33 pm

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).

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

Please be positive and constructive with your questions and comments.