Skip to content

Commit

Permalink
Move debug print
Browse files Browse the repository at this point in the history
  • Loading branch information
hrjkknox committed Jun 16, 2023
1 parent 307335d commit f61902c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/winnie/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def __init__(self, channel: canlib.Channel, id: int, debug: bool = False):
self.debug = debug

def sendMessage(self, message: List[int]) -> List[int]:
if self.debug == True:
formatting.printHexList("Message: ", message)
if self.connected == False and message[0] != 0x01:
raise RuntimeError("Connection must be established before sending a message")
# Ensure that the message is 8 bytes long
if len(message) != 8:
raise ValueError("Messages must be 8 bytes long")
if self.debug == True:
formatting.printHexList("Message: ", message)
# Construct and send the frame
frame = Frame(id_=self.id, data=message)
self.channel.write(frame)
Expand Down

0 comments on commit f61902c

Please sign in to comment.