Change method for scanning for card from poll, which is OK for USB-connected PN532, but causes 100% CPU usage with SPI-connected PN532

This commit is contained in:
Ondrej Mikle 2018-05-06 01:43:43 +02:00
parent 9b89a230c9
commit 91c0d72de6
3 changed files with 16 additions and 15 deletions

View file

@ -127,8 +127,10 @@ class NFCScanner(object):
e = threading.Event()
e.wait(timeout=0.3)
except NFCError, e:
#this exception happens also when scanUID times out
logging.debug("Failed to wait for RFID card: %s", e)
#this exception happens also when scanUID finds no cards
logging.debug("Failed to find RFID cards in reader's field: %s", e)
e = threading.Event()
e.wait(timeout=0.2)
except KeyboardInterrupt:
logging.info("Exiting on keyboard interrupt")
self.nfc.close()