added timed loop exit to equip

This commit is contained in:
2022-05-22 13:19:36 +02:00
parent ee2c8b7daf
commit 69fe7cbec4

View File

@@ -42,7 +42,7 @@ def run():
# initialize the StunVision class # initialize the StunVision class
vision_stun = Vision() vision_stun = Vision()
loop_time = time() outer_loop_time = time()
needles = [] needles = []
hsvs = [] hsvs = []
@@ -147,7 +147,10 @@ def run():
cv.waitKey(500) cv.waitKey(500)
for rer in range(0, len(needles), 1): for rer in range(0, len(needles), 1):
loop_time = time()
while True: while True:
if (time() - loop_time) >= 60:
break
screenshot = capture_window.get_screenshot_by_area(config.returnOKWindowPos()) screenshot = capture_window.get_screenshot_by_area(config.returnOKWindowPos())
rectangles = vision_stun.find(screenshot, cv.imread("dig/ok_button.jpg", cv.IMREAD_UNCHANGED), 0.5, rectangles = vision_stun.find(screenshot, cv.imread("dig/ok_button.jpg", cv.IMREAD_UNCHANGED), 0.5,
1) 1)
@@ -209,8 +212,8 @@ def run():
pause = True pause = True
break break
# debug the loop rate # debug the loop rate
print('FPS {}'.format(1 / (time() - loop_time))) print('FPS {}'.format(1 / (time() - outer_loop_time)))
loop_time = time() outer_loop_time = time()
cv.waitKey(150) cv.waitKey(150)