Giter VIP home page Giter VIP logo

hyperpixel2r-python's People

Contributors

gadgetoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hyperpixel2r-python's Issues

I would like to enable touch in a browser

When I bought the HyperPixel 2.1 Round I assumed that it would work in a similar way as the original Hyperpixel Touch screens. Iโ€™ve used one of them before and it simply enables touch for whatever you want to use on a screen. I have a fullscreen Firefox running on a Raspberry PI with a HyperPixel touch without a problem. It just works.
I am a bit surprised that the touch driver for the round one is only available for pygame, if I understand things correctly.
Are there any plans to update the original driver to work with the round screen as well? I would love to be able to use this screen with web technology in a browser.

touch rotation with raspberry pi zero w

I want to rotate the touch capability but it isn't working with raspi zero w.
I tried using the hyperpixel2r-rotate command but get tons of errors, assuming that i need to be in the desktop for it.
I am using command line /ssh to control the device.

I used the standard /boot/config.txt commands to rotate the screen but cannot rotate the touch functionality.

Thank you

Touch_id

Hello there !

I saw in the readme:
"touch_id - 0 or 1 depending on which touch is tracked"

What do you mean by "which touch" ?

Thanks !

constant phantom touches?

I'm afraid I may already know the answer, but figured I would ask just in case I am misunderstanding how the touch library is meant to work. My screen is attached to a PiZeroW and I've managed to run all of the examples except for test.py which throws an error when touched. But I noticed that the examples constantly flash colours (even when nothing is touching the screen) so I created the little test below to sort out what might be happening. My expectation is the handle_touch function should only run once when a touch goes down, and then again when it goes up - so I should just get two lines printed for each individual touch. But instead the function is firing constantly as soon as the program starts - it just immediately starts printing lines and doesn't stop until the program is stopped, even though I'm not touching the screen at all. I've also notice that there is always a touch reported as touch_id: 15, x: 4095, y: 4095, state: False right at the start, which seems pretty weird...

Is there something else I am missing about how this is supposed to work... or do I just have a defective screen that thinks it is always being touched?

from hyperpixel2r import Touch
from time import sleep

touch = Touch()

@touch.on_touch
def handle_touch(touch_id, x, y, state):
    print(f'touch_id: {touch_id}, x: {x}, y: {y}, state: {state}')

print('started')
try:
    while True:
        sleep(1)
except KeyboardInterrupt:
    print('stopped')

The output:

pi@raspberryPi:~ $ sudo python3 toucher.py
started
touch_id: 0, x: 237, y: 276, state: False
touch_id: 1, x: 238, y: 146, state: True
touch_id: 0, x: 237, y: 276, state: True
touch_id: 1, x: 238, y: 142, state: True
touch_id: 1, x: 238, y: 137, state: True
touch_id: 1, x: 238, y: 137, state: False
touch_id: 15, x: 4095, y: 4095, state: False
touch_id: 0, x: 237, y: 278, state: True
touch_id: 0, x: 238, y: 255, state: True
touch_id: 0, x: 238, y: 230, state: True
touch_id: 0, x: 239, y: 208, state: True
...
touch_id: 0, x: 239, y: 161, state: True
touch_id: 1, x: 239, y: 340, state: False
touch_id: 0, x: 239, y: 151, state: True
touch_id: 1, x: 239, y: 340, state: True
touch_id: 0, x: 239, y: 152, state: True
touch_id: 1, x: 239, y: 340, state: False
touch_id: 0, x: 239, y: 143, state: True
touch_id: 0, x: 239, y: 157, state: True
touch_id: 0, x: 239, y: 151, state: True
touch_id: 0, x: 239, y: 145, state: True
touch_id: 1, x: 239, y: 285, state: False
^C
stopped

hyperpixel2r-python doesn't work on Rpi Zero W (buster)

All the hyperpixel2r-python examples don't work on Rpi Zero W (buster)

pi@rpizerow1:~/hyperpixel2r-python/examples $ sudo SDL_FBDEV=/dev/fb0 python3 clock.py
Illegal instruction
$ uname -a
Linux rpizerow1 5.10.63+ #1496 Wed Dec 1 15:57:05 GMT 2021 armv6l GNU/Linux
$ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@rpizerow1:~/hyperpixel2r-python/examples $ 

Any ideas why this can happen ?

Examples are a glitchy mess

In some instances the examples may look like this:

glitchy-clock

This is due to somewhat old pygame/SDL versions being shipped with Raspberry Pi OS.

Raspberry Pi 3 etc

On Pi 3B+, Pi Zero and other pre-Pi4 boards you can update pygame from pip to fix glitchiness:

sudo python3 -m pip install pygame --upgrade

Raspberry Pi 4

On Pi 4, you should upgrade pygame as above but it will probably result in this error when you try and run an example:

* failed to add service - already in use?

I believe this, followed by the unhelpful hard exit(1) is caused by this code: https://github.com/raspberrypi/userland/blob/97bc8180ad682b004ea224d1db7b8e108eda4397/interface/khronos/common/linux/khrn_client_rpc_linux.c#L214-L216

In any case the only way to work around this seems to be by compiling SDL from source... ๐Ÿ˜ฌ ... and using your shiny new SDL to replace the system one used by pygame.

You can do that with the following steps:

wget https://www.libsdl.org/release/SDL2-2.0.14.zip
unzip SDL2-2.0.14.zip
cd SDL2-2.0.14
./configure --enable-video-rpi --enable-video-kmsdrm --prefix=`pwd`/install
make
make install

This will install SDL into an "install" directory within the "SDL2-2.0.14" directory, so don't delete it. (You can change the --prefix when configuring to something like /opt/SDL2-2.0.14 if you're so inclined, it doesn't really matter where you put it.)

Once built the new SDL libraries will be available in install/lib, find the full path by typing:

cd install/lib
pwd

In my case the path is /home/pi/SDL2-2.0.14/install/lib.

Now when running an example from this repository, you should prefix the command line with LD_LIBRARY_PATH=/home/pi/SDL2-2.0.14/install/lib, for example:

sudo LD_LIBRARY_PATH=/home/pi/SDL2-2.0.14/install/lib python3 clock.py

If everything is set up correctly on your Pi 4 you should see "Using driver: kmsdrm"

Question about the touch driver

Hello,

Does the touch driver manage only "touch" action or also slide ?
Does it need a desktop environment or rasbian OS lite is ok ?

Many thanks !

Touch not working in OS, similar to the HyperPixel 4.0 Touch

I understand that the touch drivers are separated out, but is there anyway to, say, drag a window in Raspberry Pi OS using touch?
Is it possible to use the HyperPixel 2.1 Round's touch functionality at an OS level, similar to how the HyperPixel 4.0 Touch works?

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.