Conditions | 5 |
Total Lines | 18 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """ |
||
39 | def _send_data(self): |
||
40 | # Get the data |
||
41 | data = self.get_frame() |
||
42 | |||
43 | # Attempt to send data max 5 times, then 2 more with reconnect to device |
||
44 | # Thanks to Dave Hocker (pyudmx author) for giving me this solution to the random usb errors |
||
45 | success = False |
||
46 | retry_count = 0 |
||
47 | while not success: |
||
48 | try: |
||
49 | if retry_count > 5: |
||
50 | self.__connect() |
||
51 | self.udmx.send_multi_value(1, data) |
||
52 | success = True |
||
53 | except Exception as e: |
||
54 | retry_count += 1 |
||
55 | if retry_count > 7: |
||
56 | raise e |
||
57 |