Browse Source
Merge pull request #285 from chehrlic/rpi_exception
RPI: properly catch exception when crc8 check failed
pull/294/head
lumapu
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
6 deletions
-
tools/rpi/hoymiles/__init__.py
-
tools/rpi/hoymiles/__main__.py
|
|
@ -203,7 +203,7 @@ class InverterPacketFragment: |
|
|
|
|
|
|
|
# check crc8 |
|
|
|
if f_crc8(payload[:-1]) != payload[-1]: |
|
|
|
raise BufferError('Frame kaputt') |
|
|
|
raise BufferError('Frame corrupted - crc8 check failed') |
|
|
|
|
|
|
|
self.ch_rx = ch_rx |
|
|
|
self.ch_tx = ch_tx |
|
|
|
|
|
@ -86,13 +86,13 @@ def poll_inverter(inverter, do_init, retries=4): |
|
|
|
dst=inverter_ser |
|
|
|
))) |
|
|
|
response = None |
|
|
|
while com.rxtx(): |
|
|
|
try: |
|
|
|
try: |
|
|
|
while com.rxtx(): |
|
|
|
response = com.get_payload() |
|
|
|
payload_ttl = 0 |
|
|
|
except Exception as e_all: |
|
|
|
print(f'Error while retrieving data: {e_all}') |
|
|
|
pass |
|
|
|
except Exception as e_all: |
|
|
|
print(f'Error while retrieving data: {e_all}') |
|
|
|
pass |
|
|
|
|
|
|
|
# Handle the response data if any |
|
|
|
if response: |
|
|
|