Fix: Infinite click on switch when switch is unknown

- Increase ui retry interval for potato device
This commit is contained in:
LmeSzinc 2020-06-17 01:11:24 +08:00
parent 80951f864f
commit 80646b260f
3 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,6 @@
from module.base.base import ModuleBase from module.base.base import ModuleBase
from module.base.button import Button from module.base.button import Button
from module.base.timer import Timer
from module.logger import logger from module.logger import logger
@ -50,6 +51,7 @@ class Switch:
bool: bool:
""" """
changed = False changed = False
warning_show_timer = Timer(5, count=10).start()
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot:
skip_first_screenshot = False skip_first_screenshot = False
@ -65,8 +67,12 @@ class Switch:
matched = data matched = data
if current == status: if current == status:
return changed return changed
if current == 'unknown': if current == 'unknown':
logger.warning(f'Unknown {self.name} switch') if warning_show_timer.reached():
logger.warning(f'Unknown {self.name} switch')
warning_show_timer.reset()
continue
for data in self.status_list: for data in self.status_list:
if data['status'] == status: if data['status'] == status:

View File

@ -65,7 +65,7 @@ class ExerciseCombat(HpDaemon, OpponentChoose, ExerciseEquipment):
if self.appear_then_click(EXP_INFO_D): if self.appear_then_click(EXP_INFO_D):
continue continue
# Last D rank screen # Last D rank screen
if self.appear_then_click(OPTS_INFO_D, offset=(30,30)): if self.appear_then_click(OPTS_INFO_D, offset=(30, 30)):
continue continue
# Quit # Quit

View File

@ -17,7 +17,7 @@ class UI(ModuleBase):
""" """
return self.appear(page.check_button, offset=(20, 20)) return self.appear(page.check_button, offset=(20, 20))
def ui_click(self, click_button, check_button, appear_button=None, offset=(20, 20), retry_wait=3, def ui_click(self, click_button, check_button, appear_button=None, offset=(20, 20), retry_wait=10,
skip_first_screenshot=False): skip_first_screenshot=False):
""" """
Args: Args: