Skip to content

Commit ecdf443

Browse files
authored
fix: fix index out of range for uds response (#16)
* fix: fix index out of range for uds response response pending check
1 parent 2d8d5dc commit ecdf443

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [3.1.1]
5+
6+
### Bugfixes
7+
- ``Uds``: fix index out of range for uds response
8+
49
## [3.1.0]
510

611
### Features

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
tests_require=["pytest", "pytest-mock"],
2929
extras_require={"test": ["pytest", "pytest-mock"]},
3030
# *strongly* suggested for sharing
31-
version="3.1.0",
31+
version="3.1.1",
3232
# The license can be anything you like
3333
license="MIT",
3434
description="Please use python-uds instead, this is a refactored version with breaking changes, only for pykiso",

uds/uds_communications/Uds/Uds.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ def send(self, msg, responseRequired=True, functionalReq=False, tpWaitTime=0.01)
144144
while True:
145145
response = self.tp.recv(self.__P2_CAN_Client)
146146
current_time = time.perf_counter() - before_send_time
147-
if response[2] == 0x78:
147+
if not ((response[0] == 0x7F) and (response[2] == 0x78)):
148+
self.last_resp_time = current_time
149+
break
150+
else:
148151
if previous_time is None:
149152
self.last_pending_resp_times.append(current_time)
150153
previous_time = current_time
151154
else:
152155
self.last_pending_resp_times.append(current_time - previous_time)
153-
if not ((response[0] == 0x7F) and (response[2] == 0x78)):
154-
self.last_resp_time = current_time
155-
break
156156

157157
# If the diagnostic session control service is supported, record the sending time for possible use by the tester present functionality (again, if present) ...
158158
if hasattr(self, "sessionSetLastSend"):

0 commit comments

Comments
 (0)