Browse Source

RPI: properly catch exception when crc8 check failed

pull/285/head
Christian Ehrlicher 3 years ago
parent
commit
f332738ceb
  1. 2
      tools/rpi/hoymiles/__init__.py
  2. 2
      tools/rpi/hoymiles/__main__.py

2
tools/rpi/hoymiles/__init__.py

@ -203,7 +203,7 @@ class InverterPacketFragment:
# check crc8 # check crc8
if f_crc8(payload[:-1]) != payload[-1]: 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_rx = ch_rx
self.ch_tx = ch_tx self.ch_tx = ch_tx

2
tools/rpi/hoymiles/__main__.py

@ -86,8 +86,8 @@ def poll_inverter(inverter, do_init, retries=4):
dst=inverter_ser dst=inverter_ser
))) )))
response = None response = None
while com.rxtx():
try: try:
while com.rxtx():
response = com.get_payload() response = com.get_payload()
payload_ttl = 0 payload_ttl = 0
except Exception as e_all: except Exception as e_all:

Loading…
Cancel
Save