Fix state value conversion for joystick (LX, LY, RX, RY)

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.
This commit is contained in:
Jens Kabisch
2023-06-04 18:44:02 +02:00
committed by GitHub
parent b67bcb2b9d
commit f193fad5ea

View File

@@ -245,10 +245,10 @@ class pydualsense:
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]
@@ -862,4 +862,4 @@ class DSBattery:
"""
def __init__(self) -> None:
self.State = BatteryState.POWER_SUPPLY_STATUS_UNKNOWN
self.Level = 0
self.Level = 0