protocols: fix off-by-one in payload extraction
Drop all of the checksum bytes. This didn't take the end-of-frame marker into account.
This commit is contained in:
parent
b46d81a184
commit
0e020f2aa4
@ -417,7 +417,7 @@ class Stc89Protocol(StcBaseProtocol):
|
||||
raise StcFramingException("packet checksum mismatch")
|
||||
|
||||
payload = StcBaseProtocol.extract_payload(self, packet)
|
||||
return payload[:-1]
|
||||
return payload[:-2]
|
||||
|
||||
def write_packet(self, packet_data):
|
||||
"""Send packet to MCU.
|
||||
@ -812,7 +812,7 @@ class Stc12BaseProtocol(StcBaseProtocol):
|
||||
raise StcFramingException("packet checksum mismatch")
|
||||
|
||||
payload = StcBaseProtocol.extract_payload(self, packet)
|
||||
return payload[:-2]
|
||||
return payload[:-3]
|
||||
|
||||
def write_packet(self, packet_data):
|
||||
"""Send packet to MCU.
|
||||
|
Loading…
Reference in New Issue
Block a user