소스 검색

sequence_counter_h2s/sequence_h2s could get bigger as 256

fixed it by using the remainder operator where the variable is counted up.
Patrick Uhl 6 달 전
부모
커밋
2d216259e4
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      python_driver/shellmatta_transport.py

+ 1 - 1
python_driver/shellmatta_transport.py

@@ -138,7 +138,7 @@ class ShellmattaTransport():
                                 self.sequence_counter_s2h,
                                 data[:self.Packet.MAX_PAYLOAD_LENGTH],
                                 crc_fct=self.custom_crc)
-            self.sequence_counter_h2s += 1
+            self.sequence_counter_h2s = (self.sequence_counter_h2s + 1) % 256
             packet.secure()
             self.com_obj.write(bytes(packet))
             data = data[self.Packet.MAX_PAYLOAD_LENGTH:]