1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-22 07:00:12 +01:00

Sleep before reading the code

This commit is contained in:
Felipe Martins Diel 2020-05-22 15:25:33 -03:00
parent 9cda686d24
commit 753db8e25b

View File

@ -133,10 +133,11 @@ if args.learn or (args.learnfile and not args.rfscanlearn):
print("Learning...") print("Learning...")
start = time.time() start = time.time()
while time.time() - start < TIMEOUT: while time.time() - start < TIMEOUT:
time.sleep(1)
try: try:
data = dev.check_data() data = dev.check_data()
except (ReadError, StorageError): except (ReadError, StorageError):
time.sleep(1) continue
else: else:
break break
else: else:
@ -220,10 +221,11 @@ if args.rfscanlearn:
start = time.time() start = time.time()
while time.time() - start < TIMEOUT: while time.time() - start < TIMEOUT:
time.sleep(1)
try: try:
data = dev.check_data() data = dev.check_data()
except (ReadError, StorageError): except (ReadError, StorageError):
time.sleep(1) continue
else: else:
break break
else: else: