Skip to content

Commit 4429600

Browse files
committedOct 15, 2019
fix separation time parsing
1 parent c641e66 commit 4429600

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎python/uds.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ def _isotp_thread(panda, bus, tx_addr, tx_queue, rx_queue):
151151
assert tx_frame["done"] == False, "tx: no active frame"
152152
# TODO: support wait/overflow
153153
assert rx_data[0] == 0x30, "tx: flow-control requires: continue"
154-
delay_ts = ord(rx_data[2]) & 0x7F
154+
delay_ts = rx_data[2] & 0x7F
155155
# scale is 1 milliseconds if first bit == 0, 100 micro seconds if first bit == 1
156-
delay_div = 1000. if ord(rx_data[2]) & 0x80 == 0 else 10000.
156+
delay_div = 1000. if rx_data[2] & 0x80 == 0 else 100000.
157157
# first frame = 6 bytes, each consecutive frame = 7 bytes
158158
start = 6 + tx_frame["idx"] * 7
159159
count = rx_data[1]
@@ -164,7 +164,7 @@ def _isotp_thread(panda, bus, tx_addr, tx_queue, rx_queue):
164164
msg = (chr(0x20 | (tx_frame["idx"] & 0xF)) + tx_frame["data"][i:i+7]).ljust(8, "\x00")
165165
if (DEBUG): print("S: {} {}".format(hex(tx_addr), hexlify(msg)))
166166
panda.can_send(tx_addr, msg, bus)
167-
if delay_ts:
167+
if delay_ts > 0:
168168
time.sleep(delay_ts / delay_div)
169169
tx_frame["done"] = True
170170

0 commit comments

Comments
 (0)