From 4429600d8e47cb71786c92cc881352acf42087de Mon Sep 17 00:00:00 2001 From: Greg Hogan Date: Mon, 10 Dec 2018 20:50:56 -0800 Subject: [PATCH] fix separation time parsing --- python/uds.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/uds.py b/python/uds.py index 416c344696cbae..18e29aca9d9bfe 100644 --- a/python/uds.py +++ b/python/uds.py @@ -151,9 +151,9 @@ def _isotp_thread(panda, bus, tx_addr, tx_queue, rx_queue): assert tx_frame["done"] == False, "tx: no active frame" # TODO: support wait/overflow assert rx_data[0] == 0x30, "tx: flow-control requires: continue" - delay_ts = ord(rx_data[2]) & 0x7F + delay_ts = rx_data[2] & 0x7F # scale is 1 milliseconds if first bit == 0, 100 micro seconds if first bit == 1 - delay_div = 1000. if ord(rx_data[2]) & 0x80 == 0 else 10000. + delay_div = 1000. if rx_data[2] & 0x80 == 0 else 100000. # first frame = 6 bytes, each consecutive frame = 7 bytes start = 6 + tx_frame["idx"] * 7 count = rx_data[1] @@ -164,7 +164,7 @@ def _isotp_thread(panda, bus, tx_addr, tx_queue, rx_queue): msg = (chr(0x20 | (tx_frame["idx"] & 0xF)) + tx_frame["data"][i:i+7]).ljust(8, "\x00") if (DEBUG): print("S: {} {}".format(hex(tx_addr), hexlify(msg))) panda.can_send(tx_addr, msg, bus) - if delay_ts: + if delay_ts > 0: time.sleep(delay_ts / delay_div) tx_frame["done"] = True