mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 07:00:12 +01:00
Add missing "self." to calculate_crc16 uses (#344)
This commit is contained in:
parent
2f1ac5c9d3
commit
ed87b8d1de
@ -739,7 +739,7 @@ class hysen(device):
|
|||||||
|
|
||||||
def send_request(self, input_payload):
|
def send_request(self, input_payload):
|
||||||
|
|
||||||
crc = calculate_crc16(bytes(input_payload))
|
crc = self.calculate_crc16(bytes(input_payload))
|
||||||
|
|
||||||
# first byte is length, +2 for CRC16
|
# first byte is length, +2 for CRC16
|
||||||
request_payload = bytearray([len(input_payload) + 2, 0x00])
|
request_payload = bytearray([len(input_payload) + 2, 0x00])
|
||||||
@ -763,7 +763,7 @@ class hysen(device):
|
|||||||
response_payload_len = response_payload[0]
|
response_payload_len = response_payload[0]
|
||||||
if response_payload_len + 2 > len(response_payload):
|
if response_payload_len + 2 > len(response_payload):
|
||||||
raise ValueError('hysen_response_error', 'first byte of response is not length')
|
raise ValueError('hysen_response_error', 'first byte of response is not length')
|
||||||
crc = calculate_crc16(bytes(response_payload[2:response_payload_len]))
|
crc = self.calculate_crc16(bytes(response_payload[2:response_payload_len]))
|
||||||
if (response_payload[response_payload_len] == crc & 0xFF) and (
|
if (response_payload[response_payload_len] == crc & 0xFF) and (
|
||||||
response_payload[response_payload_len + 1] == (crc >> 8) & 0xFF):
|
response_payload[response_payload_len + 1] == (crc >> 8) & 0xFF):
|
||||||
return response_payload[2:response_payload_len]
|
return response_payload[2:response_payload_len]
|
||||||
|
Loading…
Reference in New Issue
Block a user