Skip to content

Commit 958cf2c

Browse files
committed
chore: update python can to 4.6.1
1 parent c02717e commit 958cf2c

3 files changed

Lines changed: 25 additions & 111 deletions

File tree

poetry.lock

Lines changed: 11 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pykiso-python-uds = { version = "~3.2.0", optional = true }
4949
pylink-square = { version = "~1.2.0", optional = true }
5050
pyreadline3 = { version = "^3.4.1", python = "^3.5" }
5151
pyserial = { version = "^3.0", optional = true }
52-
python-can = { version = "~4.4.2", optional = true, extras = ["pcan,vector"] }
52+
python-can = { version = "~4.6.1", optional = true, extras = ["pcan,vector"] }
5353
PyVISA = { version = "^1.12.0", optional = true }
5454
PyVISA-py = { version = "~0.5.3", optional = true }
5555
PyYAML = "^6.0"

src/pykiso/lib/connectors/cc_pcan_can/trc_handler.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __repr__(self) -> str:
7070
else:
7171
args = [
7272
f"timestamp={self.timestamp}",
73-
f"arbitration_id={self.arbitration_id:#x}",
73+
f"arbitration_id={self.arbitration_id: #x}",
7474
f"is_extended_id={self.is_extended_id}",
7575
]
7676

@@ -86,7 +86,7 @@ def __repr__(self) -> str:
8686
if self.channel is not None:
8787
args.append(f"channel={self.channel!r}")
8888

89-
data = [f"{byte:#02x}" for byte in self.data]
89+
data = [f"{byte: #02x}" for byte in self.data]
9090
args += [f"dlc={self.dlc}", f"data=[{', '.join(data)}]"]
9191

9292
if self.is_fd:
@@ -184,7 +184,14 @@ def _parse_msg_v2_x(self, cols: List[str] | Tuple[str]) -> Optional[Message]:
184184

185185
channel = int(cols[bus]) if bus is not None else 1
186186
dlc = dlc
187-
data = bytearray([int(cols[i + self.columns["D"]], 16) for i in range(length)])
187+
188+
# Parse data - handle space-separated hex values in a single column
189+
data = bytearray(length)
190+
if length > 0 and self.columns["D"] < len(cols) and cols[self.columns["D"]].strip():
191+
hex_values = cols[self.columns["D"]].strip().split()
192+
parsed_bytes = [int(val, 16) for val in hex_values if val]
193+
data[: len(parsed_bytes)] = parsed_bytes
194+
188195
is_rx = cols[self.columns["d"]] == "Rx"
189196
is_fd = type_ in ["FD", "FB", "FE", "BI"]
190197
bitrate_switch = type_ in ["FB", " FE"]
@@ -246,11 +253,11 @@ def _format_message_by_format(self, msg: TypedMessage, channel: int):
246253
arb_id = f"{msg.arbitration_id}"
247254
else:
248255
if msg.is_extended_id:
249-
arb_id = f"{msg.arbitration_id:07X}"
256+
arb_id = f"{msg.arbitration_id: 07X}"
250257
else:
251-
arb_id = f"{msg.arbitration_id:04X}"
258+
arb_id = f"{msg.arbitration_id: 04X}"
252259

253-
data = [f"{byte:02X}" for byte in msg.data]
260+
data = [f"{byte: 02X}" for byte in msg.data]
254261

255262
# For the time python-can was doing subtraction with the first message timestamp
256263
# which is incorrect. It should be with the start time of the trace otherwise the

0 commit comments

Comments
 (0)