diff --git a/SW/PC/Stopwatch/registrace.py b/SW/PC/Stopwatch/registrace.py index c7f386c..92867fd 100644 --- a/SW/PC/Stopwatch/registrace.py +++ b/SW/PC/Stopwatch/registrace.py @@ -62,7 +62,7 @@ threading.Thread(target=worker).start() def register_racer(): card_id = last_card index = window.racers.currentIndex() - if not index: + if not index.data(): mb = QtWidgets.QMessageBox(text='Prosím vyberte závodníka!') mb.exec() return diff --git a/SW/PC/Stopwatch/usbcardreader.py b/SW/PC/Stopwatch/usbcardreader.py index c149192..39f4619 100644 --- a/SW/PC/Stopwatch/usbcardreader.py +++ b/SW/PC/Stopwatch/usbcardreader.py @@ -1,6 +1,7 @@ import usb.core import usb.util - +import threading +import time USB_IF = 0 # Interface @@ -33,13 +34,13 @@ class UsbCardReader: control = None try: control = self.dev.read(self.endpoint.bEndpointAddress, self.endpoint.wMaxPacketSize, USB_TIMEOUT) - if (control[2] != 40) & (control[2] != 0): + if (control[2] != 40) and (control[2] != 0): receivedDigit = control[2] - 29 if receivedDigit == 10: receivedDigit = 0 receivedNumber = 10 * receivedNumber + receivedDigit - if (( control[0] == 0 )) & (( control[2] == 40 )) & (( not receivedNumber == 0 )): + if ( control[0] == 0 ) and ( control[2] == 40 ) and ( not receivedNumber == 0 ): self.callback(receivedNumber) receivedNumber = 0 except KeyboardInterrupt: