Skip to content

Commit

Permalink
Merge pull request #80 from CaringCaribou/77-inconsistent-use-of-padd…
Browse files Browse the repository at this point in the history
…ing-in-xcp-module

XCP: Use consistent padding
  • Loading branch information
kasperkarlsson authored Mar 20, 2023
2 parents bed59de + 712e0e2 commit 658afe6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions caringcaribou/modules/xcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def xcp_command_discovery(args):
global connect_reply, command_reply
send_arb_id = args.src
rcv_arb_id = args.dst
connect_message = [0xFF, 0, 0, 0, 0, 0, 0, 0]
connect_message = [0xff, 0, 0, 0, 0, 0, 0, 0]

def connect_callback_handler(msg):
global connect_reply
Expand Down Expand Up @@ -273,7 +273,7 @@ def connect_callback_handler(msg):
def callback_handler(msg):
global command_reply
if msg.arbitration_id == rcv_arb_id:
print("{0:<23} {1}".format(cmd_desc, msg.data[0] != 0xFE))
print("{0:<23} {1}".format(cmd_desc, msg.data[0] != 0xfe))
command_reply = True

command_reply = False
Expand Down Expand Up @@ -452,9 +452,9 @@ def handle_connect_reply(msg):
n = start_address
bytes_left = length
# Calculate start address (r is automatically reversed after connect if needed)
n &= 0xFFFFFFFF
n &= 0xffffffff
for i in range(4):
r.append(n & 0xFF)
r.append(n & 0xff)
n >>= 8
# Make sure dump_file can be opened if specified (clearing it if it already exists)
if dump_file:
Expand All @@ -468,7 +468,7 @@ def handle_connect_reply(msg):
with CanActions(arb_id=send_arb_id) as can_wrap:
print("Attempting XCP memory dump")
# Connect and prepare for dump
can_wrap.send_single_message_with_callback([0xff], handle_connect_reply)
can_wrap.send_single_message_with_callback([0xff, 0, 0, 0, 0, 0, 0, 0], handle_connect_reply)
# Idle timeout handling
timeout_start = datetime.now()
while not dump_complete and datetime.now() - timeout_start < timedelta(seconds=3):
Expand Down

0 comments on commit 658afe6

Please sign in to comment.