Update pygameControls/dualsense_controller.py
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from pygameControls.controlsbase import ControlsBase
|
from pygameControls.controlsbase import ControlsBase
|
||||||
|
from enums import ConnectionType
|
||||||
from pydualsense import *
|
from pydualsense import *
|
||||||
|
|
||||||
BATTERY_STATE = {
|
BATTERY_STATE = {
|
||||||
@@ -16,7 +17,7 @@ class DualSenseController(ControlsBase):
|
|||||||
self.device.init()
|
self.device.init()
|
||||||
self.name = self.device.device.get_product_string()
|
self.name = self.device.device.get_product_string()
|
||||||
self.guid = self.device.get_guid()
|
self.guid = self.device.get_guid()
|
||||||
self.connection_type = connection_type
|
self.connection_type = ConnectionType(connection_type.values())
|
||||||
self.powerlevel = self.device.battery.Level
|
self.powerlevel = self.device.battery.Level
|
||||||
self.batterystate = BATTERY_STATE[str(self.device.battery.State)]
|
self.batterystate = BATTERY_STATE[str(self.device.battery.State)]
|
||||||
self.set_player_id(PlayerID.PLAYER_1)
|
self.set_player_id(PlayerID.PLAYER_1)
|
||||||
@@ -42,6 +43,7 @@ class DualSenseController(ControlsBase):
|
|||||||
print(f"{self.name} connected")
|
print(f"{self.name} connected")
|
||||||
print(f"Power level: {self.powerlevel}")
|
print(f"Power level: {self.powerlevel}")
|
||||||
print(f"Battery state: {self.batterystate}")
|
print(f"Battery state: {self.batterystate}")
|
||||||
|
print(f"Connection type: {connection_type.capitalize()}")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.device.close()
|
self.device.close()
|
||||||
|
Reference in New Issue
Block a user