Skip to content

Commit

Permalink
Fix state value conversion for joystick (LX, LY, RX, RY)
Browse files Browse the repository at this point in the history
This makes the joystick values int8 compatible.
Before this fix the joystick ranges from -127 to 128. But this corrects it to -128 to 127.
  • Loading branch information
kappaj committed Jun 4, 2023
1 parent b67bcb2 commit f193fad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pydualsense/pydualsense.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ def readInput(self, inReport) -> None:

self.states = states
# states 0 is always 1
self.state.LX = states[1] - 127
self.state.LY = states[2] - 127
self.state.RX = states[3] - 127
self.state.RY = states[4] - 127
self.state.LX = states[1] - 128
self.state.LY = states[2] - 128
self.state.RX = states[3] - 128
self.state.RY = states[4] - 128
self.state.L2 = states[5]
self.state.R2 = states[6]

Expand Down Expand Up @@ -862,4 +862,4 @@ class DSBattery:
"""
def __init__(self) -> None:
self.State = BatteryState.POWER_SUPPLY_STATUS_UNKNOWN
self.Level = 0
self.Level = 0

0 comments on commit f193fad

Please sign in to comment.