From 98a37b3d60024083fbbbe8acf4ca20a6ed2c42b4 Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Thu, 7 Jan 2021 13:09:11 -0500 Subject: [PATCH] util: delay in between communication attempts --- src/main/python/util.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/python/util.py b/src/main/python/util.py index d8f581b..807aed6 100644 --- a/src/main/python/util.py +++ b/src/main/python/util.py @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later +import time from PyQt5.QtCore import QCoreApplication @@ -22,9 +23,13 @@ def hid_send(dev, msg, retries=1): msg += b"\x00" * (MSG_LEN - len(msg)) data = b"" + first = True while retries > 0: retries -= 1 + if not first: + time.sleep(0.5) + first = False try: # add 00 at start for hidapi report id if dev.write(b"\x00" + msg) != MSG_LEN + 1: