n4archive / pigame

A pygame wrapper for the libary pitft_touchscreen.
GNU Lesser General Public License v3.0
6 stars 1 forks source link

Support for other (Adafruit) touchscreens #4

Closed nift4 closed 3 years ago

nift4 commented 5 years ago

The 2.8" Resistive and other touch screens need a old version of SDL. If this driver supports them we don't have to install very old software. But I don't have them. I only maintain 2.8" capacitive. But any help or pull requests are okay and probally accepted.

BroMarduk commented 5 years ago

Let me know how you wish to support resistive touchscreens in your code.

It will require both a change in pitft_touchscreen and pigame as the events are different on the Adafruit Restive touch screens in EVDEV. I have this working in a fork of @PrzemoF's pitft_touchscreen - I don't know if he cares about resistive screen support in his code, but if he is responsive to the idea I will see about a PR to bring this code into the project. I'm currently testing the SYN_DROPPED message support that SHOULD be in pitft_touchscreen regardless if the resistive support is added or not.

Device detection could be done somewhat automatically by looking at the device.name property of the evdev driver or manually specified by a switch (or both!). May require some coordination :).

nift4 commented 5 years ago

I'm intrested and I have a fork of pitft_touchscreen that is linked on my pages so we can test and release some resistive touchscreen supporting versions :+1:

BroMarduk commented 5 years ago

I created a PR to get the code fully inline with what is in the base repository. Once that gets merged in I'll create the resistive support - you might want to create a separate branch in the pitft_touchscreen project until we get everything synced. I've tested the resistive support and it works with all the PiTFT resistive screens I have (2.4, 2.8, 3.2 and 3.5). I have the older versions (the ones with the 20 pin connectors) that I still want to test as well as some of the 4D Systems displays that I have around.

Also working on getting it running on Pimoroni HyperPixel 3.5 and 4.0 screens. The HyperPixel supports multi-touch, so I'm trying to understand fully how EVDEV uses the SLOT messages - I understand for normal operation, but it gets tricky when adding SYN_DROPPED support. The Pimoroni drivers are also doing some strange X,Y stuff I need to get to the bottom of and have some issues with Stretch support. Not to mention the resolution is 800x1024. So this is down the road a bit. :)

nift4 commented 5 years ago

Cool!

BroMarduk commented 5 years ago

I think I am going to make the touchscreen a parameter to the PiTft init method.

If adding the device in the init is OK with you, I will add this code in which will allow resistive support.

Other items I can add fairly easily that I think we should

Other items that I would like to see added

Would like to hear your thoughts @nift4 ....

nift4 commented 5 years ago

I'm okay with all changes in your comment, for the button code updates are coming from mine side soon.

nift4 commented 5 years ago

@BroMarduk #13 for the buttons :)

nift4 commented 5 years ago

@BroMarduk Any progress?

BroMarduk commented 5 years ago

Yes, I have had it working on all PiTFT screens from Adafruit that support touch (resistive and capacitive) in both portrait and landscape mode. I now have to fix my code so it supports the different nuances for each screen as the axes are in different states depending on the screen type and rotation.

I may do a release with just landscape to start then add in portrait down the road. I know it all works, now just have to tie it all together.

nift4 commented 5 years ago

@BroMarduk Thanks for your work! :)

nift4 commented 5 years ago

@BroMarduk Any news?

nift4 commented 4 years ago

@BroMarduk Anything on this?