Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions can/interfaces/ics_neovi/neovi_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ def _process_msg_queue(self, timeout=0.1):
if is_tx:
if bool(ics_msg.StatusBitField & ics.SPY_STATUS_GLOBAL_ERR):
continue
if ics_msg.DescriptionID:
receipt_key = (ics_msg.ArbIDOrHeader, ics_msg.DescriptionID)

receipt_key = (ics_msg.ArbIDOrHeader, ics_msg.DescriptionID)
if ics_msg.DescriptionID and receipt_key in self.message_receipts:
self.message_receipts[receipt_key].set()
if not self._receive_own_messages:
continue
Expand Down Expand Up @@ -477,11 +478,10 @@ def send(self, msg, timeout=0):
else:
raise ValueError("msg.channel must be set when using multiple channels.")

msg_desc_id = next(description_id)
message.DescriptionID = msg_desc_id
receipt_key = (msg.arbitration_id, msg_desc_id)

if timeout != 0:
msg_desc_id = next(description_id)
message.DescriptionID = msg_desc_id
receipt_key = (msg.arbitration_id, msg_desc_id)
self.message_receipts[receipt_key].clear()

try:
Expand All @@ -492,5 +492,9 @@ def send(self, msg, timeout=0):
# If timeout is set, wait for ACK
# This requires a notifier for the bus or
# some other thread calling recv periodically
if timeout != 0 and not self.message_receipts[receipt_key].wait(timeout):
raise CanTimeoutError("Transmit timeout")
if timeout != 0:
got_receipt = self.message_receipts[receipt_key].wait(timeout)
# We no longer need this receipt, so no point keeping it in memory
del self.message_receipts[receipt_key]
if not got_receipt:
raise CanTimeoutError("Transmit timeout")