From d5e31f1206b3f8dc366b7810e9945cc571f0ec9a Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 3 Jun 2022 00:16:19 -0700 Subject: [PATCH] keep track of pending responses to print warning --- selfdrive/car/isotp_parallel_query.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/isotp_parallel_query.py b/selfdrive/car/isotp_parallel_query.py index 8cf8df4b18..e8bba727c5 100644 --- a/selfdrive/car/isotp_parallel_query.py +++ b/selfdrive/car/isotp_parallel_query.py @@ -99,6 +99,7 @@ class IsoTpParallelQuery: results = {} start_time = time.monotonic() response_timeouts = {tx_addr: start_time + timeout for tx_addr in self.msg_addrs} + pending_responses = set() while True: self.rx() @@ -122,6 +123,7 @@ class IsoTpParallelQuery: if response_valid: response_timeouts[tx_addr] = time.monotonic() + timeout + pending_responses.discard(tx_addr) if counter + 1 < len(self.request): msg.send(self.request[counter + 1]) request_counter[tx_addr] += 1 @@ -132,6 +134,7 @@ class IsoTpParallelQuery: error_code = dat[2] if len(dat) > 2 else -1 if error_code == 0x78: response_timeouts[tx_addr] = time.monotonic() + self.response_pending_timeout + pending_responses.add(tx_addr) if self.debug: cloudlog.warning(f"iso-tp query response pending: {hex(tx_addr)}") else: @@ -141,7 +144,7 @@ class IsoTpParallelQuery: cur_time = time.monotonic() if cur_time - max(response_timeouts.values()) > 0: for tx_addr in msgs: - if (request_counter[tx_addr] > 0) and (not request_done[tx_addr]): + if (request_counter[tx_addr] > 0 or tx_addr in pending_responses) and (not request_done[tx_addr]): cloudlog.warning(f"iso-tp query timeout after receiving response: {tx_addr}") break