Pause Removal on DPAD

This commit is contained in:
J-Doiron
2024-12-13 18:14:42 -08:00
parent e791bee09a
commit 43e9cb2348
2 changed files with 6 additions and 8 deletions

View File

@@ -99,10 +99,10 @@ class LTTGamePadDS4(vg.VDS4Gamepad):
Sometimes we need to press a certain gamepad button multiple times in a row, this loop does that for you
"""
for _ in range(n):
self.single_press(button)
self.single_button_press(button)
time.sleep(pause)
def single_dpad_press(self, direction = vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_SOUTH, pause = 0.1):
def single_dpad_press(self, direction = vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_SOUTH):
"""
Custom function to perform a single press of a specified gamepad button
@@ -124,15 +124,13 @@ class LTTGamePadDS4(vg.VDS4Gamepad):
self.directional_pad(direction=direction)
self.update()
time.sleep(pause)
def dpad_press_n_times(self, direction: vg.DS4_DPAD_DIRECTIONS, n: int, pause: float):
def dpad_press_n_times(self, direction: vg.DS4_DPAD_DIRECTIONS, n: int):
"""
Sometimes we need to press a certain gamepad button multiple times in a row, this loop does that for you
"""
for _ in range(n):
self.directional_pad(direction)
time.sleep(pause)
def clickme(x: int, y: int):
"""Pyautogui's click function sucks, this should do the trick"""

View File

@@ -94,7 +94,7 @@ def run_benchmark():
gamepad.single_dpad_press(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_WEST)
time.sleep(0.2)
gamepad.dpad_press_n_times(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_NORTH, n=4, pause=0.5)
gamepad.dpad_press_n_times(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_NORTH, n=4)
if kerasService.look_for_word(word="esports", attempts=5, interval=0.2):
logging.info('Saw esports. Navigating accordingly.')
@@ -111,7 +111,7 @@ def run_benchmark():
gamepad.single_dpad_press(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_SOUTH)
time.sleep(0.2)
gamepad.dpad_press_n_times(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_SOUTH, n=2, pause=0.5)
gamepad.dpad_press_n_times(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_SOUTH, n=2)
gamepad.single_button_press(button=vg.DS4_BUTTONS.DS4_BUTTON_CROSS)
time.sleep(1)
@@ -161,7 +161,7 @@ def run_benchmark():
logging.info("Benchmark took %f seconds", elapsed_test_time)
gamepad.single_button_press(button=vg.DS4_BUTTONS.DS4_BUTTON_OPTIONS)
gamepad.dpad_press_n_times(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_SOUTH, n=3, pause=0.5)
gamepad.dpad_press_n_times(direction=vg.DS4_DPAD_DIRECTIONS.DS4_BUTTON_DPAD_SOUTH, n=3)
gamepad.single_button_press(button=vg.DS4_BUTTONS.DS4_BUTTON_CROSS)
time.sleep(0.4)