Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong or no potentiometer values #24

Open
smarkwardt opened this issue Mar 9, 2021 · 2 comments
Open

Wrong or no potentiometer values #24

smarkwardt opened this issue Mar 9, 2021 · 2 comments

Comments

@smarkwardt
Copy link

The PS4-Controller is connected via bluetooth to my raspberry pi and it works fine

I tested the controller with the following command.

root@pi:/tmpt# jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (Wireless Controller) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 13 buttons (BtnA, BtnB, BtnX, BtnY, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).
Testing ... (interrupt to exit)
Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:of
...
Axes:  0:     0  1:     0  2:-32767  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:of
Axes:  0:     0  1:     0  2:-32767  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:of
Axes:  0:     0  1:     0  2:-32767  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:of
Axes:  0:     0  1:     0  2:-32767  3:     0  4:     0  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:of
Axes:  0:     0  1:     0  2:-32767  3:     0  4:     0  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:of
...
Axes:  0:     0  1:     0  2:-32767  3:     0  4:     0  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:of

With jstest i get for the potentiometer values for L2, R2, L3 & R3 value up to 32k.

But with Python and the pyPS4Controller package received only static values in lower range.
The value ist randomly changed with every restart or connect.

I installed the latest version with pip install pyps4controller and pip3 install pyps4controller

root@pi:/tmp# python3 test.py
Waiting for interface: /dev/input/js0 to become available . . .
Successfully bound to: /dev/input/js0.
on_R3_up: 76
on_R3_up: 76
...
on_R3_y_at_rest
on_L3_right: 76
on_L3_right: 76
on_L3_x_at_rest
on_R3_left: 76
on_R3_left: 76
on_R3_left: 76
...
on_R3_left: 76
on_R3_left: 76
on_R3_x_at_rest
on_R2_press: 76
on_R2_press: 76
...

Thats my code.

from pyPS4Controller.controller import Controller

class MyController(Controller):
    def __init__(self, **kwargs):
        Controller.__init__(self, **kwargs)

controller = MyController(interface="/dev/input/js0", connecting_using_ds4drv=False)
controller.listen()
@jiatinglu99
Copy link

I believe you had the same problem as #20
It is a bug and you can fix it according to @thavens 's solution at the bottom of #20

@smarkwardt
Copy link
Author

The hotfix works perfect. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants