PowerBroker2 / pySerialTransfer

Python package to transfer data in a fast, reliable, and packetized form
MIT License
145 stars 35 forks source link

Check for CRC error #63

Closed 8sawte8 closed 11 months ago

8sawte8 commented 2 years ago

Hello,

thank you for this great package!

I wanted to understand your code and manipulated some lines in CRC.py.

But with your example Python script, nothing printed and I didn't get a Python error. After a while, I realized that:

CRC_ERROR = 0

So I think in the example script it should be:

if link.status <= 0:

 while not link.available():
                if link.status <= 0:
                    if link.status == txfer.CRC_ERROR:
                        print('ERROR: CRC_ERROR')
                    elif link.status == txfer.PAYLOAD_ERROR:
                        print('ERROR: PAYLOAD_ERROR')
                    elif link.status == txfer.STOP_BYTE_ERROR:
                        print('ERROR: STOP_BYTE_ERROR')
                    else:
                        print('ERROR: {}'.format(link.status))

Kind regards, 8sawte8

PowerBroker2 commented 2 years ago

That's correct, I'll fix at some point. Thanks!